DUB: link to local library
rcor via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Sep 10 06:40:14 PDT 2014
I'd like to link to DAllegro5, which doesn't have an official dub
package yet.
My project structure looks like this:
------------------------------
ext/
dallegro5/
allegro5/ <---- d bindings that need to be imported
libdallegro5.a <-- library I need to link to
src/
app.d <---- single source file which uses DAllegro5
bindings
dub.json
------------------------------
app.d is just the DAllegro5 example:
https://github.com/SiegeLord/DAllegro5/blob/master/example.d
I can build a working executable with the following command:
dmd -Iext/dallegro5 -L-Lext/dallegro5 src/app.d
dub.json contains what I think should do the same as above:
{
"name": "test",
"importPaths": ["ext/dallegro5"],
"lflags": ["-Lext/dallegro5"]
}
Obviously this is missing some fields that I would want in a full
project like authors and license but I'm trying to keep it simple
until I figure out dub.
dub.json seems like it should add the import and library search
paths just like the dmd command I used, but instead fails with
linker errors:
.dub/build/application-debug-linux.posix-x86_64-dmd-323FC98A6F20DD1891F81CB0FEE1D200/test.o:(.rodata+0x1ba8):
undefined reference to `_D8allegro57allegro12__ModuleInfoZ'
... a few more of these, followed by:
.../test/src/app.d:39: undefined reference to `al_init'
... and many more undefined references
Does anyone have an idea of how to make this work? I can push
this test project structure up on a git repo if it would help to
see the whole thing.
More information about the Digitalmars-d-learn
mailing list