c++ 缺少动态库

http://www.cnblogs.com/smartvessel/archive/2011/01/21/1940868.html


总结下来主要有3种方法:
1. 用ln将需要的so文件链接到/usr/lib或者/lib这两个默认的目录下边
ln -s /where/you/install/lib/*.so /usr/lib
sudo ldconfig


2.修改LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/where/you/install/lib:$LD_LIBRARY_PATH
sudo ldconfig


3.修改/etc/ld.so.conf,然后刷新

vim /etc/ld.so.conf

add /where/you/install/lib
sudo ldconfig


形如这个:
#!/bin/bash

CUR=`dirname "$0"`
CUR=`cd "$CUR"; pwd`

# Notice:     set it first
hadoop_client_path=/home/users/wangquanjun/common/hadoop-client
HADOOP_HOME=${hadoop_client_path}/hadoop


export JAVA_HOME=${HADOOP_HOME}/../java6

CLASSPATH=${HADOOP_HOME}/conf
CLASSPATH=${CLASSPATH}:${HADOOP_HOME}

for path in `ls ${HADOOP_HOME}/hadoop-2-*.jar`
do
   CLASSPATH=${CLASSPATH}:$path
done
for path in `ls ${HADOOP_HOME}/lib/*.jar`
do
   CLASSPATH=${CLASSPATH}:$path
done
CLASSPATH=${CLASSPATH}:${HADOOP_HOME}/lib/jetty-ext/commons-el.jar
CLASSPATH=${CLASSPATH}:${HADOOP_HOME}/lib/jetty-ext/jasper-compiler.jar
CLASSPATH=${CLASSPATH}:${HADOOP_HOME}/lib/jetty-ext/jasper-runtime.jar
export CLASSPATH=${CLASSPATH}:${HADOOP_HOME}/lib/jetty-ext/jsp-api.jar


export HADOOP_LIB_DIR=$HADOOP_HOME/lib

export LD_LIBRARY_PATH=${HADOOP_HOME}/libhdfs:${JAVA_HOME}/jre/lib/amd64:${JAVA_HOME}/jre/lib/amd64/native_threads:${JAVA_HOME}/jre/lib/amd64/server:${HADOOP_HOME}/lib/native/Linux-amd64-64


 

posted on 2015-11-25 21:06  雨渐渐  阅读(441)  评论(0编辑  收藏  举报

导航