← Back to team overview

maria-discuss team mailing list archive

Re: what is adding the -g compile parm?

 

Hi, Reindl!

On Sep 20, Reindl Harald wrote:
> Am 20.09.2015 um 19:14 schrieb Sergei Golubchik:
> >
> > On Sep 20, Reindl Harald wrote:
> >> "-O3 -g" appears in the cmake output, that likely breaks ld.gold / -flto
> >> and so the question: who the explain the build *not* add that useless
> >> param for production builds like most oterh software don't
> >>
> >> without one could also remove the strip-calls in rpm-spec-files!
> >
> > Sorry, I have more questions that answers...
> >
> > * How do you build?
> 
> + export 'CFLAGS=-m64 -O2 -g0 -march=sandybridge -mtune=sandybridge 
> -fopenmp -mfpmath=sse -pipe -fno-strict-aliasing -fomit-frame-pointer 
> -finline-functions -finline-limit=60 -fexceptions 
> -fstack-protector-strong --param=ssp-buffer-size=6 -D_FORTIFY_SOURCE=2 
> -Wstack-protector -Wformat -Werror=format-security -O3 -funroll-loops 
> -funswitch-loops -minline-all-stringops -fwrapv -fno-stack-protector 
> -fstack-protector --param=ssp-buffer-size=8 -fPIC -fno-exceptions 
> -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE'

But you cannot be building this this line, right?
You invoke cmake, somehow, and make, somehow. How?
And may be you set CXXFLAGS and I don't know what else.

> > Where do you see -O3 -g?
> 
> the " -fPIC -O3 -g -static-libgcc" stuff comes *after* my global CFLAGS 
> and so overrides them

Okay, that's better.
"static-libgcc" is only used in two files in the source tree:
./BUILD/compile-bintar and ./cmake/build_configurations/mysql_release.cmake

So, either you're using BUILD/compile-bintar script (which I find
unlikely) or you're invoking cmake with -DBUILD_CONFIG=mysql_release
(which I find likely - and that's exactly why I was asking "how do you
build" !)

This is not configurable, you cannot switch a part of
mysql_release.cmake off. Either you use -DBUILD_CONFIG=mysql_release or
you don't. If you don't like it - you can simply add all options from it
manually to your CFLAGS and then you won't need -DBUILD_CONFIG

But you said it conflicts with -flto. Where does -flto come from? I
don't see it in your CFLAGS. Nor is it on the compiler's command line
below:

> [  6%] Building C object strings/CMakeFiles/strings.dir/ctype-cp932.c.o
> cd /home/builduser/rpmbuild/BUILD/mariadb-10.0.21/strings && /usr/bin/cc 
>   -DDISABLE_MYSQL_THREAD_H -DHAVE_CONFIG_H -m64 -O2 -g0 
> -march=sandybridge -mtune=sandybridge -fopenmp -mfpmath=sse -pipe 
> -fno-strict-aliasing -fomit-frame-pointer -finline-functions 
> -finline-limit=60 -fexceptions -fstack-protector-strong 
> --param=ssp-buffer-size=6 -D_FORTIFY_SOURCE=2 -Wstack-protector -Wformat 
> -Werror=format-security -O3 -funroll-loops -funswitch-loops 
> -minline-all-stringops -fwrapv -fno-stack-protector -fstack-protector 
> --param=ssp-buffer-size=8 -fPIC -fno-exceptions -D_GNU_SOURCE 
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE  -fPIC -O3 -g -static-libgcc 
> -fno-omit-frame-pointer -fno-strict-aliasing  -Wno-uninitialized 
> -DDBUG_OFF -DMY_PTHREAD_FASTMUTEX=1 
> -I/home/builduser/rpmbuild/BUILD/mariadb-10.0.21/include    -o 
> CMakeFiles/strings.dir/ctype-cp932.c.o   -c 
> /home/builduser/rpmbuild/BUILD/mariadb-10.0.21/strings/ctype-cp932.c

Regards,
Sergei


Follow ups

References