Failed 'dub run' with 'Failed to invoke the compiler dmd'

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 30 23:13:24 PDT 2015


On Saturday, 31 October 2015 at 05:33:08 UTC, Timoses wrote:
> On Saturday, 31 October 2015 at 04:00:18 UTC, Timoses wrote:
>> Linking...
>> ld: library not found for -levent
>> clang: error: linker command failed with exit code 1 (use -v 
>> to see invocation)
>> --- errorlevel 1
>> dmd failed with exit code 1.
>
> Seems to be fixed by editing dmd.conf (added -L-L/usr/local/lib)
>
> [Environment]
>
> DFLAGS=-I/Library/D/dmd/src/phobos 
> -I/Library/D/dmd/src/druntime/import -L-L/Library/D/dmd/lib 
> -L-L/usr/local/lib
>
> Have a question though:
> Why is it -L-L/usr/local/lib
> and not -L/usr/local/lib ?

DMD uses different linkers depending on the platform. For the 
compiler, -L means 'pass this command to the linker.' In this 
case, that just also happens to be -L, which is understood by ld 
(the system linker) as the flag to set the library path. If you 
were using the Microsoft linker on Windows, it would be 
-L/LIBPATH:dir. If you were manually linking with libevent on Mac 
or Linux, you would pass -L-levent, and so on.


More information about the Digitalmars-d-learn mailing list