Use GCC only for specific ARCH

Dewayne Geraghty dewayne.geraghty at
Mon Feb 2 05:00:57 UTC 2015

On 10/12/2014 7:11 PM, Daniel Morante wrote:
> I have a port that builds fine on a 9.3 amd64, but on 9.3 i386 it
> fails on this line:
> inline int64 GetMaxMoney() { return nBestHeight <= HARDFORK_HEIGHT_1 ?
> 50000000000 * COIN : 25000000000 * COIN; }
> With the following error:
> "integer constant is too large for 'long' type"
> If I add "USE_GCC=yes" to the port's Makefile, it builds successfully
> on i386.  I'd like to apply this 'fix' only to the 32-bit platform so
> I did the following:
> .if ${ARCH} == "i386"
> USE_GCC=yes
> .endif
> Is that the 'correct' way to do things?
> The port can be found here:
In addition to USE_GCC=yes  in your make.conf, you'll also need to add
to /etc/libmap.conf     gcc48/      gcc48/      gcc48/       gcc48/    gcc48/
# I don't believe I use these, but to easily avoid further
troubleshooting, they're here    gcc48/      gcc48gcc48/  gcc48/

So with libmap.conf configured, a simple cd /usr/ports/security/nmap &&
make clean deinstall package; pkg add nmap-6.47.txz results in, I've
added the '<<<<<' for reference:

# ldd /usr/local/bin/nmap
/usr/local/bin/nmap: => /usr/local/lib/ (0x80095d000) => /usr/local/lib/ (0x800bd0000) => /usr/local/lib/ (0x800e15000) => /usr/local/lib/ (0x801081000) => /usr/local/lib/gcc48/ (0x80148c000) => /lib/ (0x801796000) => /usr/local/lib/gcc48/
(0x8019bd000) <<<<<< => /lib/ (0x801bd2000) => /lib/ (0x801f76000)

without libmap.conf you'll have

/usr/local/bin/nmap: => /usr/local/lib/ (0x80095d000) => /usr/local/lib/ (0x800bd0000) => /usr/local/lib/ (0x800e15000) => /usr/local/lib/ (0x801081000) => /usr/local/lib/gcc48/ (0x80148c000) => /lib/ (0x801796000) => /lib/ (0x8019bd000)  <<<<<< => /lib/ (0x801bcb000) => /lib/ (0x801f6f000)

I came across this as I was getting 'bus error' while building
/usr/ports/security/p5-IO-Socket-SSL with march=prescott.  As it turns
out, the problem was repeatable with

echo 'eval { require Net::SSLeay; $Net::SSLeay::trace=1;
Net::SSLeay::randomize(); };' > /tmp/a; perl /tmp/a
bus error

Rebuilding SSLEAY and perl5.20 with gcc enabled me to continue working,
without changing my CFLAGS statement
CFLAGS= -O2 -pipe -g0 -ggdb0 -march=prescott -mtune=prescott 

I initially tried to turn off stack-protector, however even applying to

perl5.20 continued to add --stack-protector to CFLAGS.  Yes, I even
mv; touch
it was simply too elusive... 

I should mention that I added to make.conf the following as I also use
ccache (3.2)
I suspect that I should only need CC and CXX, but I'm not very technical.

Thanks for your hint about USE_GCC=yes in make.conf, along with
It started me down an alternate road :) 

After clearing the ccache and /var/ports, my first attempt of using
gcc48 using -march pentium3 (on i386) and core2 (on amd64), failed to
build 7 ports; interestingly using clang they successfully built all 655
packages.  (??)

Regards, Dewayne.

For the talkers: “The superior man acts before he speaks, and afterwards speaks according to his action.”
For everyone else: “Life is really simple, but we insist on making it complicated.”

More information about the freebsd-ports mailing list