依赖库:yum -y install gcc+ gcc-c++
官方文档中提到编译前提需要:gcc c++, autoconf, automake, libtool, Java 6, JAVA_HOME set, Maven 3
1:下载所需的动态库和hadoop snappy插件工程
snappy-1.1.2.tar.gz 动态库
source-archive Maven Jar
2:编译snappy-1.1.2.tar.gz (gcc g++ 等)
./configure
make
make install
成功了在usr/local/lib下有动态库文件
-rw-r--r--. 1 root root 330020 Jun 6 11:42 libsnappy.a
-rwxr-xr-x. 1 root root 953 Jun 6 11:42 libsnappy.la
lrwxrwxrwx. 1 root root 18 Jun 6 11:42 libsnappy.so -> libsnappy.so.1.2.1
lrwxrwxrwx. 1 root root 18 Jun 6 11:42 libsnappy.so.1 -> libsnappy.so.1.2.1
-rwxr-xr-x. 1 root root 164196 Jun 6 11:42 libsnappy.so.1.2.1
3:maven编辑source-archive下truch包
PS:安装MAVEN
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
yum -y install apache-maven
遇到问题:
mvn package
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
是因为maven环境没导入 执行:export M2_HOME=/usr/share/maven export PATH=$PATH:$M2_HOME/bin
随后编译:mvn package
遇到问题:
Cannot run program "autoreconf" 安装上面提到的依赖库
cannot find -ljvm 这个错误是因为没有把安装jvm的libjvm.so 链接到 /usr/local/lib。如果你的系统时amd64,可以执行如下命令解决这个问题:
ln -s /usr/java/jdk1.7.0_75/jre/lib/amd64/server/libjvm.so /usr/local/lib/
随后获取编译成功的jar