RejectedSoftware Forums

Sign up

-levent linker error

Hi, I have been using D for a few weeks and also Vibe.d to build a simple web site. It used to work fine and then something happened and I can no longer build. I installed dub using homebrew.

I have enclosed the full build output. It is baffling indeed because the initial output seems to say that it has found the necessary packages including "event" but the linker fails to do so. If anybody can suggest a solution I would be very happy indeed as I was really getting into building a site with Vide.d, even in beta it seems very very useful.

Thanks,
Sean Charles.

--- the build output ---

Last login: Sun Mar 23 19:20:00 on ttys000
localhost:~ seancharles
$ cd Documents/Coding/d
localhost:~/Documents/Coding/d seancharles
$ ls -l
total 0
drwxr-xr-x 8 seancharles staff 272 23 Mar 19:24 foo
drwxr-xr-x 9 seancharles staff 306 28 Feb 15:30 fws
drwxr-xr-x 10 seancharles staff 340 28 Feb 10:52 modules
drwxr-xr-x 17 seancharles staff 578 1 Mar 08:44 slomograb
drwxr-xr-x 6 seancharles staff 204 23 Mar 19:18 test
drwxr-xr-x 7 seancharles staff 238 26 Feb 21:55 web1
localhost:~/Documents/Coding/d seancharles
$ cd foo
localhost:~/Documents/Coding/d/foo seancharles
$
localhost:~/Documents/Coding/d/foo seancharles
$ dub -v
Using dub registry url 'http://code.dlang.org/'
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/seancharles/.dub/packages/local-packages.json
Try to load local package map at /Users/seancharles/.dub/packages/local-packages.json
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/seancharles/.dub/packages/local-packages.json
Try to load local package map at /Users/seancharles/.dub/packages/local-packages.json
Note: Failed to determine version of package foo at /Users/seancharles/Documents/Coding/d/foo. Assuming ~master.
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/seancharles/.dub/packages/local-packages.json
Try to load local package map at /Users/seancharles/.dub/packages/local-packages.json
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/seancharles/.dub/packages/local-packages.json
Try to load local package map at /Users/seancharles/.dub/packages/local-packages.json
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/seancharles/.dub/packages/local-packages.json
Try to load local package map at /Users/seancharles/.dub/packages/local-packages.json
Found dependency vibe-d 0.7.18
Found dependency libevent ~master
Found dependency openssl ~master
Found dependency libev ~master
Checking for missing dependencies.
Search for versions of vibe-d (1 package suppliers)
Search for versions of libevent (1 package suppliers)
Search for versions of openssl (1 package suppliers)
Search for versions of libev (1 package suppliers)
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/seancharles/.dub/packages/local-packages.json
Try to load local package map at /Users/seancharles/.dub/packages/local-packages.json
Found dependency vibe-d 0.7.18
Found dependency libevent ~master
Found dependency openssl ~master
Found dependency libev ~master
Checking for upgrades.
Search for versions of vibe-d (1 package suppliers)
Search for versions of libevent (1 package suppliers)
Search for versions of openssl (1 package suppliers)
Search for versions of libev (1 package suppliers)
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /Users/seancharles/.dub/packages/local-packages.json
Try to load local package map at /Users/seancharles/.dub/packages/local-packages.json
Found dependency vibe-d 0.7.18
Found dependency libevent ~master
Found dependency openssl ~master
Found dependency libev ~master
Generating using build
Generate target foo (executable /Users/seancharles/Documents/Coding/d/foo foo)
Generate target vibe-d (staticLibrary /Users/seancharles/.dub/packages/vibe-d-0.7.18 vibe-d)
Generate target libevent (sourceLibrary /Users/seancharles/.dub/packages/libevent-master libevent)
Generate target openssl (sourceLibrary /Users/seancharles/.dub/packages/openssl-master openssl)
Target vibe-d (0.7.18) is up to date. Use --force to rebuild.
Using existing build in /Users/seancharles/.dub/packages/vibe-d-0.7.18/.dub/build/libevent-debug-posix.osx-x8664-dmd-AB0707232CA963B5DA23C2232BBED51B/.
Copying target from /Users/seancharles/.dub/packages/vibe-d-0.7.18/.dub/build/libevent-debug-posix.osx-x86
64-dmd-AB0707232CA963B5DA23C2232BBED51B/libvibe-d.a to /Users/seancharles/.dub/packages/vibe-d-0.7.18
Target '/Users/seancharles/Documents/Coding/d/foo/.dub/build/application-debug-posix.osx-x8664-dmd-B20341C4806BDAA6B0D8707469CD933B/foo' doesn't exist, need rebuild.
Building foo configuration "application", build type debug.
Trying to use pkg-config to resolve library flags for ["event", "event
pthreads", "ssl", "crypto"].
pkg-config failed: pkg-config exited with error code 1
Falling back to direct -lxyz flags.
Compiling...
dmd -c -of.dub/build/application-debug-posix.osx-x8664-dmd-B20341C4806BDAA6B0D8707469CD933B/foo.o -debug -g -w -version=VibeDefaultMain -version=VibeLibeventDriver -version=Havefoo -version=Havevibed -version=Havelibevent -version=Haveopenssl -Isource/ -I../../../../.dub/packages/vibe-d-0.7.18/source/ -I../../../../.dub/packages/libevent-master -I../../../../.dub/packages/openssl-master -Jviews source/app.d
Linking...
dmd -of.dub/build/application-debug-posix.osx-x8664-dmd-B20341C4806BDAA6B0D8707469CD933B/foo .dub/build/application-debug-posix.osx-x8664-dmd-B20341C4806BDAA6B0D8707469CD933B/foo.o ../../../../.dub/packages/vibe-d-0.7.18/libvibe-d.a -L-levent -L-leventpthreads -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/application-debug-posix.osx-x86
64-dmd-B20341C4806BDAA6B0D8707469CD933B/ foo executable
Error executing command run: dmd failed with exit code 1

Full exception: object.Exception@source/dub/compilers/compiler.d(221): dmd failed with exit code 1

5 dub 0x00000001026182e3 pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) + 107
6 dub 0x00000001025b9c10 void dub.compilers.compiler.Compiler.invokeTool(immutable(char), void delegate(int, immutable(char)[])) + 416
7 dub 0x00000001025be3e4 void dub.compilers.dmd.DmdCompiler.invokeLinker(const(dub.compilers.compiler.BuildSettings), const(dub.compilers.compiler.BuildPlatform), immutable(char), void delegate(int, immutable(char)[])) + 756
8 dub 0x00000001025ca7eb void dub.generators.build.BuildGenerator.buildWithCompiler(dub.generators.generator.GeneratorSettings, dub.compilers.compiler.BuildSettings) + 1347
9 dub 0x00000001025c8626 void dub.generators.build.BuildGenerator.performCachedBuild(dub.generators.generator.GeneratorSettings, dub.compilers.compiler.BuildSettings, const(dub.package.Package), immutable(char)[], immutable(char)[]) + 1246
10 dub 0x00000001025c805e void dub.generators.build.BuildGenerator.buildTarget(dub.generators.generator.GeneratorSettings, dub.compilers.compiler.BuildSettings, const(dub.package
.Package), immutable(char)[]) + 734
11 dub 0x00000001025c7d6f void dub.generators.build.BuildGenerator.generateTargets(dub.generators.generator.GeneratorSettings, const(dub.generators.generator.ProjectGenerator.TargetInfo[immutable(char)[]])).void buildTargetRec(immutable(char)[]) + 863
12 dub 0x00000001025c7866 void dub.generators.build.BuildGenerator.generateTargets(dub.generators.generator.GeneratorSettings, const(dub.generators.generator.ProjectGenerator.TargetInfo[immutable(char)[]])) + 446
13 dub 0x00000001025ccc12 void dub.generators.generator.ProjectGenerator.generate(dub.generators.generator.GeneratorSettings) + 738
14 dub 0x000000010258b6da void dub.dub.Dub.generateProject(immutable(char)[], dub.generators.generator.GeneratorSettings) + 170
15 dub 0x000000010257d38b int dub.commandline.GenerateCommand.execute(dub.dub.Dub, immutable(char), immutable(char)) + 1667
16 dub 0x000000010257d69d int dub.commandline.BuildCommand.execute(dub.dub.Dub, immutable(char), immutable(char)) + 141
17 dub 0x000000010257d855 int dub.commandline.RunCommand.execute(dub.dub.Dub, immutable(char), immutable(char)) + 141
18 dub 0x000000010257b443 int dub.commandline.runDubCommandLine(immutable(char)) + 4803
19 dub 0x000000010257917c Dmain + 32
20 dub 0x000000010268c2b1 void rt.dmain2.
drunmain(int, char, extern (C) int function(char[][])*).runAll().void __lambda1() + 33
21 dub 0x000000010268c1fd void rt.dmain2._d_run_main(int, char
, extern (C) int function(char)).tryExec(scope void delegate()) + 45
22 dub 0x000000010268c25d void rt.dmain2._d_run_main(int, char
, extern (C) int function(char[][])).runAll() + 45
23 dub 0x000000010268c1fd void rt.dmain2.drunmain(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 45
24 dub 0x000000010268c179
drunmain + 449
25 dub 0x00000001025791a6 main + 34
26 libdyld.dylib 0x00007fff83bbb5fd start + 1
27 ??? 0x0000000000000002 0x0 + 2
localhost:~/Documents/Coding/d/foo seancharles
$

Re: -levent linker error

On Sun, 23 Mar 2014 19:34:10 GMT, Sean Charles wrote:

Hi, I have been using D for a few weeks and also Vibe.d to build a simple web site. It used to work fine and then something happened and I can no longer build. I installed dub using homebrew.

I have enclosed the full build output. It is baffling indeed because the initial output seems to say that it has found the necessary packages including "event" but the linker fails to do so. If anybody can suggest a solution I would be very happy indeed as I was really getting into building a site with Vide.d, even in beta it seems very very useful.

(...)
Linking...
dmd -of.dub/build/application-debug-posix.osx-x86_64-dmd-B20341C4806BDAA6B0D8707469CD933B/foo .dub/build/application-debug-posix.osx-x86_64-dmd-B20341C4806BDAA6B0D8707469CD933B/foo.o ../../../../.dub/packages/vibe-d-0.7.18/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/application-debug-posix.osx-x86_64-dmd-B20341C4806BDAA6B0D8707469CD933B/ foo executable
Error executing command run: dmd failed with exit code 1
(...)

Looks like libevent isn't installed (but there have also been cases where it was installed, but still wasn't found). Try to see if brew install libevent fixes it. Unfortunately DUB currently has no knowledge of external (non-DUB) dependencies, but it's planned to at least give proper hints to the user in the future.

Re: -levent linker error

That did it, many thanks indeed!