交叉编译GCC:检查动态链接器特性时,在GCC_NO_EXECUTABLES之后不允许进行链接测试

2vuwiymt  于 2023-11-19  发布在  其他
关注(0)|答案(4)|浏览(138)

我试图通过遵循this来编译gcc-4.8.3用于LFS。
当使用make时,我得到以下错误:

checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build'
make: *** [all] Error 2

字符串
配置选项:

../configure                                       \
    --target=$LFS_TGT                              \
    --prefix=/tools                                \
    --with-glibc-version=2.11                      \
    --with-sysroot=$LFS                            \
    --with-newlib                                  \
    --without-headers                              \
    --with-local-prefix=/tools                     \
    --with-native-system-header-dir=/tools/include \
    --disable-nls                                  \
    --disable-shared                               \
    --disable-multilib                             \
    --disable-decimal-float                        \
    --disable-threads                              \
    --disable-libatomic                            \
    --disable-libgomp                              \
    --disable-libmpx                               \
    --disable-libquadmath                          \
    --disable-libssp                               \
    --disable-libvtv                               \
    --disable-libstdcxx                            \
    --enable-languages=c,c++


其中$LFS_TGTx86_64-lfs-linux-gnu
config.logPasteBin上。
最后几行输出:

checking if /mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/xgcc -B/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include    supports -fno-rtti -fno-exceptions... no
checking for /mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/xgcc -B/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include    option to produce PIC... -fPIC -DPIC
checking if /mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/xgcc -B/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include    PIC flag -fPIC -DPIC works... yes
checking if /mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/xgcc -B/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include    static flag -static works... no
checking if /mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/xgcc -B/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include    supports -c -o file.o... yes
checking if /mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/xgcc -B/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include    supports -c -o file.o... (cached) yes
checking whether the /mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/xgcc -B/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include    linker (/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build/./gcc/collect-ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/mnt/c/Users/admin/Desktop/Projects/AssaultArchitecture/sources/gcc-4.8.3/build'
make: *** [all] Error 2

wfauudbj

wfauudbj1#

如果你在一台x86_64机器上构建它,并将x86_64作为目标,那么你实际上并不是在构建一个交叉编译器。
你似乎正在构建一个 *isolated stage1编译器 *,所以你必须添加--disable-bootstrap标志。如果你的构建目标平台不是本地平台(交叉编译器),GCC默认禁用引导。

fxnxkyjh

fxnxkyjh2#

此处涵盖了完全相同的问题:
https://gcc.gnu.org/ml/gcc-help/2012-07/msg00018.html
建议可能缺少适当的glibc(目标为x86_64-lfs-linux-gnu),需要安装。
HTH的。

zphenhs4

zphenhs43#

您需要检查config.log以找出configure尝试运行的命令;例如:

configure:9604: checking whether the x86_64-lfs-linux-gnu-gcc linker (/usr/x86_64-lfs-linux-gnu/bin/ld -m elf_x86_64
) supports shared libraries
configure:10684: result: no
configure:10929: checking dynamic linker characteristics
configure:11375: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

字符串
在这种情况下,手动运行/usr/x86_64-lfs-linux-gnu/bin/ld -m elf_x86_64。它可能会产生如下结果:

/usr/x86_64-lfs-linux-gnu/bin/ld: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory


所以在这种情况下,你会知道libz.so.1找不到。

wgmfuz8q

wgmfuz8q4#

如果你正在构建LFS,你应该检查你正在使用的用户,并确保它不是root。

相关问题