相关疑难解决方法(0)

编译问题:找不到crt1.o

我有一个虚拟的Debian系统,我用它来开发.

今天我想试试llvm/clang.

安装clang后,我无法编译我的旧c项目(使用gcc).这是错误:

...
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status
...
Run Code Online (Sandbox Code Playgroud)

我卸载了clang,它仍然无法正常工作.

有谁知道如何解决这个问题?

gcc clang ld

106
推荐指数
9
解决办法
22万
查看次数

xcode项目出错:ld:找不到-lcrt1.10.6.o的库

刚刚升级到Snow Leopard,安装了Xcode 3.2,然后安装了适用于SL的iPhone SDK 3.

在一个项目中,我现在在构建时遇到以下错误:

ld:未找到库 -lcrt1.10.6.o

我在网上搜索过,但没有找到任何帮助.

iphone xcode compiler-errors osx-snow-leopard

26
推荐指数
4
解决办法
7万
查看次数

如何使用autotools在64位平台上创建32位共享库

我正在使用autotools构建我的系统,主要由一个库组成.在64位Red Hat平台上,我需要能够生成一个能够在32位Red Hat平台上运行的库.

当我添加-m32到编译行时,一切都可以正常生成一个static(.a)库,但是一旦我尝试创建一个共享库,我就会得到这样的错误:

/usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crti.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbeginS.o' is incompatible with i386 output  
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbeginS.o: In function `__do_global_dtors_aux':  
crtstuff.c:(.text+0x29): undefined reference to `__DTOR_END__'  
collect2: ld returned 1 exit status' 
Run Code Online (Sandbox Code Playgroud)

我可以看到的问题是,它包括64位对象文件出来的/ usr/lib64下,而不是正确的32位的了/ usr/lib目录的(他们有正常的),但我无法弄清楚如何要解决这个问题.

autotools shared-libraries

17
推荐指数
1
解决办法
2万
查看次数

Linux:控制`ld`搜索.o目标文件的位置?

好吧,情况就是这样:我正在尝试使用一些较旧的软件:在Ubuntu Lucid上工作正常,在Natty上失败.

所以,我strace喋喋不休,事实证明这个软件调用ld,并ld最终失败:

.../ld: crt1.o: No such file: No such file or directory
Run Code Online (Sandbox Code Playgroud)

...是的,旧的crti.o文件丢失错误:)但是,我想用更一般的术语提问...

问题是,这是"独立"(较旧)ld,当我跑步时.../ld -verbose | less,我得到:

...
SEARCH_DIR("/usr/local/lib"); 
SEARCH_DIR("/lib"); 
SEARCH_DIR("/usr/lib");
...
Run Code Online (Sandbox Code Playgroud)

现在,问题在于:

  • 在Lucid,crt1.o是在/usr/lib/crt1.o
  • 在纳蒂,crt1.o是在/usr/lib/i386-linux-gnu/crt1.o

...所以,毫无疑问,为什么crt1.o无法找到,我想.看来,我所要做的,就是告诉ld寻找crt1.o在/usr/lib/i386-linux-gnu,但我怎么做呢?

我以为我可以使用该-L选项,但是man ld说:

to link a file "hello.o":

    ld -o <output> /lib/crt0.o hello.o -lc

  This tells ld to produce a file called output as …
Run Code Online (Sandbox Code Playgroud)

linux search path object ld

6
推荐指数
2
解决办法
1万
查看次数

在Ubuntu 14.04上构建linuxbrew(homebrew)独立版本

主要问题

我正在尝试在Ubuntu 14.04.3 LTS上构建linuxbrew独立安装,但原始链接中的脚本目前已损坏.我理想的答案是一个可以一次性正确设置的脚本.我已经改进了脚本以减少打嗝运行.

目前修复脚本的进展

我不能让过去一个crti.o通过linuxbrew作为独立设置的一部分编译GCC时错误.但是,我找到了解释问题的一些资源:

我搜索了文件,它就在那里!

find -name crti.o
./.linuxbrew/lib/crti.o
./.linuxbrew/Cellar/glibc/2.19/lib/crti.o
Run Code Online (Sandbox Code Playgroud)

我目前正在处理以下编译器错误crtn.o:

/home/hbr/.linuxbrew/Cellar/binutils/2.25.1/x86_64-unknown-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/home/hbr/.linuxbrew/Cellar/binutils/2.25.1/x86_64-unknown-linux-gnu/bin/ld: cannot find -lc
/home/hbr/.linuxbrew/Cellar/binutils/2.25.1/x86_64-unknown-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/tmp/gcc20150929-3726-hif3of/gcc-5.2.0/build/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/tmp/gcc20150929-3726-hif3of/gcc-5.2.0/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: …
Run Code Online (Sandbox Code Playgroud)

