Message ID | 20190814121527.17876-2-philmd@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | configure: Fix libssh on Ubuntu 18.04 | expand |
On Wednesday, 14 August 2019 14:15:24 CEST Philippe Mathieu-Daudé wrote: > The libssh pkg-config is not complete, the libraries required to > link with libssh are not returned. For example on Ubuntu 18.04: > > $ dpkg -l|fgrep libssh > ii libssh-4:arm64 0.8.0~20170825.94fa1e38-1ubuntu0.2 arm64 tiny C SSH library (OpenSSL flavor) > ii libssh-dev 0.8.0~20170825.94fa1e38-1ubuntu0.2 arm64 tiny C SSH library. Development files (OpenSSL flavor) > > $ pkg-config libssh --libs > -lssh > > Since the ./configure script tries to link an object to figure if > libssh is available, it fails: > > $ cat config.log > [...] > cc -pthread -I/usr/include/glib-2.0 [...] -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -static -g -lssh > /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libssh.a(dh.c.o): In function `ssh_crypto_init': > (.text+0x1a9): undefined reference to `BN_new' > (.text+0x1c2): undefined reference to `BN_set_word' > (.text+0x1c7): undefined reference to `BN_new' > (.text+0x1e7): undefined reference to `BN_bin2bn' > (.text+0x1ec): undefined reference to `BN_new' > (.text+0x20c): undefined reference to `BN_bin2bn' > (.text+0x218): undefined reference to `OPENSSL_init_crypto' > [...] > collect2: error: ld returned 1 exit status Sigh :/ > --- > Should we check for libcrypto? > > $ pkg-config --libs libssh openssl > -lssh -lssl -lcrypto Definitely not! The crypto library is an internal implementation of libssh, so please do not assume libssh is built against openssl.
diff --git a/configure b/configure index 714e7fb6a1..1d5c07de1f 100755 --- a/configure +++ b/configure @@ -3951,7 +3951,7 @@ if test "$libssh" = "yes"; then #include <libssh/libssh.h> int main(void) { return ssh_get_server_publickey(NULL, NULL); } EOF - if compile_prog "$libssh_cflags" "$libssh_libs"; then + if compile_object "$libssh_cflags"; then libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags" fi fi
The libssh pkg-config is not complete, the libraries required to link with libssh are not returned. For example on Ubuntu 18.04: $ dpkg -l|fgrep libssh ii libssh-4:arm64 0.8.0~20170825.94fa1e38-1ubuntu0.2 arm64 tiny C SSH library (OpenSSL flavor) ii libssh-dev 0.8.0~20170825.94fa1e38-1ubuntu0.2 arm64 tiny C SSH library. Development files (OpenSSL flavor) $ pkg-config libssh --libs -lssh Since the ./configure script tries to link an object to figure if libssh is available, it fails: $ cat config.log [...] cc -pthread -I/usr/include/glib-2.0 [...] -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -static -g -lssh /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libssh.a(dh.c.o): In function `ssh_crypto_init': (.text+0x1a9): undefined reference to `BN_new' (.text+0x1c2): undefined reference to `BN_set_word' (.text+0x1c7): undefined reference to `BN_new' (.text+0x1e7): undefined reference to `BN_bin2bn' (.text+0x1ec): undefined reference to `BN_new' (.text+0x20c): undefined reference to `BN_bin2bn' (.text+0x218): undefined reference to `OPENSSL_init_crypto' [...] collect2: error: ld returned 1 exit status To bypass this check, simply compile an object using libssh headers. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- Should we check for libcrypto? $ pkg-config --libs libssh openssl -lssh -lssl -lcrypto --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)