关于高版本的libtool v2.4的问题

因为生成so的问题,发现libtool v2.4生成代码时:
libtool --debug --tag=CXX --mode=link g++ -fPIC -g -O2 -g -Wall -D_DEBUG -shared -fpic -o libsotest.so libsotest_so-testso.o -lpthread -ldl -lcppunit
结果为:
g++ -fPIC -g -O2 -g -Wall -D_DEBUG -fpic -o libsotest.so libsotest_so-testso.o  -lpthread -ldl -lcppunit
而期望的结果应该是:
g++ -fPIC -g -O2 -g -Wall -D_DEBUG -shared -fpic -o libsotest.so libsotest_so-testso.o  -lpthread -ldl -lcppunit
低版本的libtool v1.5.22则没有这个问题,于是查找原因,经过分析,发现新版本的libtool对-shared选项有二处地方的变动,一处为func_mode_compile函数,主要是针对-shared的优化,
 2429     -shared | -static | -prefer-pic | -prefer-non-pic)
 2430       later+=" $arg"
 2431       continue
 2432       ;;
另外,在函数func_mode_link中
 6171       -shared)
 6172     # The effects of -shared are defined in a previous loop.
 6173     continue
 6174     ;;
如果得到上面的期望结果,则注释这条语句即可。

详细的问题描述见:http://my.huhoo.net/archives/2011/08/libtool.html

Monthly Archives

Pages

Powered by Movable Type 7.7.2

About this Entry

This page contains a single entry by Cnangel published on September 22, 2011 11:30 PM.

新一代 Linux 文件系统 btrfs 简介 was the previous entry in this blog.

关于财付通接口在Discuz7.2版本无法使用的问题 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.