make error
debug-912 opened this issue · 8 comments
I installed tensorrt3.0 on my ubuntu, and i put the code into the sample, when i make, get the following errors:
../Makefile.config:6: CUDA_INSTALL_DIR variable is not specified, using /usr/local/cuda-9.0 by default, use CUDA_INSTALL_DIR=<cuda_directory> to change.
../Makefile.config:9: CUDNN_INSTALL_DIR variable is not specified, using by default, use CUDNN_INSTALL_DIR=<cudnn_directory> to change.
Compiling: sampleYOLOV3.cpp
Compiling: common.cpp
g++: warning: upsample_layer.cu: linker input file unused because linking not done
Compiling CUDA debug: upsample_layer.cu
Linking: ../../bin/sampleYOLOV3_debug
../../bin/dchobj/sampleYOLOV3.o: In function Preprocess(cv::Mat const&)': /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/sampleYOLOV3.cpp:226: undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/sampleYOLOV3.cpp:228: undefined reference to cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/sampleYOLOV3.cpp:230: undefined reference to
cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/sampleYOLOV3.cpp:232: undefined reference to cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/sampleYOLOV3.cpp:238: undefined reference to
cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
/home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/sampleYOLOV3.cpp:244: undefined reference to cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const' /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/sampleYOLOV3.cpp:246: undefined reference to
cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
../../bin/dchobj/sampleYOLOV3.o: In function main': /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/sampleYOLOV3.cpp:275: undefined reference to
cv::imread(cv::String const&, int)'
../../bin/dchobj/sampleYOLOV3.o: In function FlattenLayer::enqueue(int, void const* const*, void**, void*, CUstream_st*)': /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:612: undefined reference to
google::LogMessageFatal::LogMessageFatal(char const*, int)'
/home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:612: undefined reference to google::LogMessage::stream()' /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:612: undefined reference to
google::LogMessageFatal::~LogMessageFatal()'
/home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:612: undefined reference to google::LogMessageFatal::~LogMessageFatal()' ../../bin/dchobj/sampleYOLOV3.o: In function
cv::String::String(char const*)':
/usr/local/include/opencv2/core/cvstd.hpp:602: undefined reference to cv::String::allocate(unsigned long)' ../../bin/dchobj/sampleYOLOV3.o: In function
cv::String::~String()':
/usr/local/include/opencv2/core/cvstd.hpp:648: undefined reference to cv::String::deallocate()' ../../bin/dchobj/sampleYOLOV3.o: In function
cv::Mat::~Mat()':
/usr/local/include/opencv2/core/mat.inl.hpp:704: undefined reference to cv::fastFree(void*)' ../../bin/dchobj/sampleYOLOV3.o: In function
cv::Mat::operator=(cv::Mat const&)':
/usr/local/include/opencv2/core/mat.inl.hpp:725: undefined reference to cv::Mat::copySize(cv::Mat const&)' ../../bin/dchobj/sampleYOLOV3.o: In function
cv::Mat::release()':
/usr/local/include/opencv2/core/mat.inl.hpp:816: undefined reference to cv::Mat::deallocate()' ../../bin/dchobj/sampleYOLOV3.o: In function
cv::Mat::operator=(cv::Mat&&)':
/usr/local/include/opencv2/core/mat.inl.hpp:1383: undefined reference to cv::fastFree(void*)' ../../bin/dchobj/sampleYOLOV3.o: In function
Reshape<21>::enqueue(int, void const* const*, void**, void*, CUstream_st*)':
/home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:231: undefined reference to google::LogMessageFatal::LogMessageFatal(char const*, int)' /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:231: undefined reference to
google::LogMessage::stream()'
/home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:231: undefined reference to google::LogMessageFatal::~LogMessageFatal()' /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:231: undefined reference to
google::LogMessageFatal::~LogMessageFatal()'
../../bin/dchobj/sampleYOLOV3.o: In function Reshape<2>::enqueue(int, void const* const*, void**, void*, CUstream_st*)': /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:231: undefined reference to
google::LogMessageFatal::LogMessageFatal(char const*, int)'
/home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:231: undefined reference to google::LogMessage::stream()' /home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:231: undefined reference to
google::LogMessageFatal::~LogMessageFatal()'
/home/zcl/TensorRT-3.0.4/samples/sampleYOLOV3/PluginFactory.h:231: undefined reference to google::LogMessageFatal::~LogMessageFatal()' ../../bin/dchobj/upsample_layer.o: In function
ReluForward_gpu(float const*, float*, int, int, int, int, float)':
tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text+0x162): undefined reference to google::LogMessageFatal::LogMessageFatal(char const*, int, google::CheckOpString const&)' tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text+0x16e): undefined reference to
google::LogMessage::stream()'
tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text+0x192): undefined reference to google::LogMessageFatal::~LogMessageFatal()' tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text+0x1a6): undefined reference to
google::LogMessageFatal::~LogMessageFatal()'
../../bin/dchobj/upsample_layer.o: In function Forward_gpu(float*, int, int, int, int, int, float*)': tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text+0x334): undefined reference to
google::LogMessageFatal::LogMessageFatal(char const*, int, google::CheckOpString const&)'
tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text+0x340): undefined reference to google::LogMessage::stream()' tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text+0x364): undefined reference to
google::LogMessageFatal::~LogMessageFatal()'
tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text+0x378): undefined reference to google::LogMessageFatal::~LogMessageFatal()' ../../bin/dchobj/upsample_layer.o: In function
std::__cxx11::basic_string<char, std::char_traits, std::allocator >* google::MakeCheckOpString<cudaError, cudaError>(cudaError const&, cudaError const&, char const*)':
tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text._ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x33): undefined reference to google::base::CheckOpMessageBuilder::CheckOpMessageBuilder(char const*)' tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text._ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x5d): undefined reference to
google::base::CheckOpMessageBuilder::ForVar2()'
tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text._ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x7b): undefined reference to google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()' tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text._ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0x8a): undefined reference to
google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()'
tmpxft_00004f7c_00000000-5_upsample_layer.cudafe1.cpp:(.text._ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc[_ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKT_RKT0_PKc]+0xad): undefined reference to `google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()'
collect2: error: ld returned 1 exit status
../Makefile.config:165: recipe for target '../../bin/sampleYOLOV3_debug' failed
make: *** [../../bin/sampleYOLOV3_debug] Error 1
How can i fix it. thank you
I met this error too,have you fixed it?
thank you!!!
I solved this problen by including opencv in makefile.config, the original makefile has no information about opencv
Thanks to your quick reply !
Since I`m new to edit makefile,could you show me where to add my opencv path and libs in the file?
Thanks a lot!!!
I have figured it out,thank you anyway!
By the way ,have you already run this project successfully?How is your performance?
@zbw4034 I have also run into this problem, can you share how you included opencv in makefile.config, or share the file?
Thanks
@syncriptor
firstly,at about line 82,I changed the ROOT_PATH to this project rootpath.
then,from line 95 to 127,which begins with a lot of "#",my code is like this:
{{{
INCPATHS =-I"$(CUDA_INSTALL_DIR)/include" -I"/usr/local/include" -I"../include" -I"../common" -I"$(CUDNN_INSTALL_DIR)/include" -I"../../include" -I"/usr/include" $(TGT_INCLUDES)
LIBPATHS =-L"$(CUDA_INSTALL_DIR)/targets/$(TRIPLE)/$(CUDA_LIBDIR)" -L"/usr/local/lib" -L"../lib" -L"$(CUDA_INSTALL_DIR)/$(CUDA_LIBDIR)" -L"$(CUDNN_INSTALL_DIR)/$(CUDNN_LIBDIR)" -L"../../lib" -L"/usr/lib" $(TGT_LIBS)
.SUFFIXES:
COMMON_FLAGS += -Wall -std=c++11 $(INCPATHS)
ifneq ($(ANDROID),1)
COMMON_FLAGS += -D_REENTRANT
endif
COMMON_LD_FLAGS +=
OBJDIR =$(call concat,$(OUTDIR),/chobj)
DOBJDIR =$(call concat,$(OUTDIR),/dchobj)
ifeq ($(ANDROID),1)
COMMON_LIBS = -lcudnn -lcublas -lnvToolsExt -lcudart
else
COMMON_LIBS = -lcudnn -lcublas -lcudart_static -lnvToolsExt -lcudart
endif
ifneq ($(TARGET), qnx)
ifneq ($(ANDROID),1)
COMMON_LIBS += -lrt -ldl -lpthread
endif
endif
ifeq ($(ANDROID),1)
COMMON_LIBS += -lculibos -lgnustl_shared -llog
endif
LIBS =-lglog -lnvinfer -lnvparsers -lnvinfer_plugin -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs $(COMMON_LIBS)
DLIBS =-lglog -lnvinfer -lnvparsers -lnvinfer_plugin -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs $(COMMON_LIBS)
}}}
I mainly add my opencv rootpath into INCPATHS and LIBPATHS as well as some opencv libs such as highgui,imgproc,imgcodecs,core into LIBS and DLIBS.Hope my code helps.
By the way,I haven't run through this project yet because my model can't be parsed by this code and the author hasn`t updated his model or converting code,if you successfully make it out,please share with me,thx~
I cant even find Makefile.config of this project and the Makefile it provided seems pretty useless. I'm really a newbie and could you plz share your Makefile and Makefile.config ?
thx
@mogli0528
you can find these two files in a file named "sample" in the path you installed your tensorrt.
btw,I haven't successfully run through this project ,if you make it out someday,please let me know and share your experience ~