Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8234535

Cross compilation fails due to missing CFLAGS for the BUILD_CC

    XMLWordPrintable

Details

    • b25
    • linux

    Backports

      Description

        For building the build jdk, the file buildjdk-spec.gmk is used as configuration. The CLFAGS_JDKLIB in this file, does not contain -fno-lifetime-dse (and other flags) if the GCC used for BUILD_CC is newer than version 6.
        Because of the missing -fno-lifetime-dse flag (and possibly others) the build jdk crashes immediately. The build JDK is not even able to run "java -version".

        The reason for the missing -fno-lifetime-dse is, that during the configure step, the build system uses the target CFLAGS (provided using --with-extra-cflags) for the BUILD_CC, which is the compiler running on the host which does not support those flags.

        The config.log shows the following:

        configure:75323: checking if BUILD_CC supports "-fno-lifetime-dse -Werror"
        configure:75341: /usr/bin/cc -c -DJAVASE_EMBEDDED -DPNG_ARM_NEON_OPT=0 -march=armv7-a -mno-unaligned-access -fsigned-char -fno-lifetime-dse -fno-delete-null-pointer-checks -fdiagnostics-color=always -fstack-protector-strong -fasynchronous-unwind-tables -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -fno-lifetime-dse -Werror conftest.c >&5
        cc: error: unrecognized command line option '-mno-unaligned-access'; did you mean '-Wno-aligned-new'?
        configure:75341: $? = 1

        Most of the flags provided to /usr/bin/cc are identical with those provided to configure via --with-extra-cflags.

        This does not only happen while configure checks for the flag -fno-lifetime-dse, but also for "-fno-delete-null-pointer-checks", "-ffp-contract=off" and possibly others.

        This only happens for the CFLAGS, but not for CXXFLAGS. Checking the c++ compiler works as expected:

        configure:75440: checking if BUILD_CXX supports "-fno-lifetime-dse -Werror"
        configure:75458: /usr/bin/g++ -c -fno-lifetime-dse -Werror conftest.cpp >&5
        configure:75458: $? = 0
        configure:75473: result: yes

        GCCs used during compilation:

        gcc (Debian 8.3.0-6) 8.3.0
        Copyright (C) 2018 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions. There is NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

        arm-linux-gnueabi-gcc (Linaro GCC 4.9-2017.01) 4.9.4
        Copyright (C) 2015 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions. There is NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

        Attachments

          Issue Links

            Activity

              People

                cgo Christoph Göttschkes (Inactive)
                cgo Christoph Göttschkes (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: