Libtool´´½¨ºÍʹÓÃlinux϶¯Ì¬¿â
Îļþfun.c£¬fun.h£¬hello.c£¬hello.h£¬main.c¶¯Ì¬¿âº¯Êý¶¼ÔÚfun.cºÍhello.cÀïÃæ
----------------------------
fun.c:
int add(int a, int b)
{
return a+b;
}
fun.h:
#ifndef _FUN_H_11
#define _FUN_H_11
int add(int a, int b);
#endif
----------------------------
hello.c:
££i nclude <stdio.h>
void output(char *ss)
{
printf("HELLO %s\n", ss);
}
hello.h
#ifndef HELLO_H_111
#define HELLO_H_111
void output(char *ss);
#endif
----------------------------
main.c:
££i nclude <stdio.h>
££i nclude "hello.h"
££i nclude "fun.h"
void
main()
{
output("world");
printf("Test Value:%d\n", add(1, 2));
}
---------------------------------
ʹÓÃlibtools´´½¨ºÍʹÓð²×°¶¯Ì¬¿â²½Öè:
(1)
libtool --mode=compile gcc -g -O -c hello.c
libtool --mode=compile gcc -g -O -c fun.c
libtool --mode=compile gcc -g -O -c main.c
#Éú³É¸÷×ÔµÄoÎļþ
(2)
libtool --mode=link gcc -g -O -o libhello.la hello.lo fun.lo -rpath /usr/local/lib -lm
#Á¬½Ó³É¶¯Ì¬¿âÎļþ
(3)
libtool --mode=link gcc -g -O -o test main.o libhello.la -lm
#Á¬½ÓÉú³É¿ÉÖ´ÐÐÎļþtest
(4)
libtool --mode=install cp libhello.la /usr/local/lib/libhello.la
libtool --mode=install install -c libhello.la /usr/local/lib/libhello.la
libtool -n --mode=finish /usr/local/lib
libtool install -c test /usr/local/bin/test
#°²×°¶¯Ì¬¿â
È»ºó¾Í¿ÉÒÔÔËÐÐ/usr/local/bin/testÁË,µ±È»Â·¾¶¿ÉÒÔÈÎÒâÉèÖÃ,ÕâÊÇÊÖ¶¯¹ý³Ì,д³ÉMakefileÎļþΪ:
OBJS = fun.o hello.o
LO_OBJS = main.lo fun.lo hello.lo
PACKAGE_VERSION = 1:1:1
LIBDIR=/usr/local/lib
all : test
install : libhello.la
test : libhello.la main.o
libtool --mode=link gcc -g -O -o test main.o libhello.la -lm
libhello.la : $(OBJS)
libtool gcc -g -O -o libhello.la $(LO_OBJS) -rpath ${LIBDIR} -lm -version-info ${PACKAGE_VERSION}
main.o : main.c fun.h hello.h
libtool --mode=compile gcc -g -O -c main.c
fun.o : fun.c fun.h
libtool --mode=compile gcc -g -O -c fun.c
hello.o : hello.c hello.h
libtool --mode=comp
Ïà¹ØÎĵµ£º
ÊÖÍ·Óиöep9315µÄ°å£¬½ñÌìͻȻÏëÆðÅÜÒ»ÏÂadslÉÏÍø¡£ÍíÉÏ»ØÀ´¾Í¿ªÊ¼¸ã¡£
´Ó10µãµ½ÏÖÔÚ£¬ÖÕÓÚÄܹ»ÅÜÆðÀ´¡£
¸ø´ó¼Ò½è¼øһϡ£
1.±àÒëÄںˣ¬°ÑpppµÄÄÇЩѡÏîÑ¡ÉÏ¡£ (ÎÒÓÃ2.6.8.1µÄkernel£¬cirrus µÄpatch)
2.libpcap-0.9.1 Õâ¸ö°üÊÇpppdÐèÒªµÄ¡£
./configure CC=arm-linux-gcc CFLAGS=-msoft-float --target=arm-linu ......
ÆäÖÐÓÐһЩº¯ÊýµÄ×÷ÓÃÍêÈ«Ïàͬ£¬Ö»ÊDzÎÊý²»Í¬¡££¨¿ÉÄܺܶàÊìϤC++ÅóÓÑÂíÉϾÍÄÜÁªÏëÆðº¯ÊýÖØÔØ£¬µ«ÊDZðÍüÁËLinuxºËÐÄÊÇÓÃCÓïÑÔдµÄ£¬ËùÒÔÖ»
ÄÜÈ¡³É²»Í¬µÄº¯ÊýÃû£©¡£»¹ÓÐһЩº¯ÊýÒѾ¹ýʱ£¬±»ÐµĸüºÃµÄº¯ÊýËù´úÌæÁË£¨gccÔÚÁ´½ÓÕâЩº¯Êýʱ»á·¢³ö¾¯¸æ£©£¬µ«ÒòΪ¼æÈݵÄÔÒò»¹±£Áô×Å£¬ÕâЩº¯ÊýÔÚÇ°
Ãæ±êÉÏ“*”ºÅÒÔÊ ......
linuxÖУ¬Í¨¹ý
ls -al
ÏÔʾµÄÊôÐÔÖУ¬µÚÒ»¸ö¾Í±êÖ¾ÎļþÀàÐÍ¡£Í¨³£ÓÐһϼ¸ÖÖÇé¿ö£º
[ - ]££££ÆÕͨÎļþ
[ d]££££Ä¿Â¼
[ l ]££££Á¬½ÓÎļþ
[ b]££££¿éÉ豸
[ c ]££££×Ö·ûÉ豸
[ s ]££££Ì×½á×Ö
[ p ]££££¹ÜµÀ ......
ÍøÉÏÕÒµ½ÁËÐí¶à¹ØÓÚÕâ·½ÃæµÄÎÄÕ£¬ÄÚÈÝ»ù±¾Ïàͬ¡£¾¹ýʵ¼ù£¬·¢ÏÖÄÚÈÝÀïÆÕ±é´æÔÚÎÊÌâ¡£ÒÔÏÂÊÇ×Ô¼ºÊµ¼ùÖ®ºó£¬ÐÞ¸ÄÁËÆäÖеĴíÎ󣬲¢¼Ç¼ÏÂÀ´µÄ±Ê¼Ç¡£
ÔÚ Linux »ò UNIX Ï嵀 Apache ·þÎñÆ÷ÖиøÍøÒ³ÉèÖÃÃÜÂë—ÕâÊÇÒ»Öֺܼòµ¥µÄ»ùÓÚÓû§Ãû/¿ÚÁîµÄÈÏÖ¤·½Ê½£ ......
64λ linux ±àÒëÁ´½Ó´í¿âµÄÎÊÌâ
ÔÚ64λ»úÆ÷ÏÂÃæ±àÒëÈí¼þµÄʱºò£¬¾³£»áÓöµ½±àÒëµÄʱºòÐèÒªÁ´½Ó64λµÄ¿â£¬µ«ÊDZàÒëʱÕÒµÄÈ´ÊÇ32λµÄ¿â£¬¿ÉÒÔͨ¹ýÈçϵİ취ǿÖƱàÒë³ÌÐòÈ¥ÕÒ64λµÄ¿â
LDFLAGS="-L/usr/lib64 -L/lib64" \
ÔÚÅäÖÃʱ¼ÓÉÏÕâôһ¸öÑ¡Ïî¼´¿É¡£
......