tensorflow cpp compile example. Using tensorflow.so. can run without install tensorflow.
tensorflow.so is building in GCC5.4.0 and glibc-2.23
- need GCC >=5.4.0
- need GLIBC >= 2.23
- g++ -std=c++11 -Iinclude -Llib test.cpp -ltensorflow_cc -o exec
- g++ -std=c++11 -Iinclude -Llib label_image.cc -ltensorflow_cc -o label_image
sudo yum install libmpc-devel mpfr-devel gmp-devel
sudo yum install zlib-devel*
curl ftp://ftp.gnu.org/pub/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
tar xvfj gcc-5.4.0.tar.bz2
cd gcc-5.4.0
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++
make -j 8
sudo make install
found libstdc++.so.6.0.21 installed in your system.
wget http://mirror.csclub.uwaterloo.ca/gnu/libc/glibc-2.26.tar.gz
tar -zxvf glibc-2.26.tar.gz
mkdir glibc-build
cd glibc-build
../glibc-2.26/configure --prefix=/usr/lib64/glibc-2.26
make -j 8
make install
found /usr/lib64/glibc-2.26/lib/libc.so installed
g++ -std=c++11 -Wl,-rpath='/usr/lib64/glibc-2.26/lib' -Wl,--dynamic-linker='/usr/lib64/glibc-2.26/lib/ld-linux-x86-64.so.2' -Iinclude -I'/usr/lib64/glibc-2.26/include' -Llib -L '/usr/lib64/glibc-2.26/lib' test.cpp -ltensorflow_cc -o exec
g++ -std=c++11 -Wl,-rpath='/usr/lib64/glibc-2.26/lib' -Wl,--dynamic-linker='/usr/lib64/glibc-2.26/lib/ld-linux-x86-64.so.2' -Iinclude -I'/usr/lib64/glibc-2.26/include' -Llib -L '/usr/lib64/glibc-2.26/lib' label_image.cc -ltensorflow_cc -o label_image
export LD_LIBRARY_PATH=./lib:/usr/local/lib64/
libstdc++.so.6.0.21 is in /usr/local/lib64/