找不到linux32位的,找不到crtn。o,連接64位系統上的32位代碼

I'm attempting to assemble some 32-bit code using NASM and GCC on a 64-bit system. I use the following two commands

我正在嘗試在64位系統上使用NASM和GCC來組裝一些32位的代碼。我使用以下兩個命令

nasm -f elf32 -g -F stabs coc.asm

gcc -m32 -o coc coc.o

NASM appears to do fine, but LD complains:

NASM似乎做得很好,但是LD抱怨道:

/usr/bin/ld: cannot find crt1.o: No such file or directory

/usr/bin/ld: cannot find crti.o: No such file or directory

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libgcc.a when searching for -lgcc

/usr/bin/ld: cannot find -lgcc

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libgcc_s.so when searching for -lgcc_s

/usr/bin/ld: cannot find -lgcc_s

/usr/bin/ld: cannot find -lc

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libgcc.a when searching for -lgcc

/usr/bin/ld: cannot find -lgcc

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6.1/libgcc_s.so when searching for -lgcc_s

/usr/bin/ld: cannot find -lgcc_s

/usr/bin/ld: cannot find crtn.o: No such file or directory

collect2: ld returned 1 exit status

I'm running Ubuntu 11.10, and I checked and I'm pretty sure libc is installed.

我正在運行Ubuntu 11.10,我檢查了一下,我很確定libc已經安裝好了。

3 个解决方案

#1

10

You are not assembling, but linking an executable, which needs OS startup files.

您不是在組裝,而是鏈接可執行文件,這需要操作系統啟動文件。

It seems you don't have gcc-*-multilib installed, which contains the necessary files: http://packages.ubuntu.com/oneiric/amd64/gcc-4.6-multilib/filelist

似乎您沒有安裝gcc-*-multilib,它包含必要的文件:http://packages.ubuntu.com/oneiric/amd64/gcc-4.6-multilib/filelist

#2

2

You need to install gcc-multilib to get the proper 32-Bit lib

您需要安裝gcc-multilib以獲得適當的32位庫

#3

0

I had a very similar problem on ubuntu 11.10. See my question on SO about this. What helped for me, was linking the crt*.o to /lib/. After that I never had other problems with this issue. A bit more of a cludge, but for me it solved the problems.

我在ubuntu 11.10上遇到了一個非常相似的問題。看看我的問題。對我有幫助的是連接crt*。o /lib/.之后,我再也沒有遇到過這個問題。有點混亂,但對我來說,它解決了問題。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值