在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. PHP可变长函数方法介绍

    1.三个重要函数 func_num_args()  返回实参个数 func_get_arg(i)    返回某个实参的值       func_get_args()        以数组的形式返回实参 ...

  2. BZOJ3888 [Usaco2015 Jan]Stampede

    我们只要把每头牛开始遮挡视线和结束遮挡视线的时间点都搞出来就好= = 再按照y轴排序...然后变成线段覆盖了..线段树搞一下就好了? /******************************** ...

  3. 简单模拟QQ界面框架。

    package com.lixu.qqjiemian; import java.util.Timer; import java.util.TimerTask; import android.app.A ...

  4. bzoj 2282: [Sdoi2011]消防

    #include<cstdio> #include<cstring> #include<iostream> #define N 600000 using names ...

  5. DataGridView复选框实现全选功能,并取被选中的某行某列的值(三)

    目标: 一.选中全选这个复选框,会选中第一列所有的复选框 拉过来一个CheckBox控件(CheckBox1)覆盖在第一列的标题上,文本值:全选 方法:双击上面拉的CheckBox控件,进入其事件 p ...

  6. 最大公约数——Program G

    最大公约数 Description There is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit ...

  7. DotNetBar v14.0.0.3 Fully Cracked

    更新信息: http://www.devcomponents.com/customeronly/releasenotes.asp?p=dnbwf&v=14.0.0.3 如果遇到破解问题可以与我 ...

  8. Word2013可以写博客

    步骤如下http://www.cnblogs.com/guyichang/p/4629211.html

  9. 【温故知新C/C++/opencv】取址符&||cv::groupRectangles||引用与值传递

    cv::groupRectangles void groupRectangles(vector<Rect>& rectList, int groupThreshold, doubl ...

  10. [安卓]softap

    http://www.cnblogs.com/javawebsoa/archive/2013/05/29/3106758.html