Re: How to "bake in" configure args

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2021-03-23 at 20:16 -0500, Bob Friesenhahn wrote:
> On Tue, 23 Mar 2021, Dan Mahoney (Gushi) wrote:
> 
> > Is there a "standard" way to do this?  Google kind of fails for this.
> 
> I see that Gavin Smith already answered the question you asked, but 
> GraphicsMagick took a different tact.  The configure options used are 
> interesting but don't provide the answers for what the configure 
> script ended up using for the build.  And so GraphicsMagick is 
> providing additional data like this:
> 
> Configured using the command:
>    ../GraphicsMagick/configure  'PSDelegate=/bin/true' 'CC=gcc-10' 
> 'CXX=g++-10' 'CFLAGS=-march=native -O2 -frename-registers -g -Wall 
> -Winline -W -Wformat-security -Wpointer-arith -Wdisabled-optimization 
> -Wmissing-noreturn -Wno-unknown-pragmas -Wvla' 'CXXFLAGS=-march=native 
> -O2 -g -Wall -Winline -W -Wextra -Wno-unknown-pragmas' 
> 'LDFLAGS=-L/usr/local/lib -Wl,-rpath,/usr/local/lib' 
> '--with-quantum-depth=16' '--disable-shared' '--enable-static' 
> '--enable-openmp-slow' '--enable-silent-rules' '--without-xml'
> 
> Final Build Parameters:
>    CC       = gcc-10
>    CFLAGS   = -fopenmp -march=native -O2 -frename-registers -g -Wall 
> -Winline -W -Wformat-security -Wpointer-arith -Wdisabled-optimization 
> -Wmissing-noreturn -Wno-unknown-pragmas -Wvla -Wall -pthread
>    CPPFLAGS = -I/usr/include/freetype2
>    CXX      = g++-10
>    CXXFLAGS = -march=native -O2 -g -Wall -Winline -W -Wextra 
> -Wno-unknown-pragmas -pthread
>    LDFLAGS  = -L/usr/local/lib -Wl,-rpath,/usr/local/lib
>    LIBS     = -ljbig -lwebp -lwebpmux -llcms2 -ltiff -lfreetype -ljpeg 
> -lpng16 -lwmflite -lX11 -llzma -lz -lzstd -lm -lpthread

For reference, there is a downside to doing this which is that you
can end up with non-reproducible binaries.

Yocto Project cross compiles and uses compiler commands like:

x86_64-poky-linux-gcc \
  --sysroot=/media/build1/poky/build/tmp/work/core2-64-poky-linux/acl/2.2.53-r0/recipe-sysroot \
  -O2 -pipe -g -feliminate-unused-debug-types 
  -fmacro-prefix-map=/media/build1/poky/build/tmp/work/core2-64-poky-linux/acl/2.2.53-r0=/usr/src/debug/acl/2.2.53-r0 
  -fdebug-prefix-map=/media/build1/poky/build/tmp/work/core2-64-poky-linux/acl/2.2.53-r0=/usr/src/debug/acl/2.2.53-r0 
  -fdebug-prefix-map=/media/build1/poky/build/tmp/work/core2-64-poky-linux/acl/2.2.53-r0/recipe-sysroot= 
  -fdebug-prefix-map=/media/build1/poky/build/tmp/work/core2-64-poky-linux/acl/2.2.53-r0/recipe-sysroot-native= 
  -fvisibility=hidden -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now

which ensure that we end up with cross compiled binaries that are 
reproducible regardless of the path they're built in and that debug
objects and debug code can be correctly found. The downside is that
build paths are in CC/CFLAGS and if those are injected into any of
the output without filtering, the result depends on the build path.

The same does apply to hardcoding the configure command to a lesser
extent as there may or may not be build paths present, it depends on
the configure script in question and what inputs it needs.

In the cases where a project has added things like this, we tend to
have to patch it out.

Cheers,

Richard








[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux