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

news/2024/7/4 11:22:08

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/.之后,我再也沒有遇到過這個問題。有點混亂,但對我來說,它解決了問題。


http://www.niftyadmin.cn/n/4390363.html

相关文章

python yield的解释

链接地址: http://pyzh.readthedocs.io/en/latest/the-python-yield-keyword-explained.html https://www.jianshu.com/p/d09778f4e055

springsecurity中session失效后怎样处理_结合Spring Security进行web应用会话安全管理

在本文中,将为大家说明如何结合Spring Security 和Spring Session管理web应用的会话。一、Spring Security创建使用session的方法Spring Security提供4种方式精确的控制会话的创建:always:如果当前请求没有session存在,Spring Sec…

linux cat最新,linux cat

Linux命令总结—cat命令(1)命令功能cat命令用于将多个文件连接,并将结果通过标准输出显示出来。(2)命令语法cat(选项) (参数)(3)选项说明-n或-number:由1开始对所有输出的行数编号;-b或—number-nonblank:和-n相似,只不…

(四)mybatis缓存、事务、插件的基本知识

mybatis缓存、事务、插件的基础 一、缓存 (一)一级缓存与二级缓存 一级缓存 为了获得更好的性能,最重要的就是一级缓存。每个session对象维持一个一级缓存,session对象创建时缓存创建,session对象释放时缓存销毁。 缓存…

c语言typedef作用,C语言typedef的使用

C语言typedef的使用typedef 关键字能帮助你简化复杂的定义并让你的代码简洁可靠,当然,可靠这一点我还是持保留态度,因人而异吧。具体是如何使用呢?以下仅供参考!具体方法如下:C 语言提供 typedef 关键字&am…

mysql时间戳14小时_SpringBoot时间戳与MySql数据库记录相差14小时排错

项目中遇到存储的时间戳与真实时间相差14小时的现象,以下为解决步骤.问题CREATE TABLE incident (id int(11) NOT NULL AUTO_INCREMENT,created_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,recovery_time timestamp NULL DEFAULT NULL,PRIMARY KEY (id)) ENGINEInnoDB…

sql插入日期_SQL入门基础-了解SQL

通过上述的四个步骤,来进入sql的学习。什么是数据库?什么是SQL?数据库是用来存储数据的工具。那和excel有什么区别呢?excel像一个移动硬盘,而数据库像一个网盘,可供多人在上面操作。我们接下来聊的数据库主要是关系数…

输出英文字母的后继字母 c语言,Java 【打印俄文的英文字母】

俄文的的字符可以用 A 到 Я 。public class main {public static void main(String args[]) {char S А, C Я;System.out.println("俄文字母共有:" ((int) C - (int) S 1) "个");for (char i S; i < C; i) {System.out.print(i " ")…