Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 442662 - dev-db/mysql-connector-c++ - Output from mysql_config is parsed in in ugly way.
Summary: dev-db/mysql-connector-c++ - Output from mysql_config is parsed in in ugly way.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
: 474866 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-11-11 00:41 UTC by Xake
Modified: 2014-10-02 08:13 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
The patch updated not to break the build with recent cmake versions. (mysql-connector-c++-1.1.3-fix-cmake.patch,4.83 KB, patch)
2014-10-02 08:13 UTC, Honza Macháček
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 Gentoo Infrastructure 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 Gentoo Infrastructure 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.