Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation Guide #10

Open
gurmeherchawla opened this issue May 9, 2017 · 18 comments
Open

Installation Guide #10

gurmeherchawla opened this issue May 9, 2017 · 18 comments
Assignees
Labels

Comments

@gurmeherchawla
Copy link

Your installation guide instructs to build the LLVM sources using the makefile.
After running the makefile, what must be done?

@macmade
Copy link
Owner

macmade commented May 9, 2017

If you have built Clang/LLVM from the supplied makefile in ClangKit/LLVM, then everything should be fine.
The makefile copies the new libraries to the location expected by the Xcode project.

So simply rebuild ClangKit from Xcode...

@macmade macmade self-assigned this May 9, 2017
@gurmeherchawla
Copy link
Author

And where can I view these libraries in the Xcode project? Linked frameworks and libraries?

@macmade
Copy link
Owner

macmade commented May 9, 2017

They are set in the target's build settings (OTHER_LDFLAGS).

@gurmeherchawla
Copy link
Author

Even though I've done that, I am still getting the following verbose message in the CKDiagnotic:
ignoring nonexistent directory "/Users/Gurmeher/Library/Developer/Xcode/DerivedData/ClangKit-ddxafeblyiqsqwagblctgyofkfet/Build/Products/Debug/ClangKit.framework/Versions/A/clang/3.7.0/include"

@gurmeherchawla
Copy link
Author

Must there be a clang directory in the ClangKit Framework's root?

@macmade
Copy link
Owner

macmade commented May 9, 2017

No, there's not... Clang include are not copied into the framework.
Looks like you modified the project to copy them, hence the error...

@gurmeherchawla
Copy link
Author

The include directory is not being copied into the framework.
It seems that the CKTranslation is looking for include directory at the root folder of the framework, and cannot find the same.

@macmade
Copy link
Owner

macmade commented May 9, 2017

I have no idea about what you are trying to achieve.

If you don't give me some context, I won't be able to help you...

  • Are you experiencing a compile-time issue, or a runtime issue?
  • Why are you rebuilding LLVM?
  • How did you modified the project?
  • ...

I cannot read your mind...

@gurmeherchawla
Copy link
Author

  • I have built the ClangKit(framework) target from Xcode.
  • I have then run the ClangKitTest target.
  • The C code compiles without any diagnostics.
  • However, when the Objective-C Code compiles with the diagnostic: "'stdarg.h' file not found"
  • On passing the "-v" flag in the CKTranslationUnit arguments, I am getting the message:
    ignoring nonexistent directory "/Users/Gurmeher/Library/Developer/Xcode/DerivedData/ClangKit-ddxafeblyiqsqwagblctgyofkfet/Build/Products/Debug/ClangKit.framework/Versions/A/clang/3.7.0/include"

@macmade
Copy link
Owner

macmade commented May 9, 2017

Ok, so this is a runtime issue.
Basically, it means that ClangKit is working fine, if it gives you diagnostics.

Again, as mentioned in your previous issue, if <stdarg.h> is not found, it means your development environment is not correctly set-up.
And ClangKit warns you about this, as your compiler would do.

What version of macOS/Xcode are you using?

@gurmeherchawla
Copy link
Author

The latest of both.
Also, I have tried running the app on various systems but with no success.

@macmade
Copy link
Owner

macmade commented May 9, 2017

Ok, I'll see if I can update the example, so it's more clear.

The error you are getting just means you need to supply additional arguments to the translation unit, as you would do for a usual compiler.

@macmade
Copy link
Owner

macmade commented May 9, 2017

OK, I've added an example in 6e2a2f5.
It gets the correct Clang include paths from the Xcode default toolchain, if available.

Depending on your Xcode version, ClangKit may report other diagnostics, because the LLVM libraries need to be updated for the latest macOS SDKs.
But as it seems you've updated them, this shouldn't be an issue.

I'll try to update them, but I'm on other things right now.

@gurmeherchawla
Copy link
Author

On downloading and running the latest ClangKit build, I am getting the following verbose message on compilation of the Objective C Code through CKTranslationUnit:

