Building java/openjdk7 with clang
Jung-uk Kim
jkim at FreeBSD.org
Thu Sep 19 21:29:08 UTC 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2013-09-14 19:45:19 -0400, Dimitry Andric wrote:
> Hi,
>
> I took some time to figure out how to build java/openjdk7 with
> clang. There are a few items I changed:
BTW, patch-set and patch-set-jdk are directly coming from the OpenJDK
Mercurial repositories:
http://hg.openjdk.java.net/bsd-port/bsd-port/
http://hg.openjdk.java.net/bsd-port/bsd-port/corba/
http://hg.openjdk.java.net/bsd-port/bsd-port/hotspot/
http://hg.openjdk.java.net/bsd-port/bsd-port/jaxp/
http://hg.openjdk.java.net/bsd-port/bsd-port/jaxws/
http://hg.openjdk.java.net/bsd-port/bsd-port/jdk/
http://hg.openjdk.java.net/bsd-port/bsd-port/langtools/
Note the bsd-port is shared with other BSDs and we don't want to upset
other BSD users. ;-)
> - 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
> :).
AFAIK, it was *intentionally* turned on by default for HotSpot. We
can override it via MAKE_ENV for ports tree for now, however.
> - 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.
A proper fix may be committed to upstream to minimize diff. Please
see my patch for example.
> - 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.
Agreed. It was based on Defs-linux.gmk but it is actually
BSD-specific file. I don't think any BSDs ever used
'--hash-style=gnu'. Therefore, this check should be removed
altogether, IMO.
BTW, your test doesn't work because the output is going to stderr, not
stdout. Please see my patch for "-fcheck-new" for a proper test. ;-)
> - 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.
Looks good. Actually, this problem was fixed in JDK8 long ago:
http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/eb441933f6fe
> 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.
Thanks for working on this!
Jung-uk Kim
* PS: The attached patch is also available from here:
http://people.freebsd.org/~jkim/openjdk7.diff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.21 (FreeBSD)
iQEcBAEBAgAGBQJSO2v/AAoJECXpabHZMqHOtVIIAIHsmyECYTRq/aZ8XDpqaWF7
fgzLk9Cr3+nigSTHBf/vqDqaMUEQz9uQlgv+YrKYoNlbiUw/DjDg9tmpRxKtsDRh
6qg4hzVlVdgJqMvIaRi+SFsLZY3/eym1NzWs2MKqJj0BqmSt4uubkQP43xJCGMgO
2A5e4q3RO97MwV/z0ocQ5LgB092a3OkyF+9lMG0enw1FJgfQSwcnZuqQa7howF4l
+nazX5ey3aVfzwVUaldjsl5XsdTlX0ed5hd+bc60pEc5P+fcBmW1Mzpl8BJg0mgh
qaKYyWrtHWcWEBq/Y2C6jv/F8JljH9UWuBlvOOJzXo9aOSW5MPguNXQbA8MoPo8=
=QTdD
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openjdk7.diff
Type: text/x-patch
Size: 4296 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-java/attachments/20130919/6230f93d/attachment.bin>
More information about the freebsd-java
mailing list