Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 442662

Summary: dev-db/mysql-connector-c++ - Output from mysql_config is parsed in in ugly way.
Product: Gentoo Linux Reporter: Xake <kanelxake>
Component: New packagesAssignee: Gentoo Linux MySQL bugs team <mysql-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: dschridde+gentoobugs, h.mth, Hloupy.Honza, johannes.hirte, ncosmin, ormaaj, proxy-maint
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: The patch updated not to break the build with recent cmake versions.

Description Xake 2012-11-11 00:41:43 UTC
dev-db/mysql-connector-c++ (up to and including version 1.1.1) has a really ugly parse to get what it call "MySQL Link Flags".
In short what it does is in "${S}/FindMySQL.cm":

EXECUTE_PROCESS(COMMAND ${MYSQL_CONFIG_EXECUTABLE} "--cflags"
                                OUTPUT_VARIABLE _mysql_config_output
                                )
STRING(REGEX MATCHALL "-m([^\r\n]+)" MYSQL_LINK_FLAGS "${_mysql_config_output}")


The problem with this?
MYSQL_LINK_FLAGS gets totally empty unless you have a CFLAG that contains "-m".
This leads to two problems by default:
1) I you do not have a CFLAG that starts with "-m" then this gets empty. If you do have such flag, but it is not in the beginning, then only the flags following the "-m" flags gets picked (and still all of them).
2) If you have a flag that *contains*, but *does not start* with "-m", for example -floop-strip-mine", then there is a high possiblity that your build will break due to gcc/g++ not recognizing the flag "-mine".

This is probably something that should go upstream, but I currently do not have the time to register/report there, learn cmake enough to actually figure out a clean fix and track it. So if someone else finds the time, please do that.
I am myself currently using a ugly hack to at least work around 2, which is:

-STRING(REGEX MATCHALL "-m([^\r\n]+)" MYSQL_LINK_FLAGS "${_mysql_config_output}")
+STRING(REGEX MATCHALL " -m([^\r\n]+)" MYSQL_LINK_FLAGS " ${_mysql_config_output}")
Comment 1 Sergey Popov gentoo-dev 2013-09-04 05:40:34 UTC
*** Bug 474866 has been marked as a duplicate of this bug. ***
Comment 2 Brian Evans (RETIRED) gentoo-dev 2014-05-05 02:34:11 UTC
Change added with version bump to 1.1.3.

Please test and confirm.
Comment 3 Brian Evans (RETIRED) gentoo-dev 2014-08-28 12:57:18 UTC
Marking as fixed as there has been no further comment in months
Comment 4 Honza Macháček 2014-10-02 08:13:53 UTC
Created attachment 385924 [details, diff]
The patch updated not to break the build with recent cmake versions.

The original patch now breaks the build, since recent versions of cmake (3+?) treat starting whitesapce in the string that results from " -m([^\r\n]+)" as an error. Changing space into \< helps.