在64位centos6上编译32位的汇编程序,如果程序中使用了C库,比如printf。因为是编译32位的目标程序,所以使用gcc编译的时候需要加上-m32选项,但是如果编译的话会报错,以print.s程序为例子

 .code32
.section .data
output:
.asciz "hello gas '%d'" .section .text
.globl main
main:
pushl $
pushl $output
call printf
addl $, %esp pushl $
call exit

  使用gcc -g -m32 -o print print.s编译的时候,会报错:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /lib/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s

  从编译错误基本可以看出来是因为没有找到gcc_s,在没有找到gcc_s之前的错误意思是系统中有gcc_s lib库,不过不匹配! 通过查询之后发现是因为64位系统使用的是64位的gcc_s库,我们目标程序是32位的,所以需要32位的gcc_s,经过一番查找之后,在http://pkgs.org/centos-6/centos-i386/libgcc-4.4.7-11.el6.i686.rpm.html目录下找到了适合版本的gcc_s 32位库,然后使用rpm安装这个包。

  然后再编译程序,使用之前的指令,程序正常运行

cannot find -lgcc_s的更多相关文章

  1. boost静态链接的问题 -lgcc_s

    在使用gcc/g++ 编译程序时我们希望指向一些库是使用静态的链接方式. 另外的一些是动态的方式. 我以boost 为例. 如果我们要使用静态库则是这样的: # g++ main.cpp -lpthr ...

  2. Mac: ld: library not found for -lgcc_s.10.4

    Mac: ld: library not found for -lgcc_s.10.4   Checking for cc... ld: library not found for -lgcc_s.1 ...

  3. /usr/bin/ld: cannot find -lgcc_s 问题解决小记

    /usr/bin/ld: cannot find -lgcc_s 问题解决小记 博客分类: Linux/Ubuntu 由于之前用wubi装的ubuntu并且只给了它10G的硬盘空间,随着学习的深入这种 ...

  4. nodejs错误:ld: library not found for -lgcc_s.10.5 clang: error: linker command failed with exit code 1 (use -v to see invocation)

    解决方案: $ cd /usr/local/lib $ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib 参考链接

  5. RHEL6 64位系统安装ORACLE 10g 64bit 数据库

    记得去年4月份的时候,为公司部署测试环境和UAT环境时,在红帽RHEL6 64位系统安装ORACLE 10g 64位数据库时遇到了许多小问题,当时匆匆忙忙也没记录一下这些问题,前几天在虚拟机安装ORA ...

  6. Android编译环境折腾记

    题记:感觉是时候写点什么了=_=! 第一次安装了ubuntu14.04.5,官网下载的iso,官网下的jar,编译android4.x需要安装jdk6,更高的版本会有问题,baidu到很多搭建环境的步 ...

  7. libc++

    今天测试最新的微信iOS SDK, 仅仅是建了一个空的工程,把sdk加进去运行,就报了以下错误: Undefined symbols for architecture x86_64: "op ...

  8. libgcc_s.so.1 must be installed for pthread_cancel to work

    首先 whereis 看一下 有没有 libgcc_s.so.1 有的话 记得gcc --o xxx xxx.c -lpthread -lgcc_s

  9. [jv-convert] Error 1,[all-recursive] Error 1

    g++4.6编译是报错: make profiledbootstrap /var/tmp/gcc4/gcc-4.0.1/sparc-sun-solaris2.8/gcc/gcj -B/var/tmp/ ...

随机推荐

  1. C# + winserver2008 openfiledialog 写入 textbox1 中的 路径不正确

    System.IO.Path.GetFullPath(openFileDialog1.FileName);//绝对路径 System.IO.Path.GetExtension(openFileDial ...

  2. bash: sqlplus: command not found 解决方法

    在oracle用户下输入:sqlplus 抛出bash: sqlplus: command not found 解决办法: 在root用户下输入如下命令: ln -s $ORACLE_HOME/bin ...

  3. PHP+mysql常用类库

    <?php /** * @title: Ekcms mysql类库 * @version: 1.0 * @author: perry <perry@1kyou.com> * @pub ...

  4. 绑定本地Service并与之通信-----之二

    import android.os.Bundle;import android.os.IBinder;import android.app.Activity;import android.app.Se ...

  5. plsql记住登录密码

    登录plsql:tools(工具)->preference(首选项)->Login history(登录历史):选择"Store with password"(带口令存 ...

  6. jquery删除原事件

    $(document).ready(function(){ var fn = $("#exportCsv").attr( "onclick" ); // 获取原 ...

  7. php file_get_contents curl发送cookie,使用代理

    $auth = base64_encode('LOGIN:PASSWORD');//LOGIN:PASSWORD 这里是你的账户名及密码 $aContext = array( 'http' => ...

  8. visual studio 2013连接Oracle 11g并获取数据:(二:实现)

    1.VS中新建一个winform窗体 (1)一个按钮 (2)一个数据表格视图(在里面显示得到的数据表) 2.双击按钮进入代码 (1)添加 using System.Data.OracleClient; ...

  9. php解压zip文件

    <?php header("Content-type:text/html;charset=utf-8"); function get_zip_originalsize($fi ...

  10. mysql 远程连接

    4.现在如果用你电脑上的终端进行MySQL连接时,有可能出现如下错误: MySQL远程连接ERROR 2003 (HY000):Can't connect to MySQL server on'XXX ...