installation ubuntu homebrew linuxbrew

6
推荐指数
1
解决办法
1236
查看次数

交叉编译时缺少crt1和crti

我正在尝试构建基于GCC4.5和newlib的交叉编译工具链,并启用了黄金和链接时优化.GCC编译正常,但它没有生成crt1.o或crti.o文件.因此,当我尝试使用编译器构建Newlib时,它会抱怨消息:

ld: error: cannot open crti.o: No such file or directory
ld: error: cannot open crtn.o: No such file or directory
ld: error: cannot find -lc
Run Code Online (Sandbox Code Playgroud)

在安装GCC4.5的目录中搜索名为crt*的文件时,得到以下结果:

find ../../../tooltarget/ -name "crt*" -print #(result modified to consume less space)
crtprec80.o, crtend.o, crtfastmath.o, crtbegin.o, crtendS.o, crtprec32.o, crtbeginS.o, crtbeginT.o, crtprec64.o
Run Code Online (Sandbox Code Playgroud)

从GCC规范来看,似乎gcc需要crtbegin.o和crti.o文件,但只有其中一个可用.

*startfile:                                       
%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o
%s;:crtbegin.o%s} 
Run Code Online (Sandbox Code Playgroud)

以下是我在编译GCC时使用的标志:

--prefix=${TTP}/usr         --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu  --target=x86_64-awn-linux-gnu
--with-gmp=${TTP}/usr       --with-mpc=${TTP}/usr
--with-mpfr=${TTP}/usr      --with-libelf=${TTP}/usr               
--enable-languages=c        --enable-lto                           
--disable-nls               --disable-shared                       
--disable-multilib          --disable-decimal-float                
--disable-libmudflap        --disable-libssp                       
--disable-libgomp           --disable-threads                      
--without-headers           --with-newlib                          
--with-build-sysroot=${TTP} --with-build-time-tools=${TTP}/usr/bin 
Run Code Online (Sandbox Code Playgroud)

我确定这是否是由于我错误地配置了GCC,或者"东西"根本不起作用,或者文件crti.o应该来自其他地方.

提前致谢

艾伦W.尼尔森

linker gcc cross-compiling

5
推荐指数
1
解决办法
3247
查看次数

命令行库构建因链接器错误而失败

我正在使用脚本在Xcode 4.3中使用Xcode 4.3构建GraphViz当前版本(2012年6月7日)时发现库未找到错误.我可能犯了错误,更新构建脚本来自其他人对Xcode4.3的新位置和Applications文件夹中的开发人员工具的成功配方.

ld: library not found for -lcrt1.10.6.o

(从内存中执行此操作,因此CRT lib上的确切数字可能是错误的)

我也有点迷失了如何将它合并到IDE中的Xcode构建中.我是一个非常有经验的程序员,但有时很难找到Xcode 4.(几十年的Visual Studio等).

我复制了之前这个问题的说明并进行了改编

#!/bin/sh
# For iPhoneOS, see http://clang.llvm.org/ for options
export DEV_iOS=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
# was /Developer/Platforms/iPhoneOS.platform/Developer
export SDK_iOS=${DEV_iOS}/SDKs/iPhoneOS5.1.sdk
export COMPILER_iOS=${DEV_iOS}/usr/bin
export CC=${COMPILER_iOS}/clang
export CXX=${COMPILER_iOS}/clang++
export LDFLAGS="-arch armv7 -pipe -Os -gdwarf-2 -mthumb -isysroot ${SDK_iOS}"
export CFLAGS="${LDFLAGS}"
export OBJCFLAGS="${LDFLAGS}"
export CXXFLAGS="${LDFLAGS} -fvisibility-inlines-hidden"
export LD=${COMPILER_iOS}/ld
export CPP=${COMPILER_iOS}/clang
export AR=${COMPILER_iOS}/ar
export AS=${COMPILER_iOS}/as
export NM=${COMPILER_iOS}/nm
export CXXCPP="${COMPILER_iOS}/clang++"
export OBJC=${COMPILER_iOS}/clang
export RANLIB=${COMPILER_iOS}/ranlib

./configure \
--build=arm-apple-darwin11 \
--host=arm-apple-darwin11 \
--disable-dependency-tracking \ …
Run Code Online (Sandbox Code Playgroud)

graphviz ios5 xcode4.3

5
推荐指数
1
解决办法
2520
查看次数