Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 497532 - dev-db/mysql-5.5.32 does not respect CFLAGS
Summary: dev-db/mysql-5.5.32 does not respect CFLAGS
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal QA (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-08 15:42 UTC by Julian Ospald
Modified: 2014-04-02 17:38 UTC (History)
0 users

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


Attachments
mysql-build.log.xz (mysql-build.log.xz,74.90 KB, application/x-xz)
2014-01-08 15:45 UTC, Julian Ospald
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Ospald 2014-01-08 15:42:56 UTC
patch incoming
Comment 1 Julian Ospald 2014-01-08 15:45:27 UTC
Created attachment 367396 [details]
mysql-build.log.xz
Comment 2 Julian Ospald 2014-01-08 15:45:50 UTC
Portage 2.2.7 (default/linux/amd64/13.0, gcc-4.8.2, glibc-2.17, 3.8.13-gnu-ck1+ x86_64)
=================================================================
System uname: Linux-3.8.13-gnu-ck1+-x86_64-Intel-R-_Core-TM-_i7-4770_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    16459772 total,   1891236 free
KiB Swap:    4194300 total,   4194300 free
Timestamp of tree: Sun, 04 Aug 2013 12:00:01 +0000
ld GNU ld (GNU Binutils) 2.23.2
distcc[17333] (dcc_trace_version) distcc 3.1 x86_64-pc-linux-gnu; built Oct 26 2013 13:41:01 [disabled]
ccache version 3.1.9 [disabled]
app-shells/bash:          4.2_p45
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.6.8-r3, 2.7.5-r3, 3.2.5-r3, 3.3.3
dev-util/ccache:          3.1.9
dev-util/cmake:           2.8.11.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.7.3-r1, 4.8.2
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo arx-libertatis hasufell sunrise toolchain mrueg gentoo-haskell crossdev hasufell-overlay hasufell-science
Installed sets: @bleh, @development, @games, @optional, @steam, @test, @xfce
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core-avx2 -O2 -pipe -Wall -g"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/cron.hourly /usr/share/applications /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core-avx2 -O2 -pipe -Wall -g"
DISTDIR="/home/distfiles"
EMERGE_DEFAULT_OPTS="--ignore-built-slot-operator-deps=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch protect-owned sandbox sfperms sign split-log splitdebug strict test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userpriv usersandbox usersync webrsync-gpg"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://mirror.netcologne.de/gentoo/ ftp://gentoo.imj.fr/pub/gentoo/ ftp://de-mirror.org/gentoo/"
INSTALL_MASK="/usr/lib/systemd/*"
LANG="de_DE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
MAKEOPTS="-j8"
PKGDIR="/home/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-z -9"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/arx-libertatis /var/lib/layman/hasufell /var/lib/layman/sunrise /var/lib/layman/toolchain /var/lib/layman/mrueg /var/lib/layman/gentoo-haskell /usr/local/crossdev /usr/local/portage /usr/local/portage-science"
USE="X a52 aac acl acpi alsa amd64 apng bash-completion berkdb bzip2 cairo cdr cli consolekit cracklib crypt cscope css cxx dbus dri dv dvd dvdr exif fat ffmpeg flac fontconfig fortran gdbm gif gpm gstreamer hddtemp iconv icq icu ipv6 jabber jpeg jpeg2k lame libnotify lm_sensors matroska mmx modules mp3 mp4 mpeg mudflap multilib musepack ncurses nls nptl nsplugin ntfs ogg opengl openmp oscar pam pcre pdf png policykit python qt3support raw readline sdl session sound sse sse2 ssl ssse3 svg tcpd threads tiff timidity truetype udev unicode usb v4l vcd vdpau vim-syntax vnc vorbis wavpack win32codecs wmf x264 xv xvid xvmc zlib" ABI_X86="64 32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev keyboard mouse joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="pdfimport presenter-console presenter-minimizer" LINGUAS="en de" NETBEANS_MODULES="*" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="pypy2_0 python2_6 python2_7 python3_2 python3_3" QEMU_SOFTMMU_TARGETS="arm i386 ppc ppc64 x86_64" QEMU_USER_TARGETS="arm i386 ppc ppc64 x86_64" RUBY_TARGETS="ruby18 ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.6 2.7 3.2 3.3"
Unset:  CPPFLAGS, CTARGET, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, SYNC
Comment 3 Julian Ospald 2014-01-08 15:48:15 UTC
--- eclass/mysql-cmake.eclass
+++ eclass/mysql-cmake.eclass
@@ -239,6 +239,7 @@
 	CMAKE_BUILD_TYPE="RelWithDebInfo"
 
 	mycmakeargs=(
+		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
 		-DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
 		-DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
 		-DSYSCONFDIR=${EPREFIX}/etc/mysql
Comment 4 Julian Ospald 2014-01-08 15:53:11 UTC
oh... that didn't catch CXXFLAGS...

--- eclass/mysql-cmake.eclass
+++ eclass/mysql-cmake.eclass
@@ -239,6 +239,8 @@
 	CMAKE_BUILD_TYPE="RelWithDebInfo"
 
 	mycmakeargs=(
+		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
+		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
 		-DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
 		-DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
 		-DSYSCONFDIR=${EPREFIX}/etc/mysql
Comment 5 Julian Ospald 2014-02-10 21:46:53 UTC
ping
Comment 6 Julian Ospald 2014-02-18 17:45:37 UTC
Patch was sent for review to dev ML. I will fix this in 2 weeks.
Comment 7 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2014-02-25 01:58:03 UTC
(In reply to Julian Ospald (hasufell) from comment #4)
> oh... that didn't catch CXXFLAGS...
> 
> --- eclass/mysql-cmake.eclass
> +++ eclass/mysql-cmake.eclass
> @@ -239,6 +239,8 @@
>  	CMAKE_BUILD_TYPE="RelWithDebInfo"
>  
>  	mycmakeargs=(
> +		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
> +		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
>  		-DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
>  		-DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
>  		-DSYSCONFDIR=${EPREFIX}/etc/mysql

What are you trying to do? Making cmake respect the debug use flag?
Comment 8 Julian Ospald 2014-02-25 02:25:07 UTC
(In reply to Jorge Manuel B. S. Vicetto from comment #7)
> (In reply to Julian Ospald (hasufell) from comment #4186)
> > oh... that didn't catch CXXFLAGS...
> > 
> > --- eclass/mysql-cmake.eclass
> > +++ eclass/mysql-cmake.eclass
> > @@ -239,6 +239,8 @@
> >  	CMAKE_BUILD_TYPE="RelWithDebInfo"
> >  
> >  	mycmakeargs=(
> > +		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
> > +		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
> >  		-DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
> >  		-DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
> >  		-DSYSCONFDIR=${EPREFIX}/etc/mysql
> 
> What are you trying to do? Making cmake respect the debug use flag?

No. As the title says this is about CFLAGS that get overwritten, because the build system adds random stuff in CMAKE_C{,XX}_FLAGS_RELWITHDEBINFO.

In order to not mess up the debug logic, I added "$(usex debug "" "-DNDEBUG")", otherwise debug codepaths will be compiled unconditionally.
Comment 9 Julian Ospald 2014-02-25 02:37:11 UTC
The problem is, that is cmake internal and not hardcoded in any cmake file. That's one reason why cmake-utils.eclass uses a non-standard BUILD_TYPE.
Comment 10 Julian Ospald 2014-02-25 02:43:49 UTC
besides that there seems to be another switch that affects debug, so you could argue that this is more correct

	-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG -DDBUG_OFF")"
	-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG -DDBUG_OFF")"


the current debug useflag does actually not change those things which means we probably don't get any debug codepaths (for both -debug and +debug it sets "-DNDEBUG -DDBUG_OFF")

opinion?
Comment 11 Brian Evans (RETIRED) gentoo-dev 2014-02-25 03:13:06 UTC
I think I spot it.

Without the changes, I see "-O2 -g -DNDEBUG" in both debug and non-debug.
With the changes, -debug has "-DNDEBUG" and debug wipes it out completely.

That looks to be the summary of what is happening.

My tests aren't showing any negative effects to the proposed changes.

Not using RelWithDebInfo build type seems to cause random failures as different parts can be loosely coupled.  I.e. tokudb in mariadb.
Comment 12 Julian Ospald 2014-03-19 00:56:01 UTC
+  19 Mar 2014; Julian Ospald <hasufell@gentoo.org> mysql-cmake.eclass:
+  respect CFLAGS wrt #497532
Comment 13 Brian Evans (RETIRED) gentoo-dev 2014-03-26 01:58:48 UTC
I'm thinking this is not the right fix.


We would have to patch parts of the CMakeLists.txt to use the Gentoo build type since it automatically adds the -DNDEBUG similar to below but in a different area.  At least one part of newer mariadb may not be able to use the Gentoo build type as it must -UNDEBUG or fail.

Perhaps the small patch below is a better fix.

@hasufell: does this give your desired result?

--- eclass/mysql-cmake.eclass	2014-03-25 21:52:51.000000000 -0400
+++ eclass/mysql-cmake.eclass	2014-03-25 21:53:13.000000000 -0400
@@ -275,12 +275,10 @@
 
 	debug-print-function ${FUNCNAME} "$@"
 
-	CMAKE_BUILD_TYPE="RelWithDebInfo"
+	CMAKE_BUILD_TYPE="$(usex debug "Debug" "RelWithDebInfo")"
 
 	# debug hack wrt #497532
 	mycmakeargs=(
-		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
-		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
 		-DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
 		-DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
 		-DSYSCONFDIR=${EPREFIX}/etc/mysql
Comment 14 Julian Ospald 2014-03-29 11:15:15 UTC
(In reply to Brian Evans from comment #13)
> I'm thinking this is not the right fix.
> 
> 
> We would have to patch parts of the CMakeLists.txt to use the Gentoo build
> type since it automatically adds the -DNDEBUG similar to below but in a
> different area.  At least one part of newer mariadb may not be able to use
> the Gentoo build type as it must -UNDEBUG or fail.
> 
> Perhaps the small patch below is a better fix.
> 
> @hasufell: does this give your desired result?
> 
> --- eclass/mysql-cmake.eclass	2014-03-25 21:52:51.000000000 -0400
> +++ eclass/mysql-cmake.eclass	2014-03-25 21:53:13.000000000 -0400
> @@ -275,12 +275,10 @@
>  
>  	debug-print-function ${FUNCNAME} "$@"
>  
> -	CMAKE_BUILD_TYPE="RelWithDebInfo"
> +	CMAKE_BUILD_TYPE="$(usex debug "Debug" "RelWithDebInfo")"
>  
>  	# debug hack wrt #497532
>  	mycmakeargs=(
> -		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
> -		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
>  		-DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
>  		-DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
>  		-DSYSCONFDIR=${EPREFIX}/etc/mysql


Changing build type is way more intrusive than my change. I will not commit anything like that. That kind of change is pretty much up to the maintainers.

But I might test it later.
Comment 15 Brian Evans (RETIRED) gentoo-dev 2014-03-29 15:27:37 UTC
(In reply to Julian Ospald (hasufell) from comment #14)
> (In reply to Brian Evans from comment #13)
> > I'm thinking this is not the right fix.
> > 
> > 
> > We would have to patch parts of the CMakeLists.txt to use the Gentoo build
> > type since it automatically adds the -DNDEBUG similar to below but in a
> > different area.  At least one part of newer mariadb may not be able to use
> > the Gentoo build type as it must -UNDEBUG or fail.
> > 
> > Perhaps the small patch below is a better fix.
> > 
> > @hasufell: does this give your desired result?
> > 
> > --- eclass/mysql-cmake.eclass	2014-03-25 21:52:51.000000000 -0400
> > +++ eclass/mysql-cmake.eclass	2014-03-25 21:53:13.000000000 -0400
> > @@ -275,12 +275,10 @@
> >  
> >  	debug-print-function ${FUNCNAME} "$@"
> >  
> > -	CMAKE_BUILD_TYPE="RelWithDebInfo"
> > +	CMAKE_BUILD_TYPE="$(usex debug "Debug" "RelWithDebInfo")"
> >  
> >  	# debug hack wrt #497532
> >  	mycmakeargs=(
> > -		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
> > -		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
> >  		-DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
> >  		-DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
> >  		-DSYSCONFDIR=${EPREFIX}/etc/mysql
> 
> 
> Changing build type is way more intrusive than my change. I will not commit
> anything like that. That kind of change is pretty much up to the maintainers.
> 
> But I might test it later.

First off, i'm going to be a member of mysql herd as soon as my dev bug 502564 goes through.

Second, both jmbsvicetto and I are wondering what is the purpose and effect of setting or clearing NDEBUG definition for this build?  We're not sure of what you are looking at.

As far as I can tell, the -DNDEBUG doesn't affect the code itself except maybe in the regex and yassl portions of the code. (yassl is only with USE=-ssl)

Unless there is some undocumented feature of CMake changinging CFLAGS itself, I'm still not sure of the original purpose.

I know the Debug build type adds more debugging info and doesn't set NDEBUG.  That's why I feel it should be tested with USE debug.
Comment 16 Julian Ospald 2014-03-29 16:02:01 UTC
(In reply to Brian Evans from comment #15)
> (In reply to Julian Ospald (hasufell) from comment #14)
> > (In reply to Brian Evans from comment #13)
> > > I'm thinking this is not the right fix.
> > > 
> > > 
> > > We would have to patch parts of the CMakeLists.txt to use the Gentoo build
> > > type since it automatically adds the -DNDEBUG similar to below but in a
> > > different area.  At least one part of newer mariadb may not be able to use
> > > the Gentoo build type as it must -UNDEBUG or fail.
> > > 
> > > Perhaps the small patch below is a better fix.
> > > 
> > > @hasufell: does this give your desired result?
> > > 
> > > --- eclass/mysql-cmake.eclass	2014-03-25 21:52:51.000000000 -0400
> > > +++ eclass/mysql-cmake.eclass	2014-03-25 21:53:13.000000000 -0400
> > > @@ -275,12 +275,10 @@
> > >  
> > >  	debug-print-function ${FUNCNAME} "$@"
> > >  
> > > -	CMAKE_BUILD_TYPE="RelWithDebInfo"
> > > +	CMAKE_BUILD_TYPE="$(usex debug "Debug" "RelWithDebInfo")"
> > >  
> > >  	# debug hack wrt #497532
> > >  	mycmakeargs=(
> > > -		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
> > > -		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
> > >  		-DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
> > >  		-DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
> > >  		-DSYSCONFDIR=${EPREFIX}/etc/mysql
> > 
> > 
> > Changing build type is way more intrusive than my change. I will not commit
> > anything like that. That kind of change is pretty much up to the maintainers.
> > 
> > But I might test it later.
> 
> First off, i'm going to be a member of mysql herd as soon as my dev bug
> 502564 goes through.
> 
> Second, both jmbsvicetto and I are wondering what is the purpose and effect
> of setting or clearing NDEBUG definition for this build?  We're not sure of
> what you are looking at.
> 
> As far as I can tell, the -DNDEBUG doesn't affect the code itself except
> maybe in the regex and yassl portions of the code. (yassl is only with
> USE=-ssl)
> 
> Unless there is some undocumented feature of CMake changinging CFLAGS
> itself, I'm still not sure of the original purpose.
> 
> I know the Debug build type adds more debugging info and doesn't set NDEBUG.
> That's why I feel it should be tested with USE debug.

No, it will not fix the issue.

I feel like I am repeating myself again, but maybe I did not make it clear.

CMAKE_CXX_FLAGS_RELWITHDEBINFO is set to "-O2 -g -DNDEBUG" and will override/change user defined CXXFLAGS, because these come last in the compiler line which is pretty clear from the attached build log.

Even if the build system does not explicitly set CMAKE_CXX_FLAGS_RELWITHDEBINFO, cmake itself will do so with random settings. It is one reason why cmake-utils.eclass sets a custom build type.

Whether the debug build is actually usable... is another issue. Debug build type in cmake can lead to very weird results, depending on what it was meant for. The best approach is to check what preprocessor flags are actually passed if you would use Debug build type and then append them manually, as in simulate only the necessary bits. That's what I tried to do, but #c10 explains that the applied patch might not be enough. I was fiddling a bit with it, but messing with "DBUG_OFF" caused heavy build failure, so this needs more investigation. 

Worst case we are building debug paths for non-debug builds... so what.

Now, what is not clear about this?