How to build openjdk7 for customized FreeBSD system
xzpeter at gmail.com
Sat Jun 8 03:04:50 UTC 2013
I did this in a stupid way. I am sending this out in case someone met the
same problem (or to say, you want to build openjdk on an platform that have
no older version of JDK supported).
The main idea is, firstly find a generic FreeBSD 8.2 system, build the
openjdk7 package (well, there is no problem on generic system, as long as
you are using the port collections corresponding to that specific version I
suppose). Then, we can leverage all the Java-built output (includes
*.class, *.jar, and some *.java/*.[ch] if they are auto-generated by the
build system using JVM) in the generic systems, replacing all the
$(JAVAC_CMD) and $(JAVAH_CMD) lines in Makefiles with something like (or we
can try direct copy of the object files, but sometimes we still need to do
this since the dependencies of 'make' are not the JAR files sometimes):
scp $GENERIC_BSD:$JAR_FILE_PATH $PRIVATE_BSD:$JAR_FILE_PATH
Or to say, we do fetch the good 'jar' from the generic systems instead of
invoking a sick JVM and build it until we met error and stop the make
I suppose all these things need some knowledge on the Makefile structure of
openjdk. This is nasty work, but it did work for us.
Another solution I thought about is cross-compile the whole JDK on a
generic system, and copy all the private C libraries on the private system
to the generic one before-hand (this may only be working when the generic
system has cross-toolchain I suppose, or in my case that the two systems
are using the same CPU arch). Just an idea, no need to try currently.
Hope it helps.
On Tue, Jun 4, 2013 at 4:44 PM, Xu Zhe <xzpeter at gmail.com> wrote:
> Hi, all,
> I have posted several mails in the list, asking for different kinds of
> build errors when I met during the process of building openjdk7 on a
> customized FreeBSD 8.2 system.
> Today I found the root cause of all the problems. That is, the system
> needs one initial bootstrap Java SDK to build the openjdk7, but the
> tragedy is that, *all* the bootstrap JDKs are binaries. These binaries
> could run on our system, but will met strange issue since the system is
> heavily hacked in the kernel and libc part, and it's never generic at all.
> So here is the problem... I will never have a working Java environment
> as the bootstrap JDK on the hacked system. I need another generic system
> to help, who has a good working JDK.
> So please ignore all the strange errors I posted. Now I want to ask a
> more generic question, which I suppose is the only way to finish my
> porting work:
> How should I build all the C codes in openjdk7 on my hacked system,
> while build the rest Java codes on another system?
> Thanks in advance!
More information about the freebsd-ports