[m-dev.] Bootstrapping Mercury with custom CFLAGS

Keri Harris keri at gentoo.org
Sat Sep 30 19:06:46 AEST 2017


Hi,

Is there a recommended way to specify custom (GCC) compiler flags when 
bootstrapping Mercury? Both CFLAGS and EXTRA_CFLAGS seem like obvious 
choices, but passing in either of them leads to build errors:

$ make CFLAGS="..."

gmake[2]: Entering directory '/home/keri/mercury-srcdist-14.01.1/util'
../scripts/mgnuc --no-mercury-stdlib-dir \
	--grade hlc.gc    -- -march=native -O2 -pipe -frecord-gcc-switches 
   -o mkinit \
		mkinit.c mkinit_common.c
mkinit.c:40:29: fatal error: mercury_conf.h: No such file or directory
compilation terminated.
mkinit_common.c:19:29: fatal error: mercury_conf.h: No such file or 
directory
compilation terminated.

$ make EXTRA_CFLAGS="..."

gmake[2]: Entering directory '/home/keri/mercury-srcdist-14.01.1/robdd'
../scripts/mgnuc --no-mercury-stdlib-dir --grade hlc.gc.pregen       -- 
-DNDEBUG -DNEW -DCLEAR_CACHES -DCOMPUTED_TABLE -DEQUAL_TEST 
-DUSE_ITE_CONSTANT -DRESTRICT_SET    -march=native -O2 -pipe 
-frecord-gcc-switches    -c bryant.c -o bryant.o
bryant.c:107:25: fatal error: mercury_imp.h: No such file or directory
compilation terminated.


My preference would be for the EXTRA_XXX flags (EXTRA_CFLAGS, 
EXTRA_LDFLAGS etc) to always be reserved for the user. Patching 
robdd/Mmakefile to avoid using EXTRA_CFLAGS would then allow the build 
to succeed; see attached patch for one way to do this.


Thanks

Keri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mercury-extra-cflags.patch
Type: text/x-patch
Size: 840 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20170930/61c481d6/attachment.bin>


More information about the developers mailing list