qpdf icon indicating copy to clipboard operation
qpdf copied to clipboard

ld: 0711-317 ERROR: Undefined symbol multiple Errors when Building

Open BernardChristophe opened this issue 2 years ago • 6 comments

Hi , I am building QPDF v11.6.3 on IBMi AIX ( I previously already built the v10.3.2 succesfully but it was with make). I ran command :

  1. cmake -S . -B build -D CMAKE_INSTALL_PREFIX=/QOpenSys/QIBM/UserData/qpdf11 --> perfect
  2. cmake --build build and at 48% it failed with these errors. [ 47%] Building CXX object libqpdf/CMakeFiles/libqpdf.dir/QPDFCrypto_openssl.cc.o [ 48%] Linking CXX shared library libqpdf.so
    ld: 0711-317 ERROR: Undefined symbol: .OSSL_LIB_CTX_new
    ld: 0711-317 ERROR: Undefined symbol: .OSSL_PROVIDER_load
    ld: 0711-317 ERROR: Undefined symbol: .OSSL_LIB_CTX_free
    ld: 0711-317 ERROR: Undefined symbol: .EVP_CIPHER_fetch
    ld: 0711-317 ERROR: Undefined symbol: .OSSL_PROVIDER_unload
    etc etc ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
    collect2: error: ld returned 8 exit status
    gmake[2]: *** [libqpdf/CMakeFiles/libqpdf.dir/build.make:1633: libqpdf/libqpdf.so.29] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:442: libqpdf/CMakeFiles/libqpdf.dir/all] Error 2
    gmake: *** [Makefile:166: all] Error 2

I am not specially an expert in C+, so I am not understanding where the problem could be .
Only thing I see is that the Undefined Symbol were not existing in v10.3.2 file : QPDFCrypto_openssl.cc (contrary to the version in v11.6.3)

Many thanks in advance Christophe

BernardChristophe avatar Dec 18 '23 16:12 BernardChristophe

One thing I would check is to make sure you don't have multiple versions of openssl installed. I haven't used AIX since the 1990s, but I think it's ELF, so I think it would behave similarly to Linux. Review this section of the docs: https://qpdf.readthedocs.io/en/stable/installation.html#crypto-build and make sure your crypto options are correct. You could try building with only native crypto as a test. I believe native crypto to be as secure as the external ones BUT it is less performant and it does not get the care and maintenance of gnutls or openssl. On Linux, openssl 3 performs best, gnutls is a close second, and openssl 1 is behind. If you get it to work with native crypto, that's probably the issue.

jberkenbilt avatar Dec 18 '23 23:12 jberkenbilt

That's a lot for your prompt response, I will check that and try.

