在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. Steam和Byte[]之间进行输换

    一. 二进制转换成图片 MemoryStream ms = new MemoryStream(bytes); ms.Position = 0; Image img = Image.FromStream ...

  2. 2016年5月19日php,mysql配置

    1.php配置 1. 配置disable_functiondisable_functions = eval,assert,popen,passthru,escapeshellarg,escapeshe ...

  3. curl,chkconfig

    1. Linux系统服务管理 工具ntsysv 类似图形界面管理工具,如果没有该命令使用 yum install -y ntsysv 安装 常用服务:crond, iptables, network, ...

  4. Android的SwipeToDismiss第三方开源框架模拟QQ对话列表侧滑删除,置顶,将头像图片圆形化处理。

      <Android SwipeToDismiss:左右滑动删除ListView条目Item> Android的SwipeToDismiss是github上一个第三方开源框架(github ...

  5. ComboBox绑定

    this.ComboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.ComboBox1.AutoCompleteSource ...

  6. SQL is null函数

    Sql ISNULL() 函数 使用指定的替换值替换 NULL.   语法 ISNULL ( check_expression , replacement_value )   参数 check_exp ...

  7. 再谈IT行业工程师文化

    为什么是再呢?因为“工程师文化”这种说法网上很多,各种理解,各种版 本,我只是简单说说我的认识,说的不对的地方敬请各位大牛,高手,高高手多多指教,我本身也是个技术人员,不过只是技术不怎么样而已.写这个 ...

  8. bzoj 1965: [Ahoi2005]SHUFFLE 洗牌

    #include<cstdio> #include<cstring> #include<iostream> #define ll long long using n ...

  9. Rsync+sersync文件实时同步

    一.为什么要用Rsync+sersync架构1.sersync是基于Inotify开发的,类似于Inotify-tools的工具2.sersync可以记录下被监听目录中发生变化的(包括增加.删除.修改 ...

  10. limit 百万级数据分页优化方法

    mysql教程 这个数据库教程绝对是适合dba级的高手去玩的,一般做一点1万 篇新闻的小型系统怎么写都可以,用xx框架可以实现快速开发.可是数据量到了10万,百万至千万,他的性能还能那么高吗? 一点小 ...