1、下载源码并解压
#下载源码
wget http://mirrors.tuna.tsinghua.edu.cn/apache//ignite/2.7.6/apache-ignite-2.7.6-src.zip
#解压源码
unzip apache-ignite-2.7.6-src.zip
#进入源码文件夹
cd apache-ignite-2.7.6-src
2、开始编译(按照官方指导)
cd modules/platforms/cpp
libtoolize && aclocal && autoheader && automake --add-missing && autoreconf
# You can call the following command to see all the available
# configuration options:
# ./configure --help
# To use default configuration just type:
./configure
make
#The following step is optional if you want to install Ignite
#for your system. It would probably require root:
sudo make install
3、更新libtoolize、automake、autoconf
按照官方指导编译首先会遇到提示说libtoolize太老,编译不了,必须先手动升级autoconf
升级autoconf后执行
libtoolize && aclocal && autoheader && automake --add-missing && autoreconf
还是一对警告,并且执行./configure
也会遇到错误。折腾了良久,在全部手动更新
libtoolize、automake、autoconf
完成后才能configure
成功:
3.1 更新autoconf
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar -zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure && make -j4 && make install
3.2 更新automake
wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz
tar -zxvf automake-1.15.tar.gz
cd automake-1.15
./configure && make -j4 && make install
3.3 更新libtool
wget http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz
tar -zxvf libtool-2.4.6.tar.gz
cd libtool-2.4.6
./configure && make -j4 && make install
4、重新编译
- 按照第二节重新配置和编译(由于更新后的命令和老版本可能会冲突,可能需要加上命令版本号):
cd modules/platforms/cpp
libtoolize && aclocal-1.15 && autoheader && automake-1.15 --add-missing && autoreconf
# You can call the following command to see all the available
# configuration options:
# ./configure --help
# To use default configuration just type:
./configure
make -j4
#The following step is optional if you want to install Ignite
#for your system. It would probably require root:
sudo make install
-
然而在执行make时还是无法编译通过:
make[3]: Entering directory `/root/apache-ignite-2.7.6-src/modules/platforms/cpp/jni' CXX os/linux/src/utils.lo CXX src/java.lo CXX src/exports.lo In file included from ./include/ignite/jni/exports.h:21:0, from src/exports.cpp:18: ./include/ignite/jni/java.h:21:17: fatal error: jni.h: No such file or directory compilation terminated. make[3]: *** [src/exports.lo] 错误 1 make[3]: *** 正在等待未完成的任务.... In file included from ./include/ignite/jni/utils.h:22:0, from src/java.cpp:26: ./include/ignite/jni/java.h:21:17: fatal error: jni.h: No such file or directory compilation terminated. make[3]: *** [src/java.lo] 错误 1 In file included from ./include/ignite/jni/utils.h:22:0, from os/linux/src/utils.cpp:29: ./include/ignite/jni/java.h:21:17: fatal error: jni.h: No such file or directory compilation terminated.
通过编译器提示应该是
jni.h
文件无法找到,我们后面通过find
命令来搜搜头文件,然后重新配置并编译,但是后面接连遇到jni_md.h
未找到、cannot find -ljvm
、sqlext.h未找到
、boost/test/unit_test.hpp未找到
、undefined reference to clock_gettime
错误,这些问题的解决过程就不详细展开,只贴出最终解决命令:
yum install unixODBC-devel
yum install java-1.8.0-openjdk-devel.x86_64
export CXXFLAGS="-I/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-1.el6_10.x86_64/include/ -I/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-1.el6_10.x86_64/include/linux/ -L/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-1.el6_10.x86_64/jre/lib/amd64/server/ -lrt"
./configure --enable-tests=no && make -j4
- 上面的命令主要是目的是设置
jni.h
、jni_md.h
头文件地址,libjvm.so
库路径、安装unixODBC
,以及禁用boost依赖(--enable-tests=no)
.