Bug 256426 - databases/mysql57-client: fails to build with LibreSSL
Summary: databases/mysql57-client: fails to build with LibreSSL
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jochen Neumeister
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-05 09:07 UTC by Felix Palmen
Modified: 2021-08-26 21:21 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (joneum)


Attachments
Force NDEBUG defined in every compilation unit (875 bytes, patch)
2021-06-05 09:07 UTC, Felix Palmen
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Palmen 2021-06-05 09:07:35 UTC
Created attachment 225568 [details]
Force NDEBUG defined in every compilation unit

Building mysql 5.7.34 fails to build with LibreSSL with the following linker errors:

---
[ 67%] Linking CXX executable mysqlshow
cd /wrkdirs/usr/ports/databases/mysql57-client/work/.build/client && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/mysqlshow.dir/link.txt --verbose=1
/usr/local/bin/clang++90 -fPIC -fno-omit-frame-pointer -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter -Wno-null-conversion -Wno-unused-private-field -ffunction-sections -fdata-sections -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DNDEBUG -isystem /usr/local/include  -Wl,-rpath,/usr/local/lib -fstack-protector-strong CMakeFiles/mysqlshow.dir/mysqlshow.c.o -o mysqlshow  -Wl,-rpath,/usr/local/lib: -pthread ../archive_output_directory/libmysqlclient.a -pthread -lz -lm -lrt -lexecinfo /usr/local/lib/libssl.so /usr/local/lib/libcrypto.so -lz -lm -lrt -lexecinfo /usr/local/lib/libssl.so /usr/local/lib/libcrypto.so 
ld: error: undefined symbol: SSL_COMP_get_id
>>> referenced by viossl.c
>>>               viossl.c.o:(ssl_do) in archive ../archive_output_directory/libmysqlclient.a

ld: error: undefined symbol: SSL_COMP_get0_name
>>> referenced by viossl.c
>>>               viossl.c.o:(ssl_do) in archive ../archive_output_directory/libmysqlclient.a
--- client/CMakeFiles/mysqlimport.dir/all ---
ld: error: undefined symbol: SSL_COMP_get_id
>>> referenced by viossl.c
>>>               viossl.c.o:(ssl_do) in archive ../archive_output_directory/libmysqlclient.a

ld: error: undefined symbol: SSL_COMP_get0_name
>>> referenced by viossl.c
>>>               viossl.c.o:(ssl_do) in archive ../archive_output_directory/libmysqlclient.a
--- client/CMakeFiles/mysqlshow.dir/all ---
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
*** [client/mysqlshow] Error code 1
---

Attached patch (making sure NDEBUG is defined in every compilation unit) solves the build problem for me.

As a side note, it still builds when the viosslfactories.c patches are removed, but I'm unsure about the consequences.
Comment 1 dimante 2021-06-08 11:21:38 UTC
This effected me as well.  Same situation with LibreSSL in use.  The patch did allow the compilation and installation after.

-D
Comment 2 Franco Fichtner 2021-08-03 19:08:24 UTC
FWIW, setting CFLAGS in the server is all that is required to fix this, i.e. https://github.com/opnsense/ports/commit/ce94f8767e


Cheers,
Franco
Comment 3 Jochen Neumeister freebsd_committer 2021-08-26 21:21:56 UTC
Fixed in commit d0fb3afd503e0670b5be7abeefca1fc07b5a45f4