ºìÁªLinuxÃÅ»§
Linux°ïÖú

linuxϵͳÖÐÈçºÎÌí¼Ó×Ô¼ºµÄ¿âÎļþ·¾¶

·¢²¼Ê±¼ä:2008-04-15 15:47:34À´Ô´:ºìÁª×÷Õß:dwillin
¿âÎļþÔÚÁ¬½Ó£¨¾²Ì¬¿âºÍ¹²Ïí¿â£©ºÍÔËÐУ¨½öÏÞÓÚʹÓù²Ïí¿âµÄ³ÌÐò£©Ê±±»Ê¹Óã¬ÆäËÑË÷·¾¶ÊÇÔÚϵͳÖнøÐÐÉèÖõġ£Ò»°ã Linux ϵͳ°Ñ /lib ºÍ /usr/lib Á½¸öĿ¼×÷ΪĬÈϵĿâËÑË÷·¾¶£¬ËùÒÔʹÓÃÕâÁ½¸öĿ¼ÖеĿâʱ²»ÐèÒª½øÐÐÉèÖÃËÑË÷·¾¶¼´¿ÉÖ±½ÓʹÓ᣶ÔÓÚ´¦ÓÚĬÈÏ¿âËÑË÷·¾¶Ö®ÍâµÄ¿â£¬ÐèÒª½«¿âµÄλÖÃÌí¼Óµ½¿âµÄËÑË÷·¾¶Ö®ÖС£ÉèÖÿâÎļþµÄËÑË÷·¾¶ÓÐÏÂÁÐÁ½ÖÖ·½Ê½£¬¿ÉÈÎÑ¡ÆäһʹÓãº

ÔÚ»·¾³±äÁ¿ LD_LIBRARY_PATH ÖÐÖ¸Ã÷¿âµÄËÑË÷·¾¶¡£

ÔÚ /etc/ld.so.conf ÎļþÖÐÌí¼Ó¿âµÄËÑË÷·¾¶¡£

½«×Ô¼º¿ÉÄÜ´æ·Å¿âÎļþµÄ·¾¶¶¼¼ÓÈëµ½/etc/ld.so.confÖÐÊÇÃ÷ÖǵÄÑ¡Ôñ

Ìí¼Ó·½·¨Ò²¼«Æä¼òµ¥£¬½«¿âÎļþµÄ¾ø¶Ô·¾¶Ö±½Óд½øÈ¥¾ÍOKÁË£¬Ò»ÐÐÒ»¸ö¡£ÀýÈ磺

/usr/X11R6/lib
/usr/local/lib
/opt/lib

ÐèҪעÒâµÄÊÇ£ºµÚ¶þÖÖËÑË÷·¾¶µÄÉèÖ÷½Ê½¶ÔÓÚ³ÌÐòÁ¬½ÓʱµÄ¿â£¨°üÀ¨¹²Ïí¿âºÍ¾²Ì¬¿â£©µÄ¶¨Î»ÒѾ­×ã¹»ÁË£¬µ«ÊǶÔÓÚʹÓÃÁ˹²Ïí¿âµÄ³ÌÐòµÄÖ´Ðл¹ÊDz»¹»µÄ¡£ÕâÊÇÒòΪΪÁ˼ӿì³ÌÐòÖ´ÐÐʱ¶Ô¹²Ïí¿âµÄ¶¨Î»Ëٶȣ¬±ÜÃâʹÓÃËÑË÷·¾¶²éÕÒ¹²Ïí¿âµÄµÍЧÂÊ£¬ËùÒÔÊÇÖ±½Ó¶ÁÈ¡¿âÁбíÎļþ /etc/ld.so.cache ´ÓÖнøÐÐËÑË÷µÄ¡£/etc/ld.so.cache ÊÇÒ»¸ö·ÇÎı¾µÄÊý¾ÝÎļþ£¬²»ÄÜÖ±½Ó±à¼­£¬ËüÊǸù¾Ý /etc/ld.so.conf ÖÐÉèÖõÄËÑË÷·¾¶ÓÉ /sbin/ldconfig ÃüÁÕâЩËÑË÷·¾¶ÏµĹ²Ïí¿âÎļþ¼¯ÖÐÔÚÒ»Æð¶øÉú³ÉµÄ£¨ldconfig ÃüÁîÒªÒÔ root ȨÏÞÖ´ÐУ©¡£Òò´Ë£¬ÎªÁ˱£Ö¤³ÌÐòÖ´ÐÐʱ¶Ô¿âµÄ¶¨Î»£¬ÔÚ /etc/ld.so.conf ÖнøÐÐÁË¿âËÑË÷·¾¶µÄÉèÖÃÖ®ºó£¬»¹±ØÐëÒªÔËÐÐ /sbin/ldconfig ÃüÁî¸üР/etc/ld.so.cache ÎļþÖ®ºó²Å¿ÉÒÔ¡£ldconfig ,¼òµ¥µÄ˵£¬ËüµÄ×÷ÓþÍÊǽ«/etc/ld.so.confÁгöµÄ·¾¶ÏµĿâÎļþ»º´æµ½/etc/ld.so.cache ÒÔ¹©Ê¹Óá£Òò´Ëµ±°²×°ÍêһЩ¿âÎļþ£¬(ÀýÈç¸Õ°²×°ºÃglib)£¬»òÕßÐÞ¸Äld.so.confÔö¼ÓеĿâ·¾¶ºó£¬ÐèÒªÔËÐÐһϠ/sbin/ldconfigʹËùÓеĿâÎļþ¶¼±»»º´æµ½ld.so.cacheÖУ¬Èç¹ûû×ö£¬¼´Ê¹¿âÎļþÃ÷Ã÷¾ÍÔÚ/usr/libϵģ¬Ò²ÊDz»»á±»Ê¹Óõģ¬½á¹û±àÒë¹ý³ÌÖб§´í£¬È±ÉÙxxx¿â£¬È¥²é¿´·¢ÏÖÃ÷Ã÷¾ÍÔÚÄÇ·Å×Å£¬¸ãµÄÏë´óÂîcomputer´ÀÖíÒ»¸ö¡£

