Bug 121038

Summary: Compile fails when using anything other than CFLAGS=-O0 in make.conf (VIA C3 Nehemiah)
Product: Base System Reporter: Jasvinder S. Bahra <exaltedmind>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.txt none

Description Jasvinder S. Bahra 2008-02-24 00:20:01 UTC
I installed FreeBSD 6.3 on a "VIA EPIA EK 8000EG" motherboard (which has a CPU integrated into it).

When I ran the command "cat /var/log/dmesg.today | grep CPU", I got the response...

CPU: VIA C3 Nehemiah+RNG+AES (800.03-MHz 686-class CPU)

I setup some /etc/make.conf parameters and recompiled both world and the GENERIC kernel.  I  installed them both.  When I then attempted to install several different packages from ports, they all kept failing.  After some investigation, it was found that setting CFLAGS=-O0 in the /etc/make.conf file allowed a successful compilation.

Indications suggest an optimisation incompatibility with the VIA CPU.

Fix: Setting CFLAGS=-O0 in the /etc/make.conf allows successful install or ports packages.

Patch attached with submission follows:
How-To-Repeat: Installed FreeBSD 6.3

I cvsup'd (src-all and ports-all tag=., RELENG_6_3).

I set /etc/make.conf parameters...

CPUTYPE=c3
CFLAGS= -O2 -pipe
COPTFLAGS= -O -pipe

I then rebuilt world and the GENERIC kernel, and installed them both.

I then attempted to install various packages from the ports system and I failed again and again.

I usually use portupgrade, so I tried the following...

cd /usr/ports/ports-mgmt/portupgrade
make install clean

As part of the install, it tried to install lang/ruby18, but it failed.
This is the error I was presented with...

========================================================
checking minix/config.h presence... no
checking for minix/config.h... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... unknown
checking for _LARGE_FILES value needed for large files... unknown
checking for long long... yes
checking for off_t... yes
checking for int... yes
checking size of int... configure: error: cannot compute sizeof (int)
See `config.log' for more details.
===>  Script "configure" failed unexpectedly.
Please report the problem to stas@FreeBSD.org [maintainer] and attach the
"/usr/ports/lang/ruby18/work/ruby-1.8.6-p111/config.log" including the
output
of the failure of your make command. Also, it might be a good idea to
provide
an overview of all packages installed on your system (e.g. an `ls
/var/db/pkg`).
*** Error code 1

Stop in /usr/ports/lang/ruby18.
*** Error code 1

Stop in /usr/ports/ports-mgmt/portupgrade.
*** Error code 1

Stop in /usr/ports/ports-mgmt/portupgrade.
========================================================



===== security/aide ==========================================
config.status: creating po/Makefile
config.status: creating build.sh
===>  Building for gmake-3.81_2
make  all-recursive
Making all in glob
if
cc -DHAVE_CONFIG_H -I. -I. -I..    -I/usr/local/include  -O2 -pipe -march=c3
 -MT glob.o -MD -MP -MF ".deps/glob.Tpo" -c -o glob.o glob.c;  then mv -f
".deps/glob.Tpo" ".deps/glob.Po"; else rm -f ".deps/glob.Tpo"; exit 1; fi
glob.c:150: warning: conflicting types for built-in function 'malloc'
glob.c: In function `globfree':
glob.c:1075: internal compiler error: Illegal instruction: 4
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
*** Error code 1

Stop in /usr/ports/devel/gmake/work/make-3.81/glob.
*** Error code 1

Stop in /usr/ports/devel/gmake/work/make-3.81.
*** Error code 1

Stop in /usr/ports/devel/gmake/work/make-3.81.
*** Error code 1

Stop in /usr/ports/devel/gmake.
*** Error code 1

Stop in /usr/ports/security/aide.
========================================================



===== net/isc-dhcp3-server ====================================
Making links in server
===>  Building for isc-dhcp3-server-3.0.5_2
Making all in common
cc -O2 -pipe -march=c3 -D_PATH_DHCPD_CONF=\"/usr/local/etc/dhcpd.conf\" -D_P
ATH_DHCPD_DB=\"/var/db/dhcpd.leases\" -D_PATH_DHCPD_PID=\"/var/run/dhcpd.pid
\" -D_PATH_DHCRELAY_PID=\"/var/run/dhcrelay.pid\" -D_PATH_DHCLIENT_CONF=\"/u
sr/local/etc/dhclient.conf\" -D_PATH_DHCLIENT_SCRIPT=\"/usr/local/sbin/dhcli
ent-script\" -D_PATH_DHCLIENT_DB=\"/var/db/dhclient.leases\" -D_PATH_DHCLIEN
T_PID=\"/var/run/dhclient.pid\" -Dwarn=dhcp_warn -DNOMINUM -DPARANOIA -DJAIL
   -I/usr/ports/net/isc-dhcp3-server/work/dhcp-3.0.5  -I/usr/ports/net/isc-d
hcp3-server/work/dhcp-3.0.5/includes -O -Wall -Wno-unused   -c raw.c
cc -O2 -pipe -march=c3 -D_PATH_DHCPD_CONF=\"/usr/local/etc/dhcpd.conf\" -D_P
ATH_DHCPD_DB=\"/var/db/dhcpd.leases\" -D_PATH_DHCPD_PID=\"/var/run/dhcpd.pid
\" -D_PATH_DHCRELAY_PID=\"/var/run/dhcrelay.pid\" -D_PATH_DHCLIENT_CONF=\"/u
sr/local/etc/dhclient.conf\" -D_PATH_DHCLIENT_SCRIPT=\"/usr/local/sbin/dhcli
ent-script\" -D_PATH_DHCLIENT_DB=\"/var/db/dhclient.leases\" -D_PATH_DHCLIEN
T_PID=\"/var/run/dhclient.pid\" -Dwarn=dhcp_warn -DNOMINUM -DPARANOIA -DJAIL
   -I/usr/ports/net/isc-dhcp3-server/work/dhcp-3.0.5  -I/usr/ports/net/isc-d
hcp3-server/work/dhcp-3.0.5/includes -O -Wall -Wno-unused   -c parse.c
parse.c: In function `parse_numeric_aggregate':
parse.c:516: internal compiler error: Illegal instruction: 4
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
*** Error code 1

Stop in /usr/ports/net/isc-dhcp3-server/work/dhcp-3.0.5/work.freebsd/common.
*** Error code 1

Stop in /usr/ports/net/isc-dhcp3-server/work/dhcp-3.0.5/work.freebsd.
*** Error code 1

Stop in /usr/ports/net/isc-dhcp3-server/work/dhcp-3.0.5.
*** Error code 1

Stop in /usr/ports/net/isc-dhcp3-server.
*** Error code 1

Stop in /usr/ports/net/isc-dhcp3-server.
========================================================

I then commented out everything in the /etc/make.conf file, but the compiles still failed.

Following a suggestion in freebsd-questions, I set CFLAGS to "-pipe -O0 # letter o followed by zero digit".

Compilation (and overall install of the packages) succeeded.

Perhaps an optimisation bug on the VIA CPU?
Comment 1 Remko Lodder freebsd_committer freebsd_triage 2008-02-24 08:58:57 UTC
State Changed
From-To: open->closed

Indeed only the default optimalization flags are supported, this was 
widely discussed on the mailinglists before. Close the ticket.