Solved [Solved] USE_GCC flag may not be honoured - recursive make?

The port I'm putting together requires GCC later than version 4.3(*) to compile. In FreeBSD 9.2, GCC version 4.2 is in the base system. From reading the porter's handbook and /usr/ports/bsd.port.mk I believe what I need is to set the USE_GCC variable in my makefile. From /usr/ports/bsd.port.mk:
# USE_GCC - If set, this port requires this version of gcc, either in
# the system or installed from a port.
To make sure that the flag was being honoured, I set the value to 4.8, which should use /usr/local/bin/gcc48. However, when I look at the output of make stage, I see it is calling gcc, for example:
Code:
gcc  -c -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g  -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I .   GnuGenBootSector.c -o GnuGenBootSector.o
Is this an indication that the FreeBSD 9.2 native version of gcc is being called rather than /usr/local/bin/gcc48 as I wanted? How can I be sure? When running the build from the shell with gmake CC=/usr/local/bin/gcc48, I can see that the correct executable is used. As per the post title, the software uses recursive make. Could this be the issue and if so how can I fix it?

Ad (*) Since specifying what I actually need (GCC 4.3 or later) generates the error "Unknown version of GCC specified (USE_GCC=4.3+)", I instead chose the earliest version in ports that is greater than 4.3; version 4.6:
Code:
USE_GCC= 4.6+
 
Re: USE_GCC flag may not be honoured - recursive make issue?

Most likely one or more of the makefiles in the source that you are porting (not your port Makefile) is hardcoded to run gcc to compile the source rather than using the $(CC) variable, which allows the command that will be used to do the compiling to be defined outside of that makefile. The USE_GCC hooks into that by setting $(CC) to /usr/bin/cc or /usr/local/bin/gcc47 or ... based on whatever your port's Makefile defines for USE_GCC.
 
Re: USE_GCC flag may not be honoured - recursive make issue?

Thanks again, @ljboiler for your excellent steer. I've tracked down the hard-coded references to the compiler tools and am now busy patching. I should have more faith that my port Makefile is correct and that it is the code I'm trying to port that has the issues :)
 
Last edited by a moderator:
Back
Top