ignoring nonexistent directory "/Users/Gurmeher/Library/Developer/Xcode/DerivedData/ClangKit-fawyikkexkgzgxawdfflitbxsezj/Build/Products/Debug/ClangKit.framework/Versions/A/clang/3.7.0/include"
#include "..." search starts here:
#include <...> search starts here:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include
/usr/local/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
ignoring nonexistent directory "/Users/Gurmeher/Library/Developer/Xcode/DerivedData/ClangKit-fawyikkexkgzgxawdfflitbxsezj/Build/Products/Debug/ClangKit.framework/Versions/A/clang/3.7.0/include"
#include "..." search starts here:
#include <...> search starts here:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include
/usr/local/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.

Also, the CKDiagnostic objects returned from the CKTranslation are as follows:

2017-05-10 17:11:02.145609 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015a9a80>: Error[19:21] - expected a type
2017-05-10 17:11:02.145699 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.145778 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015a9ee0>: Error[25:28] - expected a type
2017-05-10 17:11:02.145822 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.145874 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015aa340>: Error[32:4] - expected a type
2017-05-10 17:11:02.145889 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.145908 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015aa7a0>: Error[44:12] - unknown property attribute 'class'
2017-05-10 17:11:02.145920 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.145939 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015aac10>: Error[57:4] - expected a type
2017-05-10 17:11:02.145950 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.145967 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015ab070>: Error[58:4] - expected a type
2017-05-10 17:11:02.145979 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.145995 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015ab4d0>: Error[7:15] - expected ';' after @Class
2017-05-10 17:11:02.147111 ClangKitTest[796:17080] FixIts: (
"<CKFixIt: 0x1015a9760>: ;"
)
2017-05-10 17:11:02.147153 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015ab970>: Error[7:16] - cannot find protocol declaration for 'ObjectType'
2017-05-10 17:11:02.147204 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.147286 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015abdf0>: Error[34:25] - cannot find protocol declaration for 'ObjectType'
2017-05-10 17:11:02.147310 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.147341 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015ac270>: Error[34:37] - expected identifier or '('
2017-05-10 17:11:02.147360 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.147397 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015ac6d0>: Error[36:4] - expected a type
2017-05-10 17:11:02.147454 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.147517 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015acb30>: Error[40:25] - cannot find protocol declaration for 'ObjectType'
2017-05-10 17:11:02.147539 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.147569 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015acfb0>: Error[40:1] - duplicate interface definition for class 'NSEnumerator'
2017-05-10 17:11:02.147587 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.147761 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015ad430>: Error[40:37] - method type specifier must start with '-' or ' '
2017-05-10 17:11:02.147789 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.147832 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015ad8b0>: Error[40:38] - expected a type
2017-05-10 17:11:02.147909 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.147962 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015add10>: Error[42:1] - expected selector for Objective-C method
2017-05-10 17:11:02.147985 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.148016 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015ae180>: Error[42:36] - cannot find protocol declaration for 'ObjectType'
2017-05-10 17:11:02.148077 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.148134 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015ae600>: Error[17:4] - expected a type
2017-05-10 17:11:02.148163 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.148198 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015aea60>: Error[30:42] - expected a type
2017-05-10 17:11:02.148244 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.148328 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015aeec0>: Warning[9:16] - unused variable 'x'
2017-05-10 17:11:02.148461 ClangKitTest[796:17080] FixIts: (
)
2017-05-10 17:11:02.148498 ClangKitTest[796:17080] Diagnostic: <CKDiagnostic: 0x1015af320>: Warning[10:16] - unused variable 'f'
2017-05-10 17:11:02.148519 ClangKitTest[796:17080] FixIts: (
)

@macmade
Copy link
Owner

macmade commented May 10, 2017

That's what I told you in my previous comment.

@gurmeherchawla
Copy link
Author

gurmeherchawla commented May 11, 2017

I have rebuilt the latest LLVM and Clang from source. However, I am unable to find the static libraries from the build named as follows:
libclang.a

@macmade
Copy link
Owner

macmade commented May 11, 2017

In the new build? Have you tried removing it from the LD flags?

@macmade macmade closed this as completed May 11, 2017
@macmade macmade reopened this May 11, 2017
@gurmeherchawla
Copy link
Author

Do you mean removing -libclang from the LDFlags?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants