Bug 46269 - ports/java: jdk 1.3.1 p7 fails to build with gcc optimization for k6
Summary: ports/java: jdk 1.3.1 p7 fails to build with gcc optimization for k6
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: java (show other bugs)
Version: 4.7-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Greg Lewis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-15 09:50 UTC by Simon Barner
Modified: 2003-08-31 05:44 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Barner 2002-12-15 09:50:05 UTC
Building the native JDK 1.3.1 p7 (jdk-1.3.1p7_2), I encountered the
following problem: Everything builds fine, except for the files

work/j2sdk1.3.1/src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c
work/j2sdk1.3.1/src/share/native/sun/awt/medialib/mlib_c_ImageConv5x5.c

Here are the relevant parts of my /etc/make.conf (/etc/defaults/make.conf is
unmodified and kept up to date):

CPUTYPE="k6-2"
CFLAGS= -O -pipe -march=k6 -mcpu=k6

These are the error messages for the first file (the ones for the second file
are equivalent): (long lines!)

/usr/bin/gcc -O3 -O -pipe -march=k6 -mcpu=k6  -W -Wall  -Wno-unused -Wno-parentheses   -Di386 -DARCH='"i386"' -DSOLARIS2 -DRELEASE='"1.3.1-p7"' -DFULL_VERSION='"1.3.1-p7-simon-021215-02:50"' -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -DLOGGING -D_LITTLE_ENDIAN -I. -I../../../../build/bsd-i386/tmp/sun/sun.awt.medialib/mlib_image/CClassHeaders -I../../../../src/solaris/javavm/export -I../../../../src/share/javavm/export -I../../../../src/share/native/common -I../../../../src/solaris/native/common -I../../../../src/share/native/sun/awt/medialib -I../../../../src/solaris/native/sun/awt/medialib   -I../../../../src/solaris/native/sun/awt/medialib/medialib   -c -o ../../../../build/bsd-i386/tmp/sun/sun.awt.medialib/mlib_image/obj/mlib_c_ImageConv3x3.o ../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c: In function `mlib_c_conv3x3_32nw':
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:499: syntax error before `1'
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:503: invalid lvalue in assignment
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:503: `k7' undeclared (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:503: (Each undeclared identifier is reported only once
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:503: for each function it appears in.)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:503: `k8' undeclared (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c: In function `mlib_c_conv3x3_32ext':
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:579: syntax error before `1'
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:584: invalid lvalue in assignment
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:584: `k7' undeclared (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:584: `k8' undeclared (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c: In function `mlib_c_conv3x3_16nw':
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:663: syntax error before `1'
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:672: invalid lvalue in assignment
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:672: `k7' undeclared (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:672: `k8' undeclared (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c: In function `mlib_c_conv3x3_16ext':
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:783: syntax error before `1'
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:793: invalid lvalue
 in assignment
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:793: `k7' undeclare
d (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:793: `k8' undeclare
d (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c: In function `mlib_
c_conv3x3_8nw':
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:907: syntax error b
efore `1'
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:919: invalid lvalue
 in assignment
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:919: `k7' undeclare
d (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:919: `k8' undeclare
d (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c: In function `mlib_
c_conv3x3_8ext':
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:1032: syntax error 
before `1'
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:1045: invalid lvalu
e in assignment
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:1045: `k7' undeclar
ed (first use in this function)
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c:1045: `k8' undeclar
ed (first use in this function)
gmake[4]: *** [../../../../build/bsd-i386/tmp/sun/sun.awt.medialib/mlib_image/obj/mlib_
c_ImageConv3x3.o] Error 1
gmake[4]: Leaving directory `/usr/ports/java/jdk13/work/j2sdk1.3.1/make/sun/image/gener
ic'
gmake[3]: *** [optimized] Error 2
gmake[3]: Leaving directory `/usr/ports/java/jdk13/work/j2sdk1.3.1/make/sun/image/gener
ic'
gmake[2]: *** [all] Error 1
gmake[2]: Leaving directory `/usr/ports/java/jdk13/work/j2sdk1.3.1/make/sun/image'
gmake[1]: *** [all] Error 1
gmake[1]: Leaving directory `/usr/ports/java/jdk13/work/j2sdk1.3.1/make/sun'
gmake: *** [all] Error 1
*** Error code 2

The error appears 4 times:
build/bsd-i386/tmp/sun/sun.awt.medialib/mlib_image/obj/mlib_c_ImageConv3x3.o
build/bsd-i386/tmp/sun/sun.awt.medialib/mlib_image/obj/mlib_c_ImageConv5x5.o
build/bsd-i386/tmp/sun/sun.awt.medialib/mlib_image/obj_g/mlib_c_ImageConv3x2.o
build/bsd-i386/tmp/sun/sun.awt.medialib/mlib_image/obj_g/mlib_c_ImageConv5x5.o

Fix: 

Build the object files without AMD k6 optimization, i.e.
cd /usr/ports/java/jdk13/work/j2sdk1.3.1/make/sun/image/generic

/usr/bin/gcc -O3 -O -pipe -march=k6 -W -Wall  -Wno-unused
-Wno-parentheses   -Di386 -DARCH='"i386"' -DSOLARIS2 -DRELEASE='"1.3.1-p7"'
-DFULL_VERSION='"1.3.1-p7-toor-021215-01:34"' -D_LARGEFILE64_SOURCE
-D_GNU_SOURCE -D_REENTRANT -DLOGGING -D_LITTLE_ENDIAN -I.
-I../../../../build/bsd-i386/tmp/sun/sun.awt.medialib/mlib_image/CClassHeaders
-I../../../../src/solaris/javavm/export -I../../../../src/share/javavm/export
-I../../../../src/share/native/common -I../../../../src/solaris/native/common
-I../../../../src/share/native/sun/awt/medialib
-I../../../../src/solaris/native/sun/awt/medialib 
-I../../../../src/solaris/native/sun/awt/medialib/medialib   
-c -o ../../../../build/bsd-i386/tmp/sun/sun.awt.medialib/mlib_image/obj/
mlib_c_ImageConv3x3.o
../../../../src/share/native/sun/awt/medialib/mlib_c_ImageConv3x3.c

etc.
and continue the build of the port:

cd /usr/ports/java/jdk13
make build

=> removing -mcpu=k6 is enough. Decreading the optimization level to -O or
disabling optimization at all does not help.


Maybe this is a gcc bug?
How-To-Repeat: 
Build the java/jdk13 port with the -march=k6 -mcpu=k6 gcc flags: e.g.

put
CPUTYPE="k6-2"
CFLAGS= -O -pipe -march=k6 -mcpu=k6

into /etc/make.conf

cd /usr/ports/java/jdk13
make build
Comment 1 Greg Lewis freebsd_committer freebsd_triage 2003-06-03 17:20:07 UTC
Responsible Changed
From-To: freebsd-java->glewis

Over to maintainer (aka me).
Comment 2 Greg Lewis freebsd_committer freebsd_triage 2003-08-22 18:09:29 UTC
State Changed
From-To: open->feedback

Can you please install a different version of gcc (see lang/gcc* for your 
options) and try compiling with that?  This is almost certainly a gcc bug, 
and I believe its triggered by the jdk14 port as well.  If a newer version 
compiles it correctly with your -mcpu setting then that would confirm that 
its a bug with gcc (I can maybe add a check for it and warn people in that 
case).
Comment 3 Greg Lewis freebsd_committer freebsd_triage 2003-08-31 05:43:52 UTC
State Changed
From-To: feedback->closed

I committed tha variant of the fix you sent me, thanks!