Build failed in step 'Installing core C gcc compiler' #2068

@Brightsx

Description

I'm attempting to build the cross-compiler toolchain for a linux kernel on a macOS with multilib on .

Here are is the related build.log

[DEBUG] ==> Return status 0
[DEBUG] ==> Executing: 'rm' '-rf' 'sysroot-check'
[DEBUG] ==> Return status 0
[DEBUG] ==> Executing: 'mkdir' '-p' 'sysroot-check'
[DEBUG] ==> Return status 0
[DEBUG] ==> Executing: 'touch' 'sysroot-check/seen' 'sysroot-check/unique'
[DEBUG] ==> Return status 0
[DEBUG] ==> Executing: 'mkdir' '-p' 'sysroot-check'
[DEBUG] ==> Return status 0
[DEBUG] ==> Executing: 'rm' '-f' 'sysroot-check/unique'
[DEBUG] ==> Return status 0
[DEBUG] Entering 'evaluate_cflags'
[DEBUG] Multilib iterator: call function 'evaluate_multilib_cflags' in 'evaluate_cflags'
[DEBUG] multi_dir=.
[DEBUG] multi_os_dir=../lib64
[DEBUG] multi_os_dir_gcc=../lib64
[DEBUG] multi_flags=
[DEBUG] multi_root=/Volumes/MyCaseSensitiveDisk/x-tools/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot
[DEBUG] multi_target=x86_64-linux-gnu
[DEBUG] multi_index=1
[DEBUG] Sanitized 'mdir': 'lib/.' -> 'lib'
[DEBUG] Sanitized 'mdir_os': 'lib/../lib64' -> 'lib64'
[EXTRA] '' --> lib (gcc) lib64 (os)
[DEBUG] Leaving '/Volumes/MyCaseSensitiveDisk/ct-ng-work/x86_64-unknown-linux-gnu/build/build-cc-gcc-core/evaluate_cflags'
[DEBUG] Entering 'evaluate_cflags_32'
[DEBUG] Multilib iterator: call function 'evaluate_multilib_cflags' in 'evaluate_cflags_32'
[DEBUG] multi_dir=32
[DEBUG] multi_os_dir=../lib
[DEBUG] multi_os_dir_gcc=../lib
[DEBUG] multi_flags= -m32
[DEBUG] multi_root=/Volumes/MyCaseSensitiveDisk/x-tools/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot
[DEBUG] multi_target=i386-linux-gnu
[DEBUG] multi_index=2
[DEBUG] Sanitized 'mdir': 'lib/32' -> 'lib/32'
[DEBUG] Sanitized 'mdir_os': 'lib/../lib' -> 'lib'
[EXTRA] ' -m32' --> lib/32 (gcc) lib (os)
[DEBUG] Leaving '/Volumes/MyCaseSensitiveDisk/ct-ng-work/x86_64-unknown-linux-gnu/build/build-cc-gcc-core/evaluate_cflags_32'
[DEBUG] Configured target CFLAGS: ' '
[DEBUG] Filtered target CFLAGS: ''
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Installing core C gcc compiler'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_EnvModify[scripts/functions@1074]
[ERROR] >> called from: cc_gcc_multilib_housekeeping[scripts/build/cc/gcc.sh@177]
[ERROR] >> called from: do_gcc_core_backend[scripts/build/cc/gcc.sh@749]
[ERROR] >> called from: do_cc_core[scripts/build/cc/gcc.sh@212]
[ERROR] >> called from: main[scripts/crosstool-NG.sh@697]

For the cc_gcc_multilib_housekeeping[scripts/build/cc/gcc.sh@177],

cc_gcc_multilib_housekeeping() {
    local cc host
    local ml_arch ml_abi ml_cpu ml_tune ml_fpu ml_float ml_endian ml_mode ml_unknown ml
    local new_cflags
    for arg in "$@"; do
        eval "${arg// /\\ }"
    if [ \( "${CT_CANADIAN}" = "y" -o "${CT_CROSS_NATIVE}" = "y" \) -a "${host}" = "${CT_HOST}" ]; then
        CT_DoLog EXTRA "Canadian Cross/Cross-native unable to confirm multilibs configuration "\
            "directly; will use build-compiler for housekeeping."
        # Since we cannot run the desired compiler, substitute build-CC with the assumption
        # that the host-CC is configured in the same way.
        cc="${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-${CT_CC}"
    CT_IterateMultilibs evaluate_multilib_cflags evaluate_cflags
    if [ -n "${CT_MULTILIB}" ]; then
        # Filtering out some of the options provided in CT-NG config. Then *prepend*
        # them to CT_TARGET_CFLAGS, like scripts/crosstool-NG.sh does. Zero out
        # the stashed MULTILIB flags so that we don't process them again in the passes
        # that follow.
        CT_DoLog DEBUG "Configured target CFLAGS: '${CT_ARCH_TARGET_CFLAGS_MULTILIB}'"
        ml_unknown= # Pass through anything we don't know about
        for f in ${CT_ARCH_TARGET_CFLAGS_MULTILIB}; do
            eval ml=\$ml_`cc_gcc_classify_opt ${f}`
            if [ "${ml}" != "seen" ]; then
                new_cflags="${new_cflags} ${f}"
        CT_DoLog DEBUG "Filtered target CFLAGS: '${new_cflags}'"
        CT_EnvModify CT_ALL_TARGET_CFLAGS "${new_cflags} ${CT_TARGET_CFLAGS}"
        CT_EnvModify CT_ARCH_TARGET_CFLAGS_MULTILIB ""
        # Currently, the only LDFLAGS are endianness-related
        CT_DoLog DEBUG "Configured target LDFLAGS: '${CT_ARCH_TARGET_LDFLAGS_MULTILIB}'"
        if [ "${ml_endian}" != "seen" ]; then
            CT_EnvModify CT_ALL_TARGET_LDFLAGS "${CT_ARCH_TARGET_LDFLAGS_MULTILIB} ${CT_TARGET_LDFLAGS}" # scripts/build/cc/gcc.sh@177
            CT_EnvModify CT_ARCH_TARGET_LDFLAGS_MULTILIB ""
        CT_DoLog DEBUG "Filtered target LDFLAGS: '${CT_ARCH_TARGET_LDFLAGS_MULTILIB}'"

And for the CT_EnvModify[scripts/functions@1074]

CT_EnvModify()
    local e
    if [ "$1" = "export" ]; then
        shift
        e="export "
    eval "${e}${1}=\"${2}\""
    echo "${e}${1}=\"${2}\"" >> "${CT_BUILD_DIR}/env.modify.sh" # scripts/functions@1074

Why the echo results in the bug?

Issue submission guidelines

See detaled guidelines. In short:

  • Report crosstool-NG version
  • Report host OS and its version
  • Attach .config (unless the issue is not related to any configuration)
  • Attach build.log (unless crosstool-NG fails before the build starts)
  •