Le 19/12/2013 13:46, MrSmith a écrit :
Still need help. I've tried compiling a little test project with dub and
it compiled. Then i tried to compile it by hand and got the same error.
I think there is some issue in my command with parameter ordering.

Here is test project

module test;

import derelict.glfw3.glfw3;
import std.stdio;

void main() {
     DerelictGLFW3.load();
     writeln("test");
}

with package

{
     "targetName": "test",
     "dependencies": {
         "derelict-glfw3": "~master"
     },
     "targetType":"executable",
     "name": "test",
     "sourceFiles":["./test.d"]
}

The dub does two step compilation:
dmd -m32
-of.dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test
-c
-of.dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test.o
-debug -g -w -version=Have_test -version=Have_derelict_glfw3
-version=Have_derelict_util
-I../../.dub/packages/derelict-glfw3-master/source
-I../../.dub/packages/derelict-util-1.0.0/source test.d
../../.dub/packages/derelict-glfw3-master/source/derelict/glfw3/package.d 
../../.dub/packages/derelict-glfw3-master/source/derelict/glfw3/glfw3.d
../../.dub/packages/derelict-util-1.0.0/source/derelict/util/xtypes.d
../../.dub/packages/derelict-util-1.0.0/source/derelict/util/exception.d
../../.dub/packages/derelict-util-1.0.0/source/derelict/util/system.d
../../.dub/packages/derelict-util-1.0.0/source/derelict/util/loader.d
../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d
../../.dub/packages/derelict-util-1.0.0/source/derelict/util/wintypes.d
Linking...
dmd
-of.dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test
.dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test.o
-L-ldl -m32 -g
Copying target from
/home/andrey/test/.dub/build/application-debug-x86-dmd-DA39A3EE5E6B4B0D3255BFEF95601890AFD80709/test
to /home/andrey/test


So, do i need to use two step compilation or i need proper ordering of
parameters?
One more question: why dub uses -of flag twice?

I use pragma(lib, "dl"), but it doesn't work with DUB cause it separate build and link steps. I like the idea that sources knows them selves how they have to be build. I think it's possible to simply do rdmd main.d when using pragma(lib, "xxx").

For dub, add this line in your package.json :
    "libs-posix": ["dl"],

Reply via email to