Thread overview
Failed 'dub run' with 'Failed to invoke the compiler dmd'
Oct 31, 2015
Timoses
Oct 31, 2015
Mike Parker
Oct 31, 2015
Timoses
Oct 31, 2015
Timoses
Oct 31, 2015
Timoses
Oct 31, 2015
Mike Parker
Oct 31, 2015
Timoses
October 31, 2015
Hey,

just getting started with D. I wanted to try out Vibelog. However, when trying to run

dub run

I receive the error:

Failed to invoke the compiler dmd to determine the build platform: /bin/sh: dmd: command not found

I'm on OSX - El Capitan and installed dub over Homebrew.

Bests,
Timoses
October 31, 2015
On Saturday, 31 October 2015 at 03:00:46 UTC, Timoses wrote:
> Hey,
>
> just getting started with D. I wanted to try out Vibelog. However, when trying to run
>
> dub run
>
> I receive the error:
>
> Failed to invoke the compiler dmd to determine the build platform: /bin/sh: dmd: command not found
>
> I'm on OSX - El Capitan and installed dub over Homebrew.
>
> Bests,
> Timoses

How did you install DMD?
October 31, 2015
On Saturday, 31 October 2015 at 03:38:57 UTC, Mike Parker wrote:
> How did you install DMD?

I didn't : P. First hurdle taken. It now compiles.

However, I get a linking error:

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.
October 31, 2015
dub run -v

Linking...
dmd -of.dub/build/standalone-debug-posix.osx-x86_64-dmd_2068-4E2C9DFD17A7951AAA2F7856AB27FB45/vibelog .dub/build/standalone-debug-posix.osx-x86_64-dmd_2068-4E2C9DFD17A7951AAA2F7856AB27FB45/vibelog.o ../../.dub/packages/stringex-0.0.2/libstringex.a ../../.dub/packages/dyaml-0.5.2/libdyaml.a ../../.dub/packages/tinyendian-0.1.2/libtinyendian.a ../../.dub/packages/vibe-d-0.7.26-alpha.2/libvibe-d.a -L-levent -L-levent_pthreads -L-lssl -L-lcrypto -g
ld: library not found for -levent
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1
FAIL .dub/build/standalone-debug-posix.osx-x86_64-dmd_2068-4E2C9DFD17A7951AAA2F7856AB27FB45/ vibelog executable
dmd failed with exit code 1.
October 31, 2015
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 ?
October 31, 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.
October 31, 2015
On Saturday, 31 October 2015 at 06:13:27 UTC, Mike Parker wrote:
> 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.

Cool! Thanks a lot!