www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking Trouble (Linux)

reply "Craig Dillabaugh" <cdillaba cg.scs.carleton.ca> writes:
I just upgraded my Linux distro (openSuse) and now when trying to
compile a project with dub I am getting linking errors.

Compilation goes OK until the linking stage, when I get the
following:

Linking...
dmd -of/home/craig/cloud/vibe-tiles/vibe
/home/craig/cloud/vibe-tiles/temp.o -L-levent_pthreads -L-levent
-L-lssl -L-lcrypto -g
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
warning: libdl.so.2, needed by /usr/lib64/libcrypto.so, not found
(try using -rpath or -rpath-link)
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
warning: libz.so.1, needed by /usr/lib64/libcrypto.so, not found
(try using -rpath or -rpath-link)
/usr/lib64/libcrypto.so: undefined reference to
`dlopen GLIBC_2.2.5'
/usr/lib64/libcrypto.so: undefined reference to
`dlerror GLIBC_2.2.5'
/usr/lib64/libcrypto.so: undefined reference to
`dlclose GLIBC_2.2.5'
/usr/lib64/libcrypto.so: undefined reference to
`dlsym GLIBC_2.2.5'
/usr/lib64/libcrypto.so: undefined reference to
`dladdr GLIBC_2.2.5'

Strangely, libdl.so.2 and libz.so.1 are both there and libcrypto
is linked to them.

$ ldd /usr/lib64/libcrypto.so
          linux-vdso.so.1 (0x00007fff7d520000)
          libdl.so.2 => /lib64/libdl.so.2 (0x00007f3b2ef98000)
          libz.so.1 => /lib64/libz.so.1 (0x00007f3b2ed80000)
          libc.so.6 => /lib64/libc.so.6 (0x00007f3b2e9d0000)
          /lib64/ld-linux-x86-64.so.2 (0x00007f3b2f5a8000)

I've surfed around quite a bit and can't seem to find anything.
I solved a similar problem in the past by reinstalling glibc, but
that hasn't helped in this case. Any hints on where to look would
be appreciated.

Craig
Sep 12 2013
parent reply "Craig Dillabaugh" <cdillaba cg.scs.carleton.ca> writes:
On Thursday, 12 September 2013 at 19:46:21 UTC, Craig Dillabaugh
wrote:
 I just upgraded my Linux distro (openSuse) and now when trying 
 to
 compile a project with dub I am getting linking errors.

 Compilation goes OK until the linking stage, when I get the
 following:

 Linking...
 dmd -of/home/craig/cloud/vibe-tiles/vibe
 /home/craig/cloud/vibe-tiles/temp.o -L-levent_pthreads -L-levent
 -L-lssl -L-lcrypto -g
clip
 Strangely, libdl.so.2 and libz.so.1 are both there and libcrypto
 is linked to them.
clip
 Craig
OK, so I solved my compilation problem by passing the following as the linker command (added -L-ldl and -L-lz): dmd -of/home/craig/cloud/vibe-tiles/vibe /home/craig/cloud/vibe-tiles/temp.o -L-levent_pthreads -L-levent -L-lssl -L-ldl -L-lz -L-lcrypto -g How the GCC linker decides which libraries I need to explicitly specify is indeed a mystery to me. Craig
Sep 12 2013
parent reply "Craig Dillabaugh" <cdillaba cg.scs.carleton.ca> writes:
On Thursday, 12 September 2013 at 20:26:29 UTC, Craig Dillabaugh
wrote:
 On Thursday, 12 September 2013 at 19:46:21 UTC, Craig Dillabaugh
 wrote:
 I just upgraded my Linux distro (openSuse) and now when trying 
 to
 compile a project with dub I am getting linking errors.

 Compilation goes OK until the linking stage, when I get the
 following:

 Linking...
 dmd -of/home/craig/cloud/vibe-tiles/vibe
 /home/craig/cloud/vibe-tiles/temp.o -L-levent_pthreads 
 -L-levent
 -L-lssl -L-lcrypto -g
clip
 Strangely, libdl.so.2 and libz.so.1 are both there and 
 libcrypto
 is linked to them.
clip
 Craig
OK, so I solved my compilation problem by passing the following as the linker command (added -L-ldl and -L-lz): dmd -of/home/craig/cloud/vibe-tiles/vibe /home/craig/cloud/vibe-tiles/temp.o -L-levent_pthreads -L-levent -L-lssl -L-ldl -L-lz -L-lcrypto -g How the GCC linker decides which libraries I need to explicitly specify is indeed a mystery to me. Craig
For anyone who runs into a similar problem using DUB the following package.json files solves the problem: { "name": "vibe", "description": "My first vibe project.", "homepage": "http://example.org", "copyright": "Me", "authors": [ "Craig Dillabaugh" ], "dependencies": { "vibe-d": "~master" }, "libs": ["dl", "z"] }
Sep 12 2013
parent reply "Craig Dillabaugh" <cdillaba cg.scs.carleton.ca> writes:
On Thursday, 12 September 2013 at 20:47:46 UTC, Craig Dillabaugh
wrote:
clip
 For anyone who runs into a similar problem using DUB the
 following package.json files solves the problem:

 {
 	"name": "vibe",
 	"description": "My first vibe project.",
 	"homepage": "http://example.org",
 	"copyright": "Me",
 	"authors": [
 		"Craig Dillabaugh"
 	],
 	"dependencies": {
 		"vibe-d": "~master"
 	},
 	"libs": ["dl", "z"]
 }
Hopefully starting a thread on a forum and then repeatedly answering yourself isn't a sign of insanity, but I've found the ultimate source of my problems and wanted to post back here in case it might help someone else (myself?) in the future. Anyway my suggested hacks above got my D programs to compile, but when I tried to run anything, I would get seg faults along the following lines: (gdb) backtrace It seems the source of my troubles was a broken binutils install by openSuse. So I re-installed binutils and now everything purrs along. Thanks to everyone for your help :o)
Sep 13 2013
parent reply 1100110 <0b1100110 gmail.com> writes:
https://xkcd.com/979/

Please.  You are somebodies hero.
Sep 29 2013
parent "Craig Dillabaugh" <craig.dillabaugh gmail.com> writes:
On Sunday, 29 September 2013 at 14:16:21 UTC, 1100110 wrote:
 https://xkcd.com/979/

 Please.  You are somebodies hero.
Did you actually run into the same problem? If so, glad I could help.
Sep 30 2013