# Problems compiling gcc--4.8.3 on FreeBSD-10.1 i386



## hanzer (Nov 25, 2014)

On this machine:
`hanzer@insomnia [~] % dmesg | head -15`

```
Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.1-RELEASE #0: Sun Nov 16 18:35:04 EST 2014
    root@insomnia.bohemia.net:/usr/obj/usr/src/sys/INSOMNIA i386
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
CPU: AMD Sempron(tm) Processor 3600+ (2009.16-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x50ff2  Family = 0xf  Model = 0x5f  Stepping = 2
  Features=0x78bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2>
  Features2=0x2001<SSE3,CX16>
  AMD Features=0xea500800<SYSCALL,NX,MMX+,FFXSR,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x19<LAHF,ExtAPIC,CR8>
real memory  = 1073741824 (1024 MB)
avail memory = 910979072 (868 MB)
```

Compiling lang/gcc (it's a dependency for several other ports), fails with:


```
/usr/ports/lang/gcc/work/build/./gcc/xgcc -shared-libgcc -B/usr/ports/lang/gcc/work/build/./gcc -nostdinc++ -L/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/src -L/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/src/.libs -B/usr/local/i386-portbld-freebsd10.1/bin/ -B/usr/local/i386-portbld-freebsd10.1/lib/ -isystem /usr/local/i386-portbld-freebsd10.1/include -isystem /usr/local/i386-portbld-freebsd10.1/sys-include    -x c++-header -nostdinc++ -g -O2 -pipe -march=k8 -O2 -pipe -march=k8 -DLIBICONV_PLUG -fno-strict-aliasing  -DLIBICONV_PLUG -I/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include/i386-portbld-freebsd10.1 -I/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include -I/usr/ports/lang/gcc/work/gcc-4.8.3/libstdc++-v3/libsupc++ -O2 -g /usr/ports/lang/gcc/work/gcc-4.8.3/libstdc++-v3/include/precompiled/stdc++.h -o i386-portbld-freebsd10.1/bits/stdc++.h.gch/O2g.gch
In file included from /usr/ports/lang/gcc/work/gcc-4.8.3/libstdc++-v3/include/precompiled/stdc++.h:94:0:
/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include/valarray:1233:1: internal compiler error: Segmentation fault
 } // namespace
 ^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
gmake[6]: *** [i386-portbld-freebsd10.1/bits/stdc++.h.gch/O2g.gch] Error 1
gmake[6]: Leaving directory `/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3/include'
gmake[5]: *** [all-recursive] Error 1
gmake[5]: Leaving directory `/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3'
gmake[4]: *** [all] Error 2
gmake[4]: Leaving directory `/usr/ports/lang/gcc/work/build/i386-portbld-freebsd10.1/libstdc++-v3'
gmake[3]: *** [all-target-libstdc++-v3] Error 2
gmake[3]: Leaving directory `/usr/ports/lang/gcc/work/build'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/usr/ports/lang/gcc/work/build'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/lang/gcc
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/gcc
```

This machine has the 2014Q4 version of the ports tree.

After a few Google searches, I haven't noticed that this is a common/known problem so I guess there might be something peculiar about my system or the way I am doing things. Any ideas?


----------



## wblock@ (Nov 25, 2014)

Is this on a real machine or in a VM?


----------



## talsamon (Nov 25, 2014)

Set the option `Bootstrap` to on, if it's not.


----------



## hanzer (Nov 25, 2014)

wblock@ said:


> Is this on a real machine or in a VM?



It's a real machine. I fetched the latest 10/stable source and did a rebuild{world,kernel}:

```
FreeBSD 10.1-STABLE #0 r275002: Tue Nov 25 09:52:43 EST 2014
    hanzer@insomnia.bohemia.net:/usr/obj/usr/src/sys/INSOMNIA i386
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
```
The gcc build behavior hasn't changed. I've also noticed something odd about lang/go:

```
===>   Registering installation for go-1.3.2,1
pkg-static: (go-1.3.2,1) /usr/ports/lang/go/work/stage//usr/local/go/src/pkg/debug/elf/testdata/gcc-386-freebsd-exec - required shared library libc.so.6 not found
```
I don't know if it is related (other than being part of a suite of strange behavior from this box).


----------



## hanzer (Nov 25, 2014)

talsamon said:


> Set the option `Bootstrap` to on, if it's not.



That seems to have worked. If there is nothing peculiar about my system then I guess ports that require lang/gcc as a dependency should probably enable the 'bootstrap' option. Is this a known issue?


----------



## talsamon (Nov 26, 2014)

That's no issue.  Do `make rmconfig` (it restores the defaults) or take a look to  freshports http://www.freshports.org/lang/gcc48/



> *Configuration Options*
> ===> The following configuration options are available for gcc48-4.8.4.s20141120:
> BOOTSTRAP=on: Build using a full bootstrap
> JAVA=on: Java platform support
> ===> Use 'make config' to modify these settings


----------



## hanzer (Nov 26, 2014)

talsamon said:


> That's no issue.  Do `make rmconfig` (it restores the defaults) or take a look to  freshports http://www.freshports.org/lang/gcc48/



The default configuration options for lang/gcc on the 10.1_RELEASE ports collection has BOOTSTRAP set to _off_. So in a fresh installation, if one were to try to build a port that has lang/gcc as a dependency (say, editors/emacs-nox11) with `make -DBATCH install clean`, it will fail.

Granted, this is a minor issue once the solution is known - `make config` and set BOOTSTRAP=_on _for lang/gcc - but it did cost me a couple of days.


----------

