CharlesShang / TFFRCNN

FastER RCNN built on tensorflow
MIT License
874 stars 418 forks source link

undefined symbol: _ZN10tensorflow7strings6StrCatB5cxx11ERKNS0_8AlphaNumE #55

Open hadign20 opened 7 years ago

hadign20 commented 7 years ago

I'm trying to run the demo of faster-rcnn. But I keep getting this error: tensorflow.python.framework.errors_impl.NotFoundError: /home/hadi/Software/tensorflow/TFFRCNN/lib/psroi_pooling_layer/psroi_pooling.so: undefined symbol: _ZN10tensorflow7strings6StrCatB5cxx11ERKNS0_8AlphaNumE

This is my make.sh file:

%#!/usr/bin/env bash TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())') echo $TF_INC

CUDA_PATH=/usr/local/cuda-8.0/

cd roi_pooling_layer

nvcc -std=c++11 -c -o roi_pooling_op.cu.o roi_pooling_op_gpu.cu.cc \ -I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -arch=sm_52

% ## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below %#g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o roi_pooling.so roi_pooling_op.cc \ % # roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64

%# for gcc5-built tf g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=1 -o roi_pooling.so roi_pooling_op.cc \ roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64 cd ..

%# add building psroi_pooling layer cd psroi_pooling_layer nvcc -std=c++11 -c -o psroi_pooling_op.cu.o psroi_pooling_op_gpu.cu.cc \ -I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -arch=sm_52

g++ -std=c++11 -shared -o psroi_pooling.so psroi_pooling_op.cc \ psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64

%## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below %#g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o psroi_pooling.so psroi_pooling_op.cc \ % # psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64

cd ..

My gcc version is 5 and I have tried the -D_GLIBCXX_USE_CXX11_ABI flag with both 1 and 0. It still doesn't work. What else should I change here?

Griovwe commented 7 years ago

I have the same problem, do you fix it?

WLpub commented 7 years ago

have u fix this, i got the same problem

Griovwe commented 7 years ago

I modify the make.sh file, make -D_GLIBCXX_USE_CXX11_ABI=0, Here is my make.sh file:

!/usr/bin/env bash

TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())') echo $TF_INC

CUDA_PATH=/usr/local/cuda/

cd roi_pooling_layer

nvcc -std=c++11 -c -o roi_pooling_op.cu.o roi_pooling_op_gpu.cu.cc \ -I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -arch=sm_52

if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below

g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o roi_pooling.so roi_pooling_op.cc \

roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64

for gcc5-built tf

g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o roi_pooling.so roi_pooling_op.cc \ roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64 cd ..

add building psroi_pooling layer

cd psroi_pooling_layer nvcc -std=c++11 -c -o psroi_pooling_op.cu.o psroi_pooling_op_gpu.cu.cc \ -I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -arch=sm_52

g++ -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -shared -o psroi_pooling.so psroi_pooling_op.cc \ psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64

if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below

g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o psroi_pooling.so psroi_pooling_op.cc \

psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64

cd ..

lee2430 commented 7 years ago

@Griovwe 's answer also worked in my case, you have to add "-D_GLIBCXX_USE_CXX11_ABI=0" to both the g++ lines for roi_pooling layer and psroi_pooling layer if you encountered this problem.

hadign20 commented 7 years ago

@lee2430 thanks a lot. setting "-D_GLIBCXX_USE_CXX11_ABI=0" to both the g++ lines for roi_pooling layer and psroi_pooling layer solved my problem.

lee2430 commented 7 years ago

@hadi-ghnd Griovwe should be thanked : ) Anyway, I did some google about this flag and found the reason. In case anyone is interested, posted here: ) https://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi/ The GNU C++ team works hard to avoid breaking ABI compatibility between releases, including between different -std= modes. But some new complexity requirements in the C++11 standard require ABI changes to several standard library classes to satisfy, most notably to std::basic_string and std::list. And since std::basic_string is used widely, much of the standard library is affected.

Many users routinely rebuild all their code when they change compilers; such users will be unaffected by this change. Code built with an earlier compiler will also continue to work with the new libstdc++, which provides both old and new ABIs.

Users that depend on third-party libraries or plugin interfaces that still use the old ABI can build their code with -D_GLIBCXX_USE_CXX11_ABI=0 and everything should work fine. In most cases, it will be obvious when this flag is needed because of errors from the linker complaining about unresolved symbols involving “__cxx11”.

xingbowei commented 7 years ago

I have changed the make.sh, but the question still is, who can help me?