Date: Sun, 15 Sep 2013 23:59:22 +0200 From: Dimitry Andric <dim@freebsd.org> To: Greg Lewis <glewis@eyesbeyond.com> Cc: "java@FreeBSD.org" <java@freebsd.org>, Baptiste Daroussin <bapt@freebsd.org> Subject: Re: Building java/openjdk7 with clang Message-ID: <8E1E16F7-23F6-48EB-90C4-4DD44A50A4A6@freebsd.org> In-Reply-To: <20130915194729.GA35020@misty.eyesbeyond.com> References: <108F3771-64B3-40E9-91FA-04C160442608@FreeBSD.org> <20130915194729.GA35020@misty.eyesbeyond.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_EF54FA7C-BD10-4024-AEEE-7651A5C44C58 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On Sep 15, 2013, at 21:47, Greg Lewis <glewis@eyesbeyond.com> wrote: > On Sun, Sep 15, 2013 at 01:45:19AM +0200, Dimitry Andric wrote: >> 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. > > What version of FreeBSD did you do this on? Does it break compilation > with gcc? This was on a very recent head. I have not tested building with gcc, but I don't think any of these changes are very likely to cause breakage for gcc. I also don't expect them to cause any trouble for stable branches. > For the change wrt COMPILER_WARNINGS_FATAL, why not set this to false > for clang rather than turn this off unless explicitly on for all compilers? Because the default value of COMPILER_WARNINGS_FATAL was off for bsd, see jdk/make/common/shared/Defs-bsd.gmk, which has: # Default for COMPILER_WARNINGS_FATAL on BSD (C & C++ compiler warnings) ifndef COMPILER_WARNINGS_FATAL COMPILER_WARNINGS_FATAL=false endif However, the value of COMPILER_WARNINGS_FATAL was not checked consistently. In most makefiles, the test is: ifeq ($(COMPILER_WARNINGS_FATAL),true) so if the macro is not defined at all, the test will fail, but only in two makefiles, the test is: ifneq ($(COMPILER_WARNINGS_FATAL),false) which causes the test to (erroneously) succeed if the macro is not defined at all! This is what caused the -Werror option to be added, even while the global setting COMPILER_WARNINGS_FATAL was off. Maybe the Makefiles should really be fixed to properly include the global Defs-bsd.gmk file, but that looks like it will cause a lot more churn. > In terms of testing, that's a bit of a sore spot. You could notionally > run it through the test suite, but you'd need to compare that to a version > built with gcc since I suspect there will be numerous failures anyway. I tried running "gmake test" in the root of the work dir, but while it did indicate success, it also didn't seem to do very much. So where is the real test suite located? -Dimitry --Apple-Mail=_EF54FA7C-BD10-4024-AEEE-7651A5C44C58 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.20 (Darwin) iEYEARECAAYFAlI2LcEACgkQsF6jCi4glqOGhwCgq4iKhsHuJ36D53lGvtSSp75O 4wcAoMp1a4DGka8189f+g5AjltfyRo9d =0SOG -----END PGP SIGNATURE----- --Apple-Mail=_EF54FA7C-BD10-4024-AEEE-7651A5C44C58--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8E1E16F7-23F6-48EB-90C4-4DD44A50A4A6>