How To Compile D2SQLite3 on OSX?

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 8 00:02:40 PDT 2015


On 2015-09-08 07:50, Mike McKee wrote:

> $ dmd test.d
> Undefined symbols for architecture x86_64:
>
> How do I get this going?

You need to link with the library, i.e.

$ dmd test.d libd2sqlite3.a

You probably need to link the native SQLite3 library as well:

$ dmd test.d libd2sqlite3.a 
-L/usr/local/Cellar/sqlite/3.8.11.1/lib/libsqlite3.dylib

But the correct way to do this is create a dub.json file for your own 
project which adds "d2sqlite3" as a dependency:

1. Run "dub init foo"
2. Navigate to the newly created directory "foo"
3. Add your source file(s) to "source"
4. Add "d2sqlite3" as a dependency in "dub.json" in the "dependencies" 
object/dictionary
5. Run "dub" to build and run the project. It will automatically fetch 
and build the dependencies

You might need to add that linker [2] flag to your dub.json file if the 
library is not in the standard library path (/usr/lib or /usr/local/lib).

For more information about the dub.json format see [1].

[1] http://code.dlang.org/package-format?lang=json
[2] "lflags": ["-L/usr/local/Cellar/sqlite/3.8.11.1/lib/libsqlite3.dylib"]

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list