/usr/share/mk/bsd.cpu.mk in FreeBSD 11 unconditionally convert CPUTYPE=corei7 to CPUTYPE=nehalem. It can cause error in ports built with the default version of gcc, including gcc itself, ghc, and other ports with USE_GCC=yes. A simple test: $ echo 'int main(){}' > main.c $ gcc48 -march=corei7 main.c && echo "OK" OK $ gcc48 -march=nehalem main.c && echo "OK" main.c:1:0: error: bad value (nehalem) for -march= switch int main(){} ^
Created attachment 176595 [details] Patch to treat nehalem as corei7 This patch is for lang/gcc.
Gerald, please take a look.
FYI, the upstream replaced "corei7" with "nehalem" in 4.9: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=206178 Later, they did this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59601 https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=206212 Basically, my patch is the smallest hack to accept "-march=nehalem" instead of back-porting everything.
The patch works with ports using native FreeBSD gcc, but linux-* ports using CentOS gcc is still broken. CentOS 7 gcc, which is also gcc 4.8, doesn't know -march=nehalem, and CentOS 6 gcc know neither -march=nehalem nor -march=corei7. # make -C audio/linux-skype_oss_wrapper ===> Building for linux-skype_oss_wrapper-0.1.1 --- skype_oss --- --- libpulse.o --- --- skype_oss --- echo "#!/bin/sh" > skype_oss && echo "LD_LIBRARY_PATH=/compat/linux/lib/skype_oss_wrapper:\$LD_LIBRARY_PATH skype" >> skype_oss && chmod +x skype_oss --- libpulse.o --- /compat/linux/usr/bin/gcc -O2 -pipe -march=nehalem -fstack-protector -fno-strict-aliasing -m32 -fPIC -c libpulse.c -o libpulse.o libpulse.c:1: error: bad value (nehalem) for -march= switch libpulse.c:1: error: bad value (nehalem) for -mtune= switch *** [libpulse.o] Error code 1
(In reply to Ting-Wei Lan from comment #4) This is a separate issue, i.e., CFLAGS for FreeBSD/amd64 should never be used for Linux/i386. In other words, audio/linux-skype_oss_wrapper must be fixed.
(In reply to Jung-uk Kim from comment #5) OK, I think your patch is good enough, and I will open another bug for the linux-* issue.
I filed two bugs for Linux ports. Bug 214512 - audio/linux-skype_oss_wrapper Bug 214513 - devel/linux_libusb
Thanks for your analysis, guys, and the suggested patch, Jung-uk! Instead of patching lang/gcc in this direction, I continued my efforts to finally upgrade lang/gcc to GCC 4.9 today which added support for -march=nehalem and others. Which is even nicer! :-) So, users of the canonical version of GCC in the Ports Collection will now be fine (and I don't think we should keep patching compilers three generations behind, so I suggest we leave lang/gcc48 as is).