Building JDK8 b106 with sysroot and isystem

Jungwoo Ha jwha at google.com
Wed Sep 25 06:31:46 UTC 2013


The following diff fixed the configure problem. Please let me know if this
looks okay.
(There is also a problem with preprocessing, but since there is no
--extra-cppflags, I used CPPFLAGS instead)

$ hg diff common/autoconf/libraries.m4 common/autoconf/toolchain.m4
diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4
--- a/common/autoconf/libraries.m4
+++ b/common/autoconf/libraries.m4
@@ -404,6 +404,9 @@
             # AC_CHECK_LIB does not support use of cl.exe
             PREV_LDFLAGS="$LDFLAGS"
             LDFLAGS="$FREETYPE2_LIBS"
+            if test "x$SYS_ROOT" != x; then
+                LDFLAGS="$LDFLAGS --sysroot=$SYS_ROOT"
+            fi
             AC_CHECK_LIB(freetype, FT_Init_FreeType,
                          FREETYPE2_FOUND=true,
                          AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ]))
diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4
--- a/common/autoconf/toolchain.m4
+++ b/common/autoconf/toolchain.m4
@@ -228,6 +228,19 @@
                     ],
                     [])

+if test "x$with_extra_cflags" != x; then
+  CFLAGS="$CFLAGS $with_extra_cflags"
+fi
+if test "x$with_extra_cxxflags" != x; then
+  CXXFLAGS="$CXXFLAGS $with_extra_cxxflags"
+fi
+if test "x$with_extra_ldflags" != x; then
+  LDFLAGS="$LDFLAGS $with_extra_ldflags"
+fi
+if test "x$SYS_ROOT" != x; then
+  LDFLAGS="$LDFLAGS --sysroot=$SYS_ROOT"
+fi
+
 # Store the CFLAGS etal passed to the configure script.
 ORG_CFLAGS="$CFLAGS"
 ORG_CXXFLAGS="$CXXFLAGS"


So now I can run make, and the next problem is on adlc.

Compiling /home/jwha/clients/jdk8_build/hotspot/src/share/vm/adlc/adlparse.cpp
rm -f ../generated/adfiles/adlparse.o
/path/../to/compiler/bin/g++ -DLINUX -D_GNU_SOURCE -DAMD64
-I/home/jwha/clients/jdk8_build/hotspot/src/share/vm/prims
-I/home/jwha/clients/jdk8_build/hotspot/src/share/vm
-I/home/jwha/clients/jdk8_build/hotspot/src/share/vm/precompiled
-I/home/jwha/clients/jdk8_build/hotspot/src/cpu/x86/vm
-I/home/jwha/clients/jdk8_build/hotspot/src/os_cpu/linux_x86/vm
-I/home/jwha/clients/jdk8_build/hotspot/src/os/linux/vm
-I/home/jwha/clients/jdk8_build/hotspot/src/os/posix/vm
-I/home/jwha/clients/jdk8_build/hotspot/src/share/vm/adlc
-I../generated -DASSERT -DTARGET_OS_FAMILY_linux -DTARGET_ARCH_x86
-DTARGET_ARCH_MODEL_x86_64 -DTARGET_OS_ARCH_linux_x86
-DTARGET_OS_ARCH_MODEL_linux_x86_64 -DTARGET_COMPILER_gcc -DCOMPILER2
-DCOMPILER1 -fno-rtti -fno-exceptions -D_REENTRANT -fcheck-new
-fvisibility=hidden -pipe -fno-strict-aliasing -fno-omit-frame-pointer
-Werror -g -c -o ../generated/adfiles/adlparse.o
/home/jwha/clients/jdk8_build/hotspot/src/share/vm/adlc/adlparse.cpp
In file included from
/home/jwha/clients/jdk8_build/hotspot/src/share/vm/adlc/adlparse.cpp:27:0:
/home/jwha/clients/jdk8_build/hotspot/src/share/vm/adlc/adlc.hpp:33:19:
fatal error: stdio.h: No such file or directory

You can see that it doesn't pass $extra_cxxflags anywhere.
Any hint how I can fix this?

Jungwoo



On Thu, Sep 19, 2013 at 1:24 AM, Erik Joelsson <erik.joelsson at oracle.com>wrote:

>
> On 2013-09-19 01:59, Jungwoo Ha wrote:
>
>  Thanks. I revisited what I did earlier and checked what you guys
> mentioned here.
> I passed --with-tools-dir and --with-sys-root to specify the compiler and
> the libc location.
>
>  As I described in my original email, the configure ignores sysroot and
> extra_cflags when checking for C++ compiler
> * configure:20253: checking whether the C compiler works
>     Here ac_link is defined as "$CC -o conftest$ac_exeext $CFLAGS
> $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5"
>    There is no place that SYS_ROOT is added nor $with_extra_cflags.
>    If I manually add -isystem and --sysroot= on the ac_link this part is
> resolved.
>
>  I guess this should be somehow fixed, right?
>
>   Yes, it should. But instead of editing the generated configure file,
> please have a look in common/autoconf/toolchain.m4.
>
> /Erik
>
>  Jungwoo
>
>
>
>  On Wed, Sep 18, 2013 at 2:55 AM, Magnus Ihse Bursie <
> magnus.ihse.bursie at oracle.com> wrote:
>
>> On 2013-09-17 20:01, Jungwoo Ha wrote:
>>
>>> Can you tell me what is the expected layout of devkit?
>>> I'll put things together and will try.
>>>
>>
>>  --with-devkit=/foo is a shorthand for
>> --with-tools-dir=/foo/bin --with-sys-root=/foo/<host_alias>/libc
>> or
>> --with-tools-dir=/foo/bin --with-sys-root=/foo/<host>/sys-root
>> depending on wether /foo/<host_alias>/libc is an existing directory or
>> not.
>>
>> <host> and <host_alias> are the name of the target platform as defined by
>> configure, e.g. "x86_64-pc-linux-gnu" (host) or "x86-linux-gnu"
>> (host_alias).
>>
>> I believe this is a common way to structure cross-compilation tools,
>> which was the primary reason to include this shortcut.
>>
>> If this layout does not match your need, it is probably easier to just
>> use --with-devit and --with-tools-dir separately. On the other hand, if you
>> think that your layout is common, we welcome patches that adds a check for
>> it in --with-devkit. After all, the idea with --with-devkit was to make
>> cross-compilation easier.
>>
>> /Magnus
>>
>
>
>



More information about the build-dev mailing list