how to build 32-bit openjdk7 on x86_64

Ben Cheng bccheng at google.com
Wed Nov 28 02:11:51 UTC 2007


Hi Folks,

I am trying to build 32-bit openjdk7 from source under control/make, but I
seem to have endless troubles picking up the right ARCH option. The source
code is from the b23 snapshot.

I started with

make ARCH_DATA_MODEL=32 ALT_BOOTDIR=/usr/lib/jvm/java-6-sun
ANT_HOME=<my_ant_path> FINDBUGS_HOME=<my_findbugs_path>

It quickly failed with the following error:

[ gcc command neglected]
...
-ljvm  -L/usr/lib/jvm/java-6-sun/jre/lib/amd64 -ljava
-L/usr/lib/jvm/java-6-sun/jre/lib/amd64/server -ljvm -lc
/usr/bin/ld: cannot find -ljvm

because there is no amd64 under /usr/lib/jvm/java-6-sun/jre/lib but only
i386, and without specifying ARCH the makefile relies on "uname -m" to guess
the ARCH, and it chooses amd64 when seeing x86_64.

So I tried to add ARCH=i386 in the command line. The build goes past the
previous stage, but sees a different in building corba/make/javax/xa:

/bin/sh: line 5: Check_ALT_JDK_IMPORT_PATH/bin/javac: No such file or
directory

This problem is slightly off topic, as it seems to require adding
ALT_JDK_IMPORT_PATH to the command-line even my intention is to do a
complete build. Although I still don't know why it is necessary, adding
ALT_JDK_IMPORT_PATH=$ALT_BOOTDIR gets me past corba, but the builds stalls
at hotspot:


make[6]: *** No rule to make target
`openjdk/v1_7/hotspot/src/cpu/i386/vm/x86_32.ad', needed by
`../generated/adfiles/linux_x86_32.ad'.  Stop.

Apparenly hotspot doesn't like ARCH=i386 but prefers ARCH=x86, and I found a
place to hack in hotspot/build/linux/Makefile, where I override
ARCH=$(SRCARCH) in the following context:

$(TARGETS_C2):  $(SUBDIRS_C2)
        cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS)
ARCH=$(SRCARCH)

Then, the next error shows up in exporting jvmti.html, where I need to add
the following rule in hotspot/build/linux/makefiles/defs.make if I define
ARCH as i386:

ifeq ($(ARCH), i386)
  ARCH_DATA_MODEL  = 32
  PLATFORM         = linux-i586
  VM_PLATFORM      = linux_i486
  HS_ARCH          = x86
endif

There is a similar patch for i586 so I suspect people tried to build hotspot
with ARCH=i686 and ran into similar errors.

Well, this is not the end of errors, as the next one shows up in
jdk/make/java/jli, where it fails to locate ergo_i386.c because only the
following two variants are available:

jdk/src/solaris/bin/ergo_i586.c
jdk/src/solaris/bin/ergo_sparc.c

In summary, my questions can be condensed into two:

1) Is control/make the right place to build everything from source. If so,
why is ALT_JDK_IMPORT_PATH needed in the make command line?
2) What is the ARCH value applicable to all modules if the goal is to build
32-bit package on x86_64 platform?

Thanks,
-Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/build-dev/attachments/20071127/4281c429/attachment.html>


More information about the build-dev mailing list