ÔÚ³ÌÐòÁ¬½Óʱ£¬¶ÔÓÚ¿âÎļþ£¨¾²Ì¬¿âºÍ¹²Ïí¿â£©µÄËÑË÷·¾¶£¬³ýÁËÉÏÃæµÄÉèÖ÷½Ê½Ö®Í⣬»¹¿ÉÒÔͨ¹ý -L ²ÎÊýÏÔʽָ¶¨¡£ÒòΪÓà -L ÉèÖõÄ·¾¶½«±»ÓÅÏÈËÑË÷£¬ËùÒÔÔÚÁ¬½ÓµÄʱºòͨ³£¶¼»áÒÔÕâÖÖ·½Ê½Ö±½ÓÖ¸¶¨ÒªÁ¬½ÓµÄ¿âµÄ·¾¶¡£

Ç°ÃæÒѾ­ËµÃ÷¹ýÁË£¬¿âËÑË÷·¾¶µÄÉèÖÃÓÐÁ½ÖÖ·½Ê½£ºÔÚ»·¾³±äÁ¿ LD_LIBRARY_PATH ÖÐÉèÖÃÒÔ¼°ÔÚ /etc/ld.so.conf ÎļþÖÐÉèÖá£ÆäÖУ¬µÚ¶þÖÖÉèÖ÷½Ê½ÐèÒª root ȨÏÞ£¬ÒԸıä /etc/ld.so.conf Îļþ²¢Ö´ÐÐ /sbin/ldconfig ÃüÁî¡£¶øÇÒ£¬µ±ÏµÍ³ÖØÐÂÆô¶¯ºó£¬ËùÓеĻùÓÚ GTK2 µÄ³ÌÐòÔÚÔËÐÐʱ¶¼½«Ê¹ÓÃа²×°µÄ GTK+ ¿â¡£²»ÐÒµÄÊÇ£¬ÓÉÓÚ GTK+ °æ±¾µÄ¸Ä±ä£¬ÕâÓÐʱ»á¸øÓ¦ÓóÌÐò´øÀ´¼æÈÝÐÔµÄÎÊÌ⣬Ôì³ÉijЩ³ÌÐòÔËÐв»Õý³£¡£ÎªÁ˱ÜÃâ³öÏÖÉÏÃæµÄÕâЩÇé¿ö£¬ÔÚ GTK+ ¼°ÆäÒÀÀµ¿âµÄ°²×°¹ý³ÌÖжÔÓÚ¿âµÄËÑË÷·¾¶µÄÉèÖý«²ÉÓõÚÒ»ÖÖ·½Ê½½øÐС£ÕâÖÖÉèÖ÷½Ê½²»ÐèÒª root ȨÏÞ£¬ÉèÖÃÒ²¼òµ¥£º

$ export LD_LIBRARY_PATH=/opt/gtk/lib:$LD_LIBRARY_PATH

¿ÉÒÔÓÃÏÂÃæµÄÃüÁî²é¿´ LD_LIBRAY_PATH µÄÉèÖÃÄÚÈÝ£º

$ echo $LD_LIBRARY_PATH

ÖÁ´Ë£¬¿âµÄÁ½ÖÖÉèÖþÍÍê³ÉÁË¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