交叉围栏GCC:在检查动态链接器特征时,在GCC_NO_EXECUTABLES之后不允许链接测试

Crosscompiling GCC: Link tests are not allowed after GCC_NO_EXECUTABLES when checking dynamic linker characteristics

本文关键字:GCC 链接 NO EXECUTABLES 之后 测试 不允许 特征 检查 动态      更新时间:2023-10-16

我正在尝试通过此操作来编译LFS的gcc-4.8.3

使用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

pastebin上的 config.log

最后几行输出行:

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

如果您在x86_64机器上构建了此功能,并且将x86_64作为目标,则实际上并没有构建交叉编译器。
您似乎正在构建隔离的stage1编译器,因此您必须添加--disable-bootstrap标志。GCC默认情况下,如果您的构建目标平台不是本机平台(交叉编译器)。

完全相同的问题:

https://gcc.gnu.org/ml/gcc-help/2012-07/msg00018.html

建议可能缺少适当的glibc(目标x86_64-lfs-linux-gnu),需要安装。

hth。

如果要构建LFS,则应检查使用的用户,并确保它不是根。

您需要检查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