1

Trying to test some sqlite with Swift 2 but I cannot make a correct build when adding the libsqlite3.0.tbd file on the Link Binary with libraries. I also tried to add the libsqlite3.dylib from /usr/lib but I get the following error.

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

any idea on how can I correctly build with the library. It is just an empty project just for testing. Thanks a lot in advance.

nizx
  • 690
  • 1
  • 6
  • 13

2 Answers2

1

Seeing this here as well. I am assuming the 'tbd' means 'to be done', as in, the library still needs to be built for the OSX 10.11 SDK. Should disappear in the next beta...

Meanwhile, it can be fixed by going to your project's settings -> Build Phases -> Link with binaries. Click '+', then click 'Add other'. Now hit Cmd-Shift-G and navigate to /usr/lib. There, you can select libsqlite3.dylib. Now your project should build without error.

In order to prevent errors when moving the XCode project around, make sure the reference to libsqlite3.dylib uses an absolute path (click on the .dylib in the file list, then go to the properties pane and select 'absolute path')

Tommy
  • 11
  • 4
  • the .tbd files are new "text-based stub libraries", that provide a much more compact version of the stub libraries for use in the SDK, and help to significantly reduce its download size. – hewigovens Sep 14 '15 at 09:18
1

Meanwhile, you can use libsqlite3.dylib from previous SDK. open terminal, type

locate libsqlite3.dylib

You'll find several files like these:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libsqlite3.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libsqlite3.dylib

Go to your project's setting -> Build Phases -> Link with Binaries. Add BOTH files by clicking +, then Add Other. Hit Cmd-Shift-G, and copy-paste the file path. Click Open.

If you install sqlite3 using macports, remove /opt/local/lib from Library Search Path in Build Settings.

roel
  • 1,640
  • 14
  • 13