LinuxϵͳµÄÍ·ÎļþºÍ¿âÎļþËÑË÷·¾¶
IncludeµÄheaderÎļþ,Á¬½áÊý¾Ý¿â£¬ÏµÍ³¶¨Ò壬×ܹ²ÓÐÏÂÁÐÀ´Ô´Ö¸¶¨gccÈ¥ÄÇÕÒ¡£
µ±³õÔÚ±àÒëʱָ¶¨µÄ(ÔÚ~gcc/gcc/collect2.c:locatelib()
дÔÚspecsÄÚµÄ
ºóÀ´ÓÃ-D -I -LÖ¸¶¨µÄ
gcc»·¾³±äÁ¿É趨(±àÒëµÄʱºò)
ld.soµÄ»·¾³±äÁ¿(ÕâÊÇrun timeµÄʱºò£©
Ò»¡¢Í·Îļþ
gcc ÔÚ±àÒëʱÈçºÎȥѰÕÒËùÐèÒªµÄÍ·Îļþ £º
¡ùËùÒÔheader fileµÄËÑÑ°»á´Ó-I¿ªÊ¼
¡ùÈ»ºóÕÒgccµÄ»·¾³±äÁ¿ C_INCLUDE_PATH,CPLUS_INCLUDE_PATH,OBJC_INCLUDE_PATH
¡ùÔÙÕÒÄÚ¶¨Ä¿Â¼
/usr/include
/usr/local/include
/usr/lib/gcc-lib/i386-linux/2.95.2/include
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g -3
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../i386-linux/include
¿âÎļþµ«ÊÇÈç¹û×°gccµÄʱºò£¬ÊÇÓиø¶¨µÄprefixµÄ»°£¬ÄÇô¾ÍÊÇ
/usr/include
prefix/include
prefix/xxx-xxx-xxx-gnulibc/include
prefix/lib/gcc-lib/xxxx-xxx-xxx-gnulibc/2.8.1/include
¶þ¡¢¿âÎļþ
cos()µÈº¯Ê½¿âµÄÑ¡ÏîÒª¶à¼Ó -lm
±àÒëµÄʱºò:
¡ùgcc»áÈ¥ÕÒ-L
¡ùÔÙÕÒgccµÄ»·¾³±äÁ¿LIBRARY_PATH
¡ùÔÙÕÒÄÚ¶¨Ä¿Â¼ /lib /usr/lib /usr/local/lib ÕâÊǵ±³õcompile gccʱдÔÚ³ÌÐòÄÚµÄ
Èý¡¢ÔËÐÐʱ¶¯Ì¬¿âµÄËÑË÷·¾¶
1¡¢ÔÚÅäÖÃÎļþ/etc/ld.so.confÖÐÖ¸¶¨¶¯Ì¬¿âËÑË÷·¾¶
2¡¢Í¨¹ý»·¾³±äÁ¿LD_LIBRARY_PATHÖ¸¶¨¶¯Ì¬¿âËÑË÷·¾¶£¨µ±Í¨¹ý¸Ã»·¾³±äÁ¿Ö¸¶¨¶à¸ö¶¯Ì¬¿âËÑË÷·¾¶Ê±£¬Â·¾¶Ö®¼äÓÃðºÅ"£º"·Ö¸ô£©
3¡¢ÔÚ±àÒëÄ¿±ê´úÂëʱָ¶¨¸Ã³ÌÐòµÄ¶¯Ì¬¿âËÑË÷·¾¶£¨»¹¿ÉÒÔÔÚ±àÒëÄ¿±ê´úÂëʱָ¶¨³ÌÐòµÄ¶¯Ì¬¿âËÑË÷·¾¶¡£
ÕâÊÇͨ¹ýgcc µÄ²ÎÊý"-Wl,-rpath,"Ö¸¶¨£¨ÈçÀý3Ëùʾ£©¡£µ±Ö¸¶¨¶à¸ö¶¯Ì¬¿âËÑË÷·¾¶Ê±£¬Â·¾¶Ö®¼äÓÃðºÅ"£º"·Ö¸ô£©
4¡¢Ä¬ÈϵĶ¯Ì¬¿âËÑË÷·¾¶/lib
5¡¢Ä¬ÈϵĶ¯Ì¬¿âËÑË÷·¾¶/usr/lib
¿ÉÒÔͨ¹ýÖ´ÐпÉÖ´ÐÐÎļþposµÃµ½µÄ½á¹û²»Í¬»ñÖªÆäËÑË÷µ½ÁËÄĸö¶¯Ì¬¿â£¬´Ó¶ø»ñµÃµÚ1¸ö¶¯Ì¬¿âËÑË÷˳Ðò£¬È»ºóɾ³ý¸Ã¶¯Ì¬¿â£¬
ÔÙÖ´ÐгÌÐòpos£¬»ñµÃµÚ2¸ö¶¯Ì¬¿âËÑË÷·¾¶£¬ÔÙɾ³ýµÚ2¸ö±»ËÑË÷µ½µÄ¶¯Ì¬¿â£¬
Èç´ËÍù¸´£¬½«¿ÉµÃµ½LinuxËÑË÷¶¯Ì¬¿âµÄÏȺó˳Ðò¡£
³ÌÐòposÖ´ÐеÄÊä³ö½á¹ûºÍËÑË÷µ½µÄ¶¯Ì¬¿âµÄ¶ÔÓ¦¹ØϵÈç±í1Ëùʾ
³ÌÐòposÊä³ö½á¹û ʹÓõĶ¯Ì¬¿â ¶ÔÓ¦µÄ¶¯Ì¬¿âËÑË÷·¾¶Ö¸¶¨·½Ê½
./ ./libpos.so ±àÒëÄ¿±ê´úÂëʱָ¶¨µÄ¶¯Ì¬¿âËÑË÷·¾¶
/root/test/env/lib /root/test/env/lib/libpos.so »·¾³±äÁ¿LD_LIBRARY_PATHÖ¸¶¨µÄ¶¯Ì¬¿âËÑË÷·¾¶
/root/test/conf/lib /root/test/conf/lib/libpos.so ÅäÖÃÎļþ/etc/ld.so.
Ïà¹ØÎĵµ£º
linuxÈíÖжϻúÖÆ
ÖжϷþÎñ³ÌÐòÍùÍù¶¼ÊÇÔÚCPU¹ØÖжϵÄÌõ¼þÏÂÖ´Ðеģ¬ÒÔ±ÜÃâÖжÏǶÌ׶øʹ¿ØÖƸ´ÔÓ»¯¡£µ«ÊÇCPU¹ØÖжϵÄʱ¼ä²»ÄÜÌ«³¤£¬·ñÔòÈÝÒ׶ªÊ§ÖжÏÐźš£Îª´Ë£¬ Linux½«ÖжϷþÎñ³ÌÐòÒ»·ÖΪ¶þ£¬¸÷³Æ×÷“Top Half”ºÍ“Bottom Half”¡£Ç°Õßͨ³£¶Ôʱ¼äÒªÇó½ÏΪÑϸñ£¬ ......
ÖÐÎÄ°æÊéÄ¿
¡¶Apache CookbookÖÐÎİ棨µÚ¶þ°æ£©¡· New!
¡¶Linux Networking CookbookÖÐÎÄ°æ¡· New!
¡¶Shell½Å±¾Ñ§Ï°Ö¸ÄÏ¡· New!
¡¶×¿ÓгÉЧµÄ³ÌÐòÔ±¡· New!
¡¶´úÂëÖ®ÃÀ¡· New!
¡¶Ç¶ÈëʽӲ¼þÉè¼Æ£¨µÚ¶þ°æ£©¡· New!
¡¶LPI LinuxÈÏ֤ȨÍþÖ¸ÄÏ£¨µÚ¶þ°æ£©¡· New!
¡¶LINUX SERVER HACKS£¨¾í¶þ£©¡· New!
¡¶BSD Hacks¡· ......
½ø³Ìµ÷¶ÈÕþ²ß¾ÍÊǵ÷¶ÈϵͳÖÖÄÄÒ»¸ö½ø³ÌÀ´CPUÔËÐС£ÕâÖÖµ÷¶È·Ö2²ã¿¼ÂÇ¡£
µÚÒ»²ã£¬½ø³Ì״̬Õâ¸öÊÇ×îÓÅÏÈ¿¼Âǵģ¬Ò²¾ÍÊÇ˵ÓÅÏȼ¶×î¸ßµÄ¡£ÔÚlinuxÖÐÖ»ÓоÍÐ÷̬µÄ½ø³Ì²ÅÓпÉÄܻᱻµ÷¶ÈÑ¡ÖÐÈ»ºóÕ¼ÓÐCPU£¬ÆäËü״̬µÄ½ø³Ì²»¿ÉÄÜÕ¼Óеĵ½CPU¡£ÏÂÃæÊÇlinuxÖнø³ÌµÄ״̬
TASK_RUNNING:¾ÍÐ÷״̬£¬µÃµ½CPU¾Í¿ÉÒÔÔËÐС£
TASK_INTERRU ......
ÐòÑÔ
¡¡¡¡LinuxÊÇUnix²Ù×÷ϵͳµÄÒ»ÖÖ±äÖÖ£¬ÔÚLinuxϱàдÇý¶¯³ÌÐòµÄÔÀíºÍ˼ÏëÍêÈ«ÀàËÆÓÚÆäËûµÄUnixϵͳ£¬µ«Ëüdos»òwindow»·¾³ÏµÄÇý¶¯³ÌÐòÓкܴóµÄÇø±ð¡£ÔÚLinux»·¾³ÏÂÉè¼ÆÇý¶¯³ÌÐò£¬Ë¼Ïë¼ò½à£¬²Ù×÷·½±ã£¬¹¦ÄÜÒ²ºÜÇ¿´ó£¬µ«ÊÇÖ§³Öº¯ÊýÉÙ£¬Ö»ÄÜÒÀÀµkernelÖеĺ¯Êý£¬ÓÐЩ³£ÓõIJÙ×÷Òª×Ô¼ºÀ´±àд£¬¶øÇÒµ÷ÊÔÒ²²»·½±ã¡£±¾ÈËÕâ¼ ......