ÎÒÏëÉú³ÉsoÎļþ
ÎÒÕâ±ßµÄ˼·ÊÇʹÓÃautoconfºÍautomake×Ô¶¯Éú³Émakefile£¬
makefile.amÖÐÎÒÊÇÕâÑùдµÄ£¨ÓõÄÊÇlibtool£©
AUTOMAKE_OPTIONS = foreign
lib_LTLIBRARIES = libtest.la
libtest_la_SOURCES = test.c
½á¹ûlibtest.laµÄÈ·ÊÇÉú³ÉÁË£¬µ«ÕÒ²»µ½soÎļþ
ÎÒÓиöÎÊÌ⣬ÎÒÐèÒªÔõôÐ޸IJÅÄÜÉú³Élibtest.soÎļþ
¸÷λǰ±²¶à¶àÖ¸½Ì°¡
СµÜÓÐÀñÁË


kilisky ÓÚ 2008-05-26 12:29:18·¢±í:
ÄãûÓа²×°¿â£¬µ±È»¿´²»µ½.soÁË£¬°²×°Á˲ſÉÒÔ¿´µÄµ½µÄ¡£
make DESTDIR=°²×°Ä¿Â¼ install
½øÈ밲װĿ¼Àï¿´lib£¬¾ÍÓÐÁË.
»Æ¸»Ç¿ ÓÚ 2008-05-14 18:24:13·¢±í:
²ÅÃ÷°×ÄãµÄÒâ˼£¬Ñо¿Ò»ÏÂÕâÀïÃæµÄ
http://www.gnu.org/software/libtool/manual/automake/Hello-World.html#Hello-World
http://www.gnu.org/software/libtool/manual/html_node/index.html
fuqiang@fuqiang-laptop:~$ libtool --help
Usage: libtool [OPTION]... [MODE-ARG]...
Provide generalized library-building support services.
--config show all configuration variables
--debug enable verbose shell tracing
-n, --dry-run display commands without modifying any files
--features display basic configuration information and exit
--finish same as `--mode=finish'
--help display this help message and exit
--mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
--quiet same as `--silent'
--silent don't print informational messages
--tag=TAG use configuration variables from tag TAG
--version print version information
MODE must be one of the following:
clean remove files from the build directory
compile compile a source file into a libtool object
execute automatically set library path, then run a program
finish complete the installation of libtool libraries
install install libraries or executables
link create a library or an executable
uninstall remove libraries from an installed directory
MODE-ARGS vary depending on the MODE. Try `libtool --help --mode=MODE' for
a more detailed description of MODE.
Report bugs to <bug-libtool@gnu.org>.
.o : ±àÒëµÄÄ¿±êÎļþ
.a : ¾²Ì¬¿â£¬Æäʵ¾ÍÊǰÑÈô¸ÉoÎļþ´òÁ˸ö°ü
.so : ¶¯Ì¬Á´½Ó¿â£¨¹²Ïí¿â£©
.lo : ʹÓÃlibtool±àÒë³öµÄÄ¿±êÎļþ£¬Æäʵ¾ÍÊÇÔÚoÎļþÖÐÌí¼ÓÁËһЩÐÅÏ¢
.la : ʹÓÃlibtool±àÒë³öµÄ¿âÎļþ£¬ÆäʵÊǸöÎı¾Îļþ£¬¼Ç¼ͬÃû¶¯Ì¬¿âºÍ¾²Ì¬¿âµÄÏà¹ØÐÅÏ¢
laÖ»ÓÐÔÚÓÃlibtool±àÒëÓ¦ÓóÌÐò»ò¿âʱ²ÅÓ㬼´¿ª·¢ÕßÖ»Ö¸Ã÷laÎļþ£¬ÖÁÓÚ×îÖÕÁ´½Óa»¹ÊÇsoÓÉlibtool¾ö¶¨£¬²»Ê¹ÓÃlibtoolµÄС³ÌÐòÓò»ÉÏla, soÊÇÖ±½ÓÓÃÌØÊâ±àÒë²ÎÊý±àÒë³öÀ´µÄ,×¢Òâ·¾¶µÄÎÊÌâ.
ÆäËüʵÏÖ·½·¨£ºhttp://linux.chinaunix.net/bbs/thread-959710-1-1.html
[ ±¾Ìû×îºóÓÉ »Æ¸»Ç¿ ÓÚ 2008-5-14 19:28 ±à¼ ]
muyizhu ÓÚ 2008-05-14 14:19:04·¢±í:
×Ô¼º¶¥Ò»ÏÂ
muyizhu ÓÚ 2008-05-14 13:28:11·¢±í:
ллǿ¸çÁË
muyizhu ÓÚ 2008-05-14 13:26:48·¢±í:
»¹ÊDz»Ðа¡£¬²Î¿¼µÄ¼ÛÖµ²»´ó
ÎÒÕâ±ßÎļþ¿ÉÄÜ»áºÜ¶à£¬ËùÒÔ×îºÃÊÇÓÃlibtool
ÄÇÒÔÏÂÊÇÎҵĹý³Ì£º£¨¼ÙÉèÖ»ÓÐÒ»¸öÎļþadd.c·ÅÔÚtestÎļþ¼ÐÏ£¬ÏëÉú³ÉÒ»¸ölibtest.so£©
**********add.c********************
#include "stdlib.h"
int add(int num1,int num2)
{
return (int)(num1+num2);
}
************************************
1. ½øÈëµ½testÏÂÖ´ÐÐautoscanÉú³Éconfigure.scan,¸ÄÎļþÃûΪconfigure.in£¬²¢×÷Êʵ±ÐÞ¸Ä
2.Ö´ÐÐaclocalÉú³Éaclocal.m4
3.Ö´ÐÐautoheader
4. ±àдMakefile.am£¨Ê¹ÓÃlibtool£©
**************Makefile.am**************
AUTOMAKE_OPTIONS = foreign
lib_LTLIBRARIES = libtest.la
libtest_la_SOURCES = add.c
*****************************************
5.Ö´ÐÐautomake --add-missing
6. autoconf
7. ./configure
8. make
ÉÏÃæ¾ÍÊÇÒ»°ã×Ô¶¯Éú³ÉmakefileµÄ¹ý³Ì
ÎÒ¿´ÍøÉÏÓÐЩÈ˾ÍÊÇÕâô½éÉÜͨ¹ýlibtoolÉú³Élibtest.soµÄ
¿ÉÎÒmakeÖ®ºólibtest.laÊÇÉú³ÉÁË£¬¾ÍÊÇûÕÒµ½libtest.soÕâ¸öÎļþ
ÎÒÏëÎʵÄÊÇÔõôÉú³Élibtest.so
ÊDz»ÊÇmakefile.am»¹ÐèÒª×öʲôÐÞ¸Ä
»Æ¸»Ç¿ ÓÚ 2008-05-14 12:43:57·¢±í:
Ñо¿Ò»ÏÂÏÂÃæµÄÄã¾ÍÃ÷°×ÁË,×îºÃ°ÑËùÓеÄϸ½ÚÄÚÈÝÌù³öÀ´£¬ÒÔ±ã´ó¼Ò¹²Í¬Ïë°ì·¨£¬·ñÔòÖ»ÓÐÄã×ÔÒѶ¯ÊÖ×÷ÁË.
http://www.linuxdiyf.com/bbs/viewthread.php?tid=90166&page=1&extra=#pid462250
http://hi.baidu.com/lieyu063/blog/item/9c99a2dd23e41f365882dd39.html
[ ±¾Ìû×îºóÓÉ »Æ¸»Ç¿ ÓÚ 2008-5-14 13:09 ±à¼ ]
muyizhu ÓÚ 2008-05-14 12:32:47·¢±í:
ÓÖ»òÕß²»ÓÃlibtool
Õâ¸ömakefile.amÐèÒªÔõôд
muyizhu ÓÚ 2008-05-14 12:31:32·¢±í:
ÎÒ¿´ÍøÉÏÓнéÉܵ½ÓÃlibtool
½á¹ûlibtest.laÊÇÉú³ÉÁË£¬µ«ÊÇlibtest.soûÓÐÉú³É
ÊDz»ÊÇÕâ¸ömakefile.amÐèÒª×öʲôÐÞ¸Ä
muyizhu ÓÚ 2008-05-14 12:29:15·¢±í:
ллָ½Ì
¿ÉÊÇÖ±½ÓÓÃGCCÎÒÒ²ÖªµÀÔõôÓÃ
ÎÊÌâÊÇÎÒÏë×Ô¶¯Éú³Émakefile
×Ô¶¯Éú³É¹ý³ÌÖеÄmakefile.amÎÒ²»ÖªµÀÔõôд
»Æ¸»Ç¿ ÓÚ 2008-05-14 12:06:14·¢±í:
gcc a.c b.c c.c -fPIC -shared -o libtest.so
¶¯Ì¬Á´½Ó¿âÏ൱ÓÚWindowsÖÐÓõÄDLL
Ñо¿Ò»Ï»ù±¾GCCʹÓ÷½·¨£¬souһϣ¬ºÜ¶à.
[ ±¾Ìû×îºóÓÉ »Æ¸»Ç¿ ÓÚ 2008-5-14 12:10 ±à¼ ]