Missing libraries in linker command line (GLibC and OpenSSL)

Added by Philipp Grosswiler over 10 years ago

When trying to compile the latest Showtime version from GIT (HTS Showtime GIT-2.99.268.gacb3e.dirty) the following errors may appear:

/usr/bin/ld: build.linux/src/arch/trap_linux.o: undefined reference to symbol '[email protected]GLIBC_2.2.5'
/usr/bin/ld: note: 'dladdr
@GLIBC_2.2.5' is defined in DSO //lib64/libdl.so.2 so try adding it to the linker command line
//lib64/libdl.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [build.linux/showtime] Error 1

/usr/bin/ld: build.linux/ext/librtmp/rtmp.o: undefined reference to symbol '[email protected]OPENSSL_1.0.0'
/usr/bin/ld: note: 'BN_new
@OPENSSL_1.0.0' is defined in DSO //usr/lib64/libcrypto.so.1.0.0 so try adding it to the linker command line
//usr/lib64/libcrypto.so.1.0.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [build.linux/showtime] Error 1

I could successfully fix the above errors by appending the following libraries to the configure.linux file:

echo >>${CONFIG_MAK} LDFLAGS_cfg += -lpthread -lrt -ldl -lcrypto


Replies (7)

RE: Missing libraries in linker command line (GLibC and OpenSSL) - Added by Andreas Smas over 10 years ago

Hm OK, What's the output from

pkg-config --libs openssl

on your machine?

RE: Missing libraries in linker command line (GLibC and OpenSSL) - Added by Philipp Grosswiler over 10 years ago

I get the following output when running pkg-config --libs openssl:

-lssl -lcrypto 

uname -a gives the following:

Linux SUISSE 2.6.38-2-amd64 #1 SMP Thu Apr 7 04:28:07 UTC 2011 x86_64 GNU/Linux

RE: Missing libraries in linker command line (GLibC and OpenSSL) - Added by Andreas Smas over 10 years ago

Ok,
pkg-config --libs openssl
is exactly what showtime's configure uses to figure this out.

Can you paste a copy of your build.linux/config.mak

RE: Missing libraries in linker command line (GLibC and OpenSSL) - Added by Philipp Grosswiler over 10 years ago

I will attach my config.mak to this post.

As far as I can see, it seems it only included -lssl and omitted the -lcrypto which caused the error.

config.mak (2.42 KB)

RE: Missing libraries in linker command line (GLibC and OpenSSL) - Added by Andreas Smas over 10 years ago

Well, as you might already have seen the configure.linux (which is invoked from configre) uses pkg-config --libs openssl to get the flags. Something must be broken on your system then. No idea what that can be though.

RE: Missing libraries in linker command line (GLibC and OpenSSL) - Added by Philipp Grosswiler over 10 years ago

I found out what is the reason for my problem.

In your configure.linux script, you are first checking for

pkg-config libssl

which returns -lssl on my system. I don't know why I have both packages available, but the following one

pkg-config openssl

is the one that works and returns -lssl -lcrypto.

So how to solve this problem? Would it be possible to have the openssl check before the libssl check?

RE: Missing libraries in linker command line (GLibC and OpenSSL) - Added by Andreas Smas over 10 years ago

Yeah, thanks for digging into this. I've pushed a fix.

(1-7/7)