BernardChristophe avatar Dec 19 '23 07:12 BernardChristophe

  1. Not sure If I did well but when I ran : "OpenSSL version", I got : OpenSSL 3.0.10 1 Aug 2023 (Library: OpenSSL 3.0.10 1 Aug 2023)
  2. Anyway, as I don't really need crypto, I followed your advise to use 'Native Crypto'. So I cleared build folder previously created and run the following command : cmake -S . -B build -D CMAKE_INSTALL_PREFIX=/QOpenSys/QIBM/UserData/qpdf11 -DREQUIRE_CRYPTO_NATIVE=1 It created me a new Build folder with expected files. Then I did again : cmake --build build and it failed the same (but at 50% this time) [ 50%] Building C object libqpdf/CMakeFiles/libqpdf.dir/sha2big.c.o
    [ 50%] Linking CXX shared library libqpdf.so
    ld: 0711-317 ERROR: Undefined symbol: .OSSL_LIB_CTX_new
    ld: 0711-317 ERROR: Undefined symbol: .OSSL_PROVIDER_load
    ld: 0711-317 ERROR: Undefined symbol: .OSSL_LIB_CTX_free
    ld: 0711-317 ERROR: Undefined symbol: .EVP_CIPHER_fetch

    ..... ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
    collect2: error: ld returned 8 exit status
    gmake[2]: *** [libqpdf/CMakeFiles/libqpdf.dir/build.make:1755: libqpdf/libqpdf.so.29] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:442: libqpdf/CMakeFiles/libqpdf.dir/all] Error 2
    gmake: *** [Makefile:166: all] Error 2
    $
  3. Then I had an idea (perhaps not a good one ?) : as last line before errors was about 'shared library' libqpdf.so . I decided to try to build only with static libraries (Indeed I saw libqpdf.a is in the package and as I don't know where to find libqpdf.so....). So I deleted once again build folder and retried with : cmake -S . -B build -D CMAKE_INSTALL_PREFIX=/QOpenSys/QIBM/UserData/qpdf11 -DREQUIRE_CRYPTO_NATIVE=1 -DBUILD_SHARED_LIBS=0 -DBUILD_STATIC_LIBS=1 --> seems ok , I find back all the choices I did in /build/CMakeCache.txt cmake --build build

This time it crashed earlier in the process (34%) but still the same kind of issue : Scanning dependencies of target qpdfjob-ctest
[ 33%] Building C object qpdf/CMakeFiles/qpdfjob-ctest.dir/qpdfjob-ctest.c.o [ 34%] Linking CXX executable qpdfjob-ctest
ld: 0711-317 ERROR: Undefined symbol: .OSSL_LIB_CTX_new
ld: 0711-317 ERROR: Undefined symbol: .OSSL_PROVIDER_load
ld: 0711-317 ERROR: Undefined symbol: .OSSL_LIB_CTX_free
ld: 0711-317 ERROR: Undefined symbol: .EVP_CIPHER_fetch
ld: 0711-317 ERROR: Undefined symbol: .OSSL_PROVIDER_unload
ld: 0711-317 ERROR: Undefined symbol: .EVP_CIPHER_free
ld: 0711-317 ERROR: Undefined symbol: .ERR_get_error
ld: 0711-317 ERROR: Undefined symbol: .ERR_error_string_n
ld: 0711-317 ERROR: Undefined symbol: .ERR_clear_error
...... ld: 0711-317 ERROR: Undefined symbol: .EVP_CipherUpdate
ld: 0711-317 ERROR: Undefined symbol: .EVP_CIPHER_CTX_cipher
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
gmake[2]: *** [qpdf/CMakeFiles/qpdfjob-ctest.dir/build.make:91: qpdf/qpdfjob-ctest] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:467: qpdf/CMakeFiles/qpdfjob-ctest.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2

I am a little bit disappointed... Is there anybody that could explain to me why this is happening ? Thanks a lot in advance Christophe

BernardChristophe avatar Dec 19 '23 15:12 BernardChristophe

Do you know where I can get my hands on an AIX system to test with?

jberkenbilt avatar Dec 19 '23 23:12 jberkenbilt

Hello , It will be difficult I think. I have nevertheless an assumption, when I ran that command : cmake -S . -B build -D CMAKE_INSTALL_PREFIX=/QOpenSys/QIBM/UserData/qpdf11 -DCMAKE_BUILD_TYPE=Release -DUSE_IMPLICIT_CRYPTO=ON In the resume, I see : -- Checking for module 'openssl>=1.1.0'
-- No package 'openssl' found
-- Checking for module 'gnutls'
-- No package 'gnutls' found
I am not sure it is normal ? Do you have an advise about that ? Thanks in advance

BernardChristophe avatar Dec 21 '23 16:12 BernardChristophe

To use only native, you will want -DUSE_IMPLICIT_CRYPTO=OFF -DREQUIRE_CRYPTO_NATIVE=ON. Otherwise, it will try to use whichever of gnutls and openssl it finds and will not use implicit native crypto unless it doesn't find any third-party crypto.

jberkenbilt avatar Dec 21 '23 19:12 jberkenbilt