Building java/openjdk7 with clang

Dimitry Andric dim at FreeBSD.org
Sat Sep 14 23:45:45 UTC 2013


Hi,

I took some time to figure out how to build java/openjdk7 with clang.
There are a few items I changed:

- Change a few instances of "ifneq ($(COMPILER_WARNINGS_FATAL),false)"
  to "ifeq ($(COMPILER_WARNINGS_FATAL),true)", to make sure -Werror is
  *not* used.  There are zillions of warnings in openjdk, and I don't
  think it is worth the trouble to fix them all (even if that is
  possible :).
- Remove -fcheck-new from CFLAGS, since clang does not support it, and
  it does not make sense anyway.  This is the only one that is not
  strictly needed; if -Werror is not enabled, clang will just print a
  warning that the option is unused, but it won't be fatal.
- Change the $(CC) -dumpspecs hack in one of the Makefiles to something
  more portable.  The -dumpspecs is done to figure out if the compiler
  uses --hash-style=gnu when linking, and if it does, it changes the
  option to --hash-style=both.  On FreeBSD, this is basically a no-op,
  so it could also be commented out entirely.
- In jdk/src/solaris/native/java/net/net_util_md.c, change two
  instances of CHECK_NULL() to CHECK_NULL_RETURN(), since the function
  they are in is supposed to return a value.  I chose to return 0,
  since that is what the function seems to use as a default value.

With these fixes, openjdk7 builds and runs fine for me.  I tried to run
"gmake test" in the work directory, but that didn't do much, so I am
not sure if a full test suite will survive anything.  It would be nice
if anybody knows a good way to test the produced binaries more
thoroughly.

-Dimitry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: java__openjdk7-fix-build-2.diff
Type: application/octet-stream
Size: 3687 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-java/attachments/20130915/deb4cb83/attachment.obj>
-------------- next part --------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-java/attachments/20130915/deb4cb83/attachment.sig>


More information about the freebsd-java mailing list