Comments - Generic Build Instructions

2 months, 1 week ago Tommy Pham

Hi,

I'm trying to figure out if there is an OpenSSL linking issue for client on FreeBSD. In the libmariadb/libmariadb within the extracted source folder, I see this when 'make':

mariadb-10.4.12/libmariadb/libmariadb # make clean && make
[  3%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/__/plugins/auth/my_auth.c.o
[  3%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/__/plugins/auth/old_password.c.o
[  6%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/__/plugins/pvio/pvio_socket.c.o
< ... snip ... >
[ 23%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/mariadb_lib.c.o
< ... snip ... >
[ 56%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/ma_client_plugin.c.o
[ 60%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/ma_io.c.o
[ 60%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/secure/openssl.c.o
< ... snip ... >
[ 93%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/mariadb_dyncol.c.o
[ 96%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/mariadb_async.c.o
[ 96%] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/ma_context.c.o
[ 96%] Built target mariadb_obj
[ 96%] Linking C shared library libmariadb.so
[ 96%] Built target libmariadb
[100%] Linking C static library libmariadbclient.a
[100%] Built target mariadbclient

I can verify that the OpenSSL is linked properly to the shared library 'libmariadb'.

mariadb-10.4.12/libmariadb/libmariadb # readelf -a libmariadb.so | grep OPENSSL_init
00000006afe8 005600000007 R_X86_64_JUMP_SLOT  0000000000000000 OPENSSL_init_ssl + 0
    86: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND OPENSSL_init_ssl@OPENSSL_1_1_0 (6)
   752: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND OPENSSL_init_ssl

databases/mariadb104-client/work/mariadb-10.4.12/libmariadb/libmariadb # ldd -v libmariadb.so
libmariadb.so:
        libz.so.6 => /lib/libz.so.6 (0x8006c6000)
        libm.so.5 => /lib/libm.so.5 (0x8006e0000)
        libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x800e00000)
        libssl.so.11 => /usr/local/lib/libssl.so.11 (0x800712000)
        libcrypto.so.11 => /usr/local/lib/libcrypto.so.11 (0x800f03000)
        libthr.so.3 => /lib/libthr.so.3 (0x8007a8000)
        libc.so.7 => /lib/libc.so.7 (0x80024a000)

Should the static library 'libmariadbclient' be linked too?

mariadb-10.4.12/libmariadb/libmariadb # readelf -a libmariadbclient.a  | grep OPENSSL_init
00000000003e 001f00000004 R_X86_64_PLT32      0000000000000000 OPENSSL_init_ssl + fffffffffffffffc
    31: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND OPENSSL_init_ssl

This issue is causing 'mysql' client to fail when --ssl-verify-server-cert:

ERROR 2026 (HY000): SSL connection error: Validation of SSL server certificate failed

and the MariaDB ODBC connector to fail with:

# isql openldap root test
ld-elf.so.1: /usr/local/lib/libmaodbc.so: Undefined symbol "OPENSSL_init_ssl"
 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.