opensslgnu-makegdallibsshlibcrypto

Builing gdal from source gives linking error with openssl


I'm trying to build gdal==3.4.1 from source on Redhat UBI8.6 with conda in a python 3.8 environment and proj 8.2.1 using the following:

./configure --prefix=$CONDA_PREFIX --with-netcdf=$CONDA_PREFIX --with-proj=$CONDA_PREFIX --with-curl=no
make -j 24   > /dev/null
make install > /dev/null

But no matter if I change the gdal version to the latest or an older one, I keep getting a linker error between libk5crypto and libssh with openssl.

[01:54:25][root@name]# whereis openssl openssl: /usr/bin/openssl /usr/include/openssl /root/anaconda3/envs/myenv/bin/openssl /usr/share/man/man1/openssl.1ssl.gz

$ rpm -q openssl openssl-1.1.1k-7.el8_6.x86_64 $ rpm -q openssh openssh-8.0p1-13.el8.x86_64

Error output:

/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_ctrl@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_free@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_new_id@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_derive@OPENSSL_1_1_1b'
collect2: error: ld returned 1 exit status
make[1]: *** [GNUmakefile:89: gdalinfo] Error 1
make[1]: *** Waiting for unfinished jobs....
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_ctrl@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_free@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_new_id@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_derive@OPENSSL_1_1_1b'
collect2: error: ld returned 1 exit status
make[1]: *** [GNUmakefile:110: nearblack] Error 1
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_ctrl@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_free@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_new_id@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_derive@OPENSSL_1_1_1b'
collect2: error: ld returned 1 exit status
make[1]: *** [GNUmakefile:92: gdalmdiminfo] Error 1
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_ctrl@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_free@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_new_id@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_derive@OPENSSL_1_1_1b'
collect2: error: ld returned 1 exit status
make[1]: *** [GNUmakefile:113: gdalmanage] Error 1
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_ctrl@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_free@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_new_id@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_derive@OPENSSL_1_1_1b'
collect2: error: ld returned 1 exit status
make[1]: *** [GNUmakefile:122: gdalbuildvrt] Error 1
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_ctrl@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_free@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_new_id@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_derive@OPENSSL_1_1_1b'
collect2: error: ld returned 1 exit status
make[1]: *** [GNUmakefile:104: gdalwarp] Error 1
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_ctrl@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_free@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_new_id@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_derive@OPENSSL_1_1_1b'
collect2: error: ld returned 1 exit status
make[1]: *** [GNUmakefile:191: gdal_viewshed] Error 1
make: *** [GNUmakefile:123: apps-target] Error 2
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_ctrl@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_free@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_CTX_new_id@OPENSSL_1_1_1b'
/usr/lib64/libssh.so.4: undefined reference to `EVP_KDF_derive@OPENSSL_1_1_1b'
collect2: error: ld returned 1 exit status
make[1]: *** [GNUmakefile:89: gdalinfo] Error 1
make: *** [GNUmakefile:123: apps-target] Error 2

I have no clue anymore as to what is causing this problem and I cannot find any solution on the web. Reaching out to see if anyone has any solution, tips, clue as to what is going on.


Solution

  • This is not a GDAL problem, your /usr/lib64/libssh.so.4 has missing references. Either it is compiled against a missing OpenSSL library, either this OpenSSL library is not in the GDAL linking path. You could be missing security updates or you can have multiple OpenSSL libraries installed.