Code Monkey home page Code Monkey logo

Comments (8)

atsushieno avatar atsushieno commented on June 14, 2024

Thanks for the report. Unfortunately I could not reproduce the issue. I tried what you explained above but it was successful:

/sources/nclang/NClang/bin/Debug/net462$ ls
NClang.dll  NClang.pdb  sample.m  x.cs  x.exe
/sources/nclang/NClang/bin/Debug/net462$ cat x.cs
using System;
using NClang;

public class Driver
{
	public static void Main (string [] args)
	{
		var index = ClangService.CreateIndex();
		var trans = index.ParseTranslationUnit("sample.m", args, null, TranslationUnitFlags.SingleFileParse);
	}
}

/sources/nclang/NClang/bin/Debug/net462$ csc x.cs -r:NClang.dll
Microsoft (R) Visual C# Compiler version 3.4.0-beta4-19569-03 (82f2e254)
Copyright (C) Microsoft Corporation. All rights reserved.

/sources/nclang/NClang/bin/Debug/net462$ mono x.exe -x objective-c
/sources/nclang/NClang/bin/Debug/net462$ cat sample.m
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

   NSLog (@"hello world");
   [pool drain];
   return 0;
}

Could you please provide more specific repro steps, and/or check that the above works for you? Thanks.

from nclang.

Dadoum avatar Dadoum commented on June 14, 2024

AnotherTry.tar.gz
Here is a sample that triggers the bug, (It could be triggered by iPhoneSDK maybe)
And "-x objective-c" is given in one argument else it outputs error unable to build module Foundation

from nclang.

atsushieno avatar atsushieno commented on June 14, 2024

The execution result would depend on the environment as I'm running this on Linux but you want to use modern ParseTranslationUnit() overload:

        ClangTranslationUnit tu;
        var errors = index.ParseTranslationUnit("Sample.m", Flags, null, TranslationUnitFlags.SingleFileParse, out tu);
        Console.WriteLine (errors);

It resulted in ASTReadError for me.

from nclang.

Dadoum avatar Dadoum commented on June 14, 2024

Same for me it results to an ASTReadError (and I'm on Linux, Kubuntu as I said before)

from nclang.

atsushieno avatar atsushieno commented on June 14, 2024

I mean, the result is expected.

Try with the actual clang and see what it says:

~/Desktop/AnotherTry/bin/Debug$ cat Sample.m 
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

   NSLog (@"hello world");
   [pool drain];
   return 0;
}~/Desktop/AnotherTry/bin/Debug$ clang -x objective-c Sample.m 
Sample.m:1:9: fatal error: 'Foundation/Foundation.h' file not found
#import <Foundation/Foundation.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

from nclang.

Dadoum avatar Dadoum commented on June 14, 2024

clang -target ./target/arm64-apple-darwin14 -arch arm64 -x objective-c -fmodules -isysroot ./sdk/ Sample.m works itself while the sample given before with

static string[] Flags =
    { 
            "-target " + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "target/arm64-apple-darwin14"),
            "-isysroot " + Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sdk"),
            "-fmodules",
            "-x objective-c",
    };

with
Debug.tar.gz
doesn't work and fail

from nclang.

atsushieno avatar atsushieno commented on June 14, 2024

This does not seem to be runnable:

~/Desktop/AnotherTry/bin/Debug$ clang -target ./target/arm64-apple-darwin14 -arch arm64 -x objective-c -fmodules -isysroot ./sdk/ Sample.m
./target/arm64-apple-darwin14-ld: error while loading shared libraries: libtapi.so: cannot open shared object file: No such file or directory

from nclang.

Dadoum avatar Dadoum commented on June 14, 2024

This is because I installed libtapi on my computer, there it is in https://kabiroberai.com/toolchain/download.php?toolchain=ios-linux

from nclang.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.