Mk/Uses/cmake.mk line 82 adds a CMake argument > -DTHREADS_HAVE_PTHREAD_ARG:BOOL=YES This causes cmake to add -pthread to the depends list in stead of -lpthread. If I remove the offending line in cmake.mk I get a proper -lpthread in the CMakeCache.txt This was discovered after the build of MariaDB 10.1 review D3953 that uses the dependencies to provide a mysql_config command that can be used by ports depending on the libmysqlclient library to set proper build flags (e.g. mail/dovecot2) CMakeCache.out original > //Dependencies for the target > mysqlclient_LIB_DEPENDS:STATIC=general;-pthread;general;-pthread;general;/usr/lib/libz.so;general;m CMakeCache.out after removing the line > mysqlclient_LIB_DEPENDS:STATIC=general;-lpthread;general;-lpthread;general;/usr/lib/libz.so;general;m mysql_config output > -L/usr/local/lib/mysql -lmysqlclient -l-pthread -lz -lm -lexecinfo -lssl -lcrypto desired output > -L/usr/local/lib/mysql -lmysqlclient -lpthread -lz -lm -lexecinfo -lssl -lcrypto
Hi, If I recall correctly, we're consciously setting this variable because we do want -pthread instead of -lpthread: the former implies the latter and also passes a few other options to the compiler that may be necessary to get proper pthreads support (on other platforms it sets _REENTRANT, for example, though I'm not sure if that's needed on FreeBSD). MariaDB should probably be just able to accept arguments that don't start with "-l".
(In reply to Raphael Kubo da Costa from comment #1) I had expected that this was there for a good reason. MariaDB does not have an issue at compile time. It generates a script mysql_config that other software packages can use to determine build-flags. I'll make sure to patch the script file post-stage to fix this.
(In reply to Bernard Spil from comment #2) > I'll make sure to patch the script file post-stage to fix this. That works too, but what I meant was: the upstream code that generates the values for mysql_config.sh (https://github.com/MariaDB/server/blob/10.1/cmake/for_clients.cmake if I understood it correctly) should probably be fixed so that it does not barf at arguments like -pthread.
MFH is not necessary due to resolution