Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing -lgnutls in linker options #30

Open
RoelVdP opened this issue Mar 10, 2023 · 0 comments
Open

Missing -lgnutls in linker options #30

RoelVdP opened this issue Mar 10, 2023 · 0 comments

Comments

@RoelVdP
Copy link
Contributor

RoelVdP commented Mar 10, 2023

~/pquery$ cmake . -DMARIADB=ON -DBASEDIR=/test/MD180223-mariadb-11.0.1-linux-x86_64-opt
...
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- * BASEDIR is set, looking for MariaDB in /test/MD180223-mariadb-11.0.1-linux-x86_64-opt
-- * Found MariaDB library: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a
-- * Found MariaDB include directory: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/include/mysql
-- * PQuery revision is: ba1ec63
-- Configuring done
...
# (all works fine). Then:

~/pquery$ make
CMake Deprecation Warning at CMakeLists.txt:1 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Architecture is x86_64
-- * BASEDIR is set, looking for MariaDB in /test/MD180223-mariadb-11.0.1-linux-x86_64-opt
-- * PQuery revision is: ba1ec63
-- Configuring done
-- Generating done
-- Build files have been written to: ~/pquery-source
[ 12%] Building C object src/third_party/inih++/lib/CMakeFiles/inih++.dir/ini.c.o
[ 25%] Building CXX object src/third_party/inih++/lib/CMakeFiles/inih++.dir/INIReader.cpp.o
[ 37%] Linking CXX static library libinih++.a
[ 37%] Built target inih++
[ 50%] Building CXX object src/CMakeFiles/pquery2-md.dir/pquery.cpp.o
[ 62%] Building CXX object src/CMakeFiles/pquery2-md.dir/help.cpp.o
[ 75%] Building CXX object src/CMakeFiles/pquery2-md.dir/node.cpp.o
[ 87%] Building CXX object src/CMakeFiles/pquery2-md.dir/thread.cpp.o
[100%] Linking CXX executable pquery2-md
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `my_verify_callback':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1356: undefined reference to `gnutls_session_get_ptr'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1364: undefined reference to `gnutls_certificate_verify_peers3'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1381: undefined reference to `gnutls_certificate_type_get'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1382: undefined reference to `gnutls_certificate_verification_status_print'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1385: undefined reference to `gnutls_free'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1367: undefined reference to `gnutls_certificate_verify_peers2'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_set_error':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:896: undefined reference to `gnutls_strerror'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:888: undefined reference to `gnutls_alert_get'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:889: undefined reference to `gnutls_alert_get_name'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `get_priority':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:855: undefined reference to `gnutls_cipher_suite_info'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_gnutls_set_ciphers':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1043: undefined reference to `gnutls_priority_set_direct'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1029: undefined reference to `gnutls_priority_set_direct'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `get_priority':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:860: undefined reference to `gnutls_kx_get_name'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:860: undefined reference to `gnutls_mac_get_name'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:860: undefined reference to `gnutls_cipher_get_name'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_start':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:948: undefined reference to `gnutls_global_init'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:953: undefined reference to `gnutls_check_version'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_get_error':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:918: undefined reference to `gnutls_strerror'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_end':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:980: undefined reference to `gnutls_global_deinit'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_init':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1117: undefined reference to `gnutls_certificate_allocate_credentials'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_set_certs':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1054: undefined reference to `gnutls_certificate_set_x509_trust_file'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1063: undefined reference to `gnutls_certificate_set_x509_trust_dir'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1072: undefined reference to `gnutls_certificate_set_x509_crl_file'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1085: undefined reference to `gnutls_certificate_set_verify_function'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1099: undefined reference to `gnutls_certificate_set_x509_key_file2'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_init':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1123: undefined reference to `gnutls_init'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1126: undefined reference to `gnutls_session_set_ptr'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1136: undefined reference to `gnutls_credentials_set'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1143: undefined reference to `gnutls_certificate_free_credentials'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1145: undefined reference to `gnutls_deinit'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_set_certs':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1080: undefined reference to `gnutls_certificate_set_x509_system_trust'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_write_async':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1232: undefined reference to `gnutls_record_send'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_read_async':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1257: undefined reference to `gnutls_record_recv'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_read':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1277: undefined reference to `gnutls_record_recv'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1285: undefined reference to `gnutls_session_get_ptr'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_write':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1296: undefined reference to `gnutls_record_send'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1304: undefined reference to `gnutls_session_get_ptr'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_close':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1320: undefined reference to `gnutls_credentials_get'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1321: undefined reference to `gnutls_certificate_free_keys'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1322: undefined reference to `gnutls_certificate_free_cas'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1323: undefined reference to `gnutls_certificate_free_crls'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1324: undefined reference to `gnutls_certificate_free_ca_names'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1325: undefined reference to `gnutls_certificate_free_credentials'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1326: undefined reference to `gnutls_deinit'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_connect':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1176: undefined reference to `gnutls_session_get_ptr'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1198: undefined reference to `gnutls_transport_set_int2'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1203: undefined reference to `gnutls_error_is_fatal'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1202: undefined reference to `gnutls_handshake'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_get_cipher':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1347: undefined reference to `gnutls_mac_get'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1348: undefined reference to `gnutls_cipher_get'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1349: undefined reference to `gnutls_kx_get'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `openssl_cipher_name':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:809: undefined reference to `gnutls_cipher_suite_info'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_get_finger_print':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1404: undefined reference to `gnutls_session_get_ptr'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1406: undefined reference to `gnutls_certificate_get_peers'
/usr/bin/ld: /test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1415: undefined reference to `gnutls_fingerprint'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_get_protocol_version':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1431: undefined reference to `gnutls_protocol_get_version'
/usr/bin/ld: /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a(gnutls.c.o): in function `ma_tls_set_connection':
/test/11.0_opt/libmariadb/libmariadb/secure/gnutls.c:1436: undefined reference to `gnutls_session_set_ptr'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/pquery2-md.dir/build.make:147: src/pquery2-md] Error 1
make[1]: *** [CMakeFiles/Makefile2:145: src/CMakeFiles/pquery2-md.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

The following will then make the build proceed correctly:

~/pquery-source/src$ cmake -E env LDFLAGS="-I/usr/include/p11-kit-1 -lgnutls" /usr/bin/c++ -O3 -DNDEBUG -rdynamic CMakeFiles/pquery2-md.dir/pquery.cpp.o CMakeFiles/pquery2-md.dir/help.cpp.o CMakeFiles/pquery2-md.dir/node.cpp.o CMakeFiles/pquery2-md.dir/thread.cpp.o -o pquery2-md  /test/MD180223-mariadb-11.0.1-linux-x86_64-opt/lib/libmysqlclient.a -lresolv -lssl -lcrypto -lgnutls  -lpthread -lz -ldl -lrt third_party/inih++/lib/libinih++.a 

This is basically a copy of the contents of CMakeFiles/pquery2-md.dir/link.txt with only -lgnutls added.

The following two line patch fixes the issue:

--- a/cmake/PQSetupCompiler.cmake
+++ b/cmake/PQSetupCompiler.cmake
@@ -61,6 +61,8 @@ SET (OTHER_LIBS ${OTHER_LIBS} pthread)
 INCLUDE(FindZLIB REQUIRED)
 SET (OTHER_LIBS ${OTHER_LIBS} z)
 #
+INCLUDE(FindGnuTLS REQUIRED)
+SET(OTHER_LIBS ${OTHER_LIBS} gnutls)
 #
 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
   SET (OTHER_LIBS ${OTHER_LIBS} dl rt)

Please add this to the repo source asap. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant