zoukankan      html  css  js  c++  java
  • 隐藏符号 __dso_handle 问题

    这几天要给项目做移植,重写了下Makfile。项目原是使用autoconf配置的,但在新环境下对autoconf的支持不好。

    Makefile编写基本按autoconf生成的Makefile来的,编译选项等等,但是在使用动态库时报了下面的错误:

    /usr/bin/ld: client: hidden symbol `__dso_handle' in /usr/lib/gcc/i486-linux-gnu/4.4.3/crtbegin.o is referenced by DSO
    /usr/bin/ld: final link failed: Nonrepresentable section on output

    网上搜到的结果都是是gcc/g++的binUtils的问题,编译动态库需要使用gcc/g++ -shared而不能直接使用ld,而我的Makefile就是这么做的,结果还是出现了这个问题.

    逐步取得编译连接选项,发现取得-nostdlib后即可成功编译,看来是这个的问题.

    看了下gcc的文档,使用该选项是是不是用系统启动文件(不知道怎么翻译)的,这就说明除非你在代码里自己处理crt启动问题,否则不要用这个选项:

    -nostdlib
    Do not use the standard system startup files or libraries when linking. No startup files and only the libraries you specify are passed to the linker, and options specifying linkage of the system libraries, such as -static-libgcc or -shared-libgcc, are ignored.
  • 相关阅读:
    手机测试移动端项目
    事件绑定与事件委托
    jq中attr()和prop() 属性的区别
    jq 加载的几种方法
    $(document).height 与$(window).height的区别
    js动画之缓冲运动
    js动画之简单运动二
    js动画之简单运动一
    css浏览器窗口大小
    编程每一天
  • 原文地址:https://www.cnblogs.com/D3Hunter/p/3346805.html
Copyright © 2011-2022 走看看