Bug 206169 - Mk/Uses/cmake.mk: THREADS_HAVE_PTHREAD_ARG issue
Summary: Mk/Uses/cmake.mk: THREADS_HAVE_PTHREAD_ARG issue
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-kde (group)
URL: https://mariadb.atlassian.net/browse/...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-12 20:14 UTC by Bernard Spil
Modified: 2016-01-13 13:04 UTC (History)
3 users (show)

See Also:
rakuco: maintainer-feedback+
koobs: merge-quarterly-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernard Spil freebsd_committer freebsd_triage 2016-01-12 20:14:41 UTC
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
Comment 1 Raphael Kubo da Costa freebsd_committer freebsd_triage 2016-01-13 09:47:35 UTC
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".
Comment 2 Bernard Spil freebsd_committer freebsd_triage 2016-01-13 12:10:46 UTC
(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.
Comment 3 Raphael Kubo da Costa freebsd_committer freebsd_triage 2016-01-13 12:35:00 UTC
(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.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-13 13:04:46 UTC
MFH is not necessary due to resolution