/etc/make.conf included twice by FreeBSD make

Rozhuk Ivan rozhuk.im at gmail.com
Sat Mar 16 01:39:05 UTC 2019


Hello!

I spent some time while debugging math/mprime build, then build:
...
cc -O2 -pipe -O2 -DSTRIP_FBSDID -pipe -D_FORTIFY_SOURCE=2 -mretpoline  -fstack-protector-all -fno-strict-aliasing  -O2 -DSTRIP_FBSDID -pipe -D_FORTIFY_SOURCE=2 -mretpoline -I.. -I../sqlite-amalgamation-3180000 -DX86_64 -c gwnum.c
...

where:
-O2 -pipe - from /usr/share/mk/sys.mk
-O2 -DSTRIP_FBSDID -pipe -D_FORTIFY_SOURCE=2 -mretpoline - mine /etc/make.conf
-fstack-protector-all -fno-strict-aliasing - from /usr/ports/Mk/bsd.port.mk, /usr/ports/Mk/bsd.ssp.mk
-I.. -I../sqlite-amalgamation-3180000 -DX86_64 -c gwnum.c - port makefile

this options added twice:
-O2 -DSTRIP_FBSDID -pipe -D_FORTIFY_SOURCE=2 -mretpoline

first time then you call make to on Makefile in ports tree,
second then ports trying to build port.
If use gmake to build port then this not happen.

This can be problem, because ports build system does not control
CFLAGS and other staff that in /etc/make.conf.
For example if you try build mprime using gcc - it fail, because
gcc does not support -mretpoline.
/usr/ports/Mk/bsd.gcc.mk - handle this and remove first -mretpoline,
but second -mretpoline added after run MAKE_CMD.

To prevent second include /etc/make.conf this must be done:
__MAKE_CONF=/dev/null
It can be added to /etc/make.conf, /usr/ports/Mk/bsd.port.mk or
port Makefile.

Some ports already done this.
I add to /etc/make.conf and buld dozen ports without isses.


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236565



More information about the freebsd-ports mailing list