Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Not building from Xcode #1

Open
kirilltitov opened this issue Jun 27, 2017 · 3 comments
Open

Not building from Xcode #1

kirilltitov opened this issue Jun 27, 2017 · 3 comments

Comments

@kirilltitov
Copy link

Ld /Users/myuser/Library/Developer/Xcode/DerivedData/LevelDB-awlmerkqkqbiichfdutjwnukdmzg/Build/Products/Debug/LevelDB.framework/Versions/A/LevelDB normal x86_64
cd /Users/myuser/projects/Packages/LevelDB
export MACOSX_DEPLOYMENT_TARGET=10.10
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -L/Users/myuser/Library/Developer/Xcode/DerivedData/LevelDB-awlmerkqkqbiichfdutjwnukdmzg/Build/Products/Debug -F/Users/myuser/Library/Developer/Xcode/DerivedData/LevelDB-awlmerkqkqbiichfdutjwnukdmzg/Build/Products/Debug -F/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -filelist /Users/myuser/Library/Developer/Xcode/DerivedData/LevelDB-awlmerkqkqbiichfdutjwnukdmzg/Build/Intermediates.noindex/LevelDB.build/Debug/LevelDB.build/Objects-normal/x86_64/LevelDB.LinkFileList -install_name @rpath/LevelDB.framework/Versions/A/LevelDB -Xlinker -rpath -Xlinker /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -mmacosx-version-min=10.10 -Xlinker -object_path_lto -Xlinker /Users/myuser/Library/Developer/Xcode/DerivedData/LevelDB-awlmerkqkqbiichfdutjwnukdmzg/Build/Intermediates.noindex/LevelDB.build/Debug/LevelDB.build/Objects-normal/x86_64/LevelDB_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/myuser/Library/Developer/Xcode/DerivedData/LevelDB-awlmerkqkqbiichfdutjwnukdmzg/Build/Intermediates.noindex/LevelDB.build/Debug/LevelDB.build/Objects-normal/x86_64/LevelDB.swiftmodule -single_module -Xlinker -dependency_info -Xlinker /Users/myuser/Library/Developer/Xcode/DerivedData/LevelDB-awlmerkqkqbiichfdutjwnukdmzg/Build/Intermediates.noindex/LevelDB.build/Debug/LevelDB.build/Objects-normal/x86_64/LevelDB_dependency_info.dat -o /Users/myuser/Library/Developer/Xcode/DerivedData/LevelDB-awlmerkqkqbiichfdutjwnukdmzg/Build/Products/Debug/LevelDB.framework/Versions/A/LevelDB

ld: library not found for -lleveldb for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I DO have LevelDB installed in system (via HomeBrew), macOS Sierra, Xcode 8.3.3 and Xcode 9 Beta.

@eyeplum
Copy link
Member

eyeplum commented Jun 29, 2017

Yeah...I was having some issue with the libleveldb dependency back when I created this.

The solution for the package manager was to add a specific linker flag like this.

The root cause of this was that the package manager used pkgconfig to locate the libraries, but LevelDB didn't seem to have this info configured correctly.

If you can also add this flag in Xcode build settings, it should work.

Not sure if it is possible to fix it at the package level to enable all build systems to simply build it without any specific linker flags.

I will take a look when I have time. Thanks for the feedback.

@kirilltitov
Copy link
Author

kirilltitov commented Jun 29, 2017

Well, yeah, it was kinda my bad, I was tuning the root project settings, not package project settings (noob, yep), until then Xcode simply refused to locate lib and header files. Linker flags in Xcode made it work as well as for swift build command. I made a build.sh script with linker flags as a temporary shortcut solution to build project from CLI.

Probably we all (members of Swift community who faced this problem) should push LevelDB team to make proper pkgconfig.

@eyeplum
Copy link
Member

eyeplum commented Jun 29, 2017

Glad you find your way around.
Yeah, it would be great if the LevelDB guys can do that, gave you a +1 there :)

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

No branches or pull requests

2 participants