how to build 32-bit openjdk7 on x86_64

Paul Hohensee Paul.Hohensee at Sun.COM
Wed Nov 28 16:33:30 UTC 2007


Actually, you can build 32-bit linux hotspot standalone on a 64-bit 
system, but
you can't build a 32-bit linux jdk (that happens to include a hotspot 
build) on
a 64-bit system.

To build a 32-bit linux hotspot standalone, go to the build/linux
directory in the hotspot workspace, set ALT_BOOTDIR to a 32-bit boot 
jdk, put
$ALT_BOOTDIR/bin on your PATH and issue 'make product', or whatever
flavor of build you want.  To build a 64-bit linux hotspot, set ALT_BOOTDIR
to a 64-bit boot jdk, etc., and issue 'make LP64=1 product', etc.

Paul

Stephen Bohne wrote:
> Ben Cheng wrote:
>> 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?
>
> I don't think (2) is supported, at least for the HotSpot workspace.  
> You have to build 32-bit on a 32-bit platform.  Yes, the build could 
> be more flexible here.  Patches are welcome. :)
>
> Don't know the answer to (1), sorry.
>
> Steve
>>
>> Thanks,
>> -Ben
>



More information about the build-dev mailing list