All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v8 1/3] openjdk: new package
Date: Sun, 17 Mar 2019 14:08:42 +0100	[thread overview]
Message-ID: <20190317140842.5bace709@windsurf> (raw)
In-Reply-To: <20190315205233.128763-1-aduskett@gmail.com>

Hello,

On Fri, 15 Mar 2019 16:52:31 -0400
aduskett at gmail.com wrote:

> - If ccache is enabled, Buildroot sets CC, CXX, and CPP to the ccache binary,

Actually this is not correct: CC, CXX, CPP and al. point to the
toolchain wrapper, and the use of ccache is completely hidden inside
the toolchain wrapper.

It is HOSTCC/HOSTCXX and al. and are of the form "ccache gcc".

So I've dropped this comment from the commit log and the .mk, because
it was not correct.

> - Even when cross-compiling, OpenJDK builds several host-tools using the host's
>   gcc. In the case of zlib, if a host doesn't have the zlib development package
>   installed, OpenJDK compilation stops because zlib.h won't exist on the host
>   system. Because zlib is used to compile both native tools and cross-compiled
>   tools, patching make/autoconf/lib-bundled.m4 to call PKG_CHECK_MODULES for
>   zlib results in the host gcc trying to use cross-compiled libraries for
>   compiling native tools, which results in linking failures.
>   Using --with-zlib=bundled allows OpenJDK to compile correctly.

I have fixed the package to use --with-zlib=system. The key was to pass
BUILD_SYSROOT_CFLAGS="$(HOST_CFLAGS)" and
BUILD_SYSROOT_LDFLAGS="$(HOST_LDFLAGS)" so that the host-zlib library
is properly found.


> +config BR2_PACKAGE_OPENJDK
> +	bool "OpenJDK"
> +	depends on !BR2_SOFT_FLOAT
> +	depends on !BR2_STATIC_LIBS # Glibc
> +	depends on BR2_INSTALL_LIBSTDCPP # cups
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # alsa-lib, cups, libusb
> +	depends on BR2_TOOLCHAIN_USES_GLIBC
> +	depends on BR2_USE_MMU # cups
> +	depends on BR2_PACKAGE_XORG7
> +	select BR2_PACKAGE_ALSA_LIB
> +	select BR2_PACKAGE_CUPS
> +	select BR2_PACKAGE_FONTCONFIG
> +	select BR2_PACKAGE_GIFLIB
> +	select BR2_PACKAGE_JPEG
> +	select BR2_PACKAGE_LCMS2
> +	select BR2_PACKAGE_LIBPNG
> +	select BR2_PACKAGE_LIBUSB
> +	select BR2_PACKAGE_XLIB_LIBXRENDER
> +	select BR2_PACKAGE_XLIB_LIBXT
> +	select BR2_PACKAGE_XLIB_LIBXTST

I've added:

	select BR2_PACKAGE_ZLIB


> +if BR2_PACKAGE_OPENJDK
> +
> +menu "JVM Variants"

I have dropped this menu, and in the main option, I've added a "select"
that ensures at least one of the client and/or server variants are
enabled.

> +comment "OpenJDK needs X.Org"

	depends on BR2_USE_MMU

was missing

> +	depends on !BR2_PACKAGE_XORG7
> +
> +comment "OpenJDK needs glibc, and a toolchain w/ wchar, dynamic library, threads, C++"
> +	depends on BR2_USE_MMU
> +	depends on BR2_STATIC_LIBS || !BR2_INSTALL_LIBSTDCPP || \
> +		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAIN_USES_GLIBC
> +
> +comment "OpenJDK does not support soft floats"

	depends on BR2_USE_MMU

was missing as well.


> +# OpenJDK ignores some variables unless passed via the environment.
> +# These variables are PATH, LD, CC, CXX, and CPP.
> +# OpenJDK defaults ld to the ld binary but passes -Xlinker and -z as
> +# arguments during the linking process, which causes compilation failures.
> +# To fix this issue, LD is set to point to gcc.
> +# If ccache is enabled, Buildroot sets CC, CXX, and CPP to the ccache binary,
> +# which causes the configuration error:
> +# "Please use --enable-ccache instead of providing a wrapped compiler."
> +# This error is why CC, CPP, and CXX are explicitly set to point to their
> +# actual binaries.

So I've dropped this explanation about ccache.

> +OPENJDK_CONF_ENV = \
> +	PATH=$(BR_PATH) \
> +	CC=$(TARGET_CC) \
> +	CPP=$(TARGET_CPP) \
> +	CXX=$(TARGET_CXX) \
> +	LD=$(TARGET_CC)

... and defined BUILD_SYSROOT_CFLAGS and BUILD_SYSROOT_LDFLAGS.

> +	--with-zlib=bundled

and used --with-zlib=system

Applied with those changes!

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2019-03-17 13:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 20:52 [Buildroot] [PATCH v8 1/3] openjdk: new package aduskett at gmail.com
2019-03-15 20:52 ` [Buildroot] [PATCH v8 2/3] package/openjdk: package/openjdk: Add AArch64 support aduskett at gmail.com
2019-03-15 21:01   ` Thomas Petazzoni
2019-03-16 17:13     ` Adam Duskett
2019-03-17 13:08   ` Thomas Petazzoni
2019-03-15 20:52 ` [Buildroot] [PATCH v8 3/3] openjdk-hello-world: new test aduskett at gmail.com
2019-03-17 13:10   ` Thomas Petazzoni
2019-03-17 13:08 ` Thomas Petazzoni [this message]
2019-03-19 21:51 ` [Buildroot] [PATCH v8 1/3] openjdk: new package Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190317140842.5bace709@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.