libtool的一个问题

| No Comments
    libtools生成so的时候,发现在rhel5.3和fedora15下,结果竟然不一样,Makefile.am这样写道:
dydir    = $(bindir)/pwd
dy_PROGRAMS    = libdy.so
libdy_so_SOURCES = dy.cpp dy.h
libdy_so_CXXFLAGS = -fPIC
libdy_so_LDFLAGS = -shared -fpic

在fedora15下,这里面dy.cpp里面必须包括main函数,否则编译不过,而rhel5.3则没有这个问题,查了过程发现fedora15和rhel5.3的编译过程分别如下所示:
fedora15:
/bin/sh ../../../libtool --tag=CXX   --mode=link g++ -fPIC -g -O2 -shared -fpic  -o libdy.so libdy_so-dy.o 
libtool: link: g++ -fPIC -g -O2 -fpic -o libdy.so libdy_so-dy.o
/usr/lib/gcc/i686-redhat-linux/4.6.0/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status

rhel5.3
/bin/sh ../../../libtool --tag=CXX --mode=link g++  -g -O2   -o libdy.so -shared -fpic libdy_so-dy.o 

g++ -g -O2 -o libdy.so -shared -fpic libdy_so-dy.o
应该是libtool在fedora15上丢失了-shared参数所致,fedora15的libtool版本为2.4,而rhel5.3的libtool版本为1.5.22。

Leave a comment

Archives

Pages

Powered by Movable Type 5.2.2

December 2012

Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

Recent Assets

  • dish_st4.png
  • dish_m5.png
  • dish_3.png
  • dish_two.png
  • dish_6.png
  • dish_1.png.png
  • 照片1028 105.jpg
  • 照片1028 088.jpg
  • 照片1028 084.jpg
  • 照片1028 081.jpg
Creative Commons License
This blog is licensed under a Creative Commons License.

About this Entry

This page contains a single entry by Cnangel published on August 9, 2011 8:42 PM.

郁闷的SSH was the previous entry in this blog.

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

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