2014-06-23 104 views
-1

嗨,大家好我有一个静态链接库问题。我在ubuntu 12.0.4中做了一个C++应用程序,我必须为ARM创建这个.cpp文件的执行。该文件包含opencv库。ARM的Opencv静态库链接器错误

所以第一个我所做的是从Git仓库下载的OpenCV源:

混帐克隆https://github.com/Itseez/opencv.git

一旦没有问题说完,我创建了一个新的目录,我执行CMake的:

cmake的-DSOFTFP = ON -DBUILD_SHARED_LIBS = 0 -DCMAKE_TOOLCHAIN_FILE = ../OpenCV的/平台/ LINUX /臂gnueabi.toolchain.cmake ../opencv

然后我执行作,并开始构建静态的OpenCVARM的库。一切都完成了,我可以看到刚刚创建的静态库。

所以我尝试编译如下:

ARM-Linux的G ++ -static -o相机IpCamPthread.cpp -I在/ usr /本地/包括-L /家庭/耶稣/ OpenCV的/编译/ lib目录 - lopencv_core -lopencv_imgproc -lopencv_highgui

再出现这样的错误:

/home/jesus/opencv/build/lib/libopencv_core.a(rand.cpp.o): In function `cv::theRNG()': 
    rand.cpp:(.text._ZN2cv6theRNGEv+0xe): undefined reference to `pthread_once' 
    rand.cpp:(.text._ZN2cv6theRNGEv+0x18): undefined reference to `pthread_getspecific' 
    rand.cpp:(.text._ZN2cv6theRNGEv+0x3e): undefined reference to `pthread_setspecific' 
    /home/jesus/opencv/build/lib/libopencv_core.a(rand.cpp.o): In function  `cv::makeRNGKey()':  
    rand.cpp:(.text._ZN2cvL10makeRNGKeyEv+0x14): undefined reference to `pthread_key_create' 
    /home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function  `cv::Mutex::trylock()': 
    system.cpp:(.text._ZN2cv5Mutex7trylockEv+0x4): undefined reference to  `pthread_spin_trylock'  
    /home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function  `cv::Mutex::unlock()':  
    system.cpp:(.text._ZN2cv5Mutex6unlockEv+0x4): undefined reference to `pthread_spin_unlock' 
    /home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function `cv::Mutex::lock()':  
system.cpp:(.text._ZN2cv5Mutex4lockEv+0x4): undefined reference to `pthread_spin_lock' 
/home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function `cv::Mutex::operator=(cv::Mutex const&)': 
system.cpp:(.text._ZN2cv5MutexaSERKS0_+0x34): undefined reference to `pthread_spin_destroy' 
/home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function `cv::Mutex::~Mutex()': 
system.cpp:(.text._ZN2cv5MutexD1Ev+0x28): undefined reference to `pthread_spin_destroy' 
/home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function `cv::Mutex::~Mutex()': 
system.cpp:(.text._ZN2cv5MutexD2Ev+0x28): undefined reference to `pthread_spin_destroy' 
/home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function `cv::Mutex::Mutex()': 
system.cpp:(.text._ZN2cv5MutexC1Ev+0xe): undefined reference to `pthread_spin_init' 
/home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function `cv::Mutex::Mutex()': 
system.cpp:(.text._ZN2cv5MutexC2Ev+0xe): undefined reference to `pthread_spin_init' 
/home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function `cv::getTickCount()': 
system.cpp:(.text._ZN2cv12getTickCountEv+0x8): undefined reference to `clock_gettime' 
/home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function `cv::makeKey()': 
system.cpp:(.text._ZN2cvL7makeKeyEv+0x14): undefined reference to `pthread_key_create' 
/home/jesus/opencv/build/lib/libopencv_core.a(system.cpp.o): In function `cv::TLSDataContainer::getData() const': 
system.cpp:(.text._ZNK2cv16TLSDataContainer7getDataEv+0x20): undefined reference to `pthread_once' 
system.cpp:(.text._ZNK2cv16TLSDataContainer7getDataEv+0x26): undefined reference to `pthread_getspecific' 
system.cpp:(.text._ZNK2cv16TLSDataContainer7getDataEv+0x156): undefined reference to `pthread_setspecific' 
/home/jesus/opencv/build/lib/libopencv_core.a(persistence.cpp.o): In function `icvGets(CvFileStorage*, char*, int)': 
persistence.cpp:(.text._ZL7icvGetsP13CvFileStoragePci+0x94): undefined reference to `gzgets' 
/home/jesus/opencv/build/lib/libopencv_core.a(persistence.cpp.o): In function `icvXMLSkipSpaces(CvFileStorage*, char*, int)': 
persistence.cpp:(.text._ZL16icvXMLSkipSpacesP13CvFileStoragePci+0x1b4): undefined reference to `gzeof' 
/home/jesus/opencv/build/lib/libopencv_core.a(persistence.cpp.o): In function `T.3388': 
persistence.cpp:(.text.T.3388+0x11c): undefined reference to `gzeof' 
/home/jesus/opencv/build/lib/libopencv_core.a(persistence.cpp.o): In function `icvPuts(CvFileStorage*, char const*)': 
persistence.cpp:(.text._ZL7icvPutsP13CvFileStoragePKc+0x150): undefined reference to `gzputs' 
/home/jesus/opencv/build/lib/libopencv_core.a(persistence.cpp.o): In function `icvClose(CvFileStorage*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >*)': 
persistence.cpp:(.text._ZL8icvCloseP13CvFileStoragePSs+0x136): undefined reference to `gzclose' 
/home/jesus/opencv/build/lib/libopencv_core.a(persistence.cpp.o): In function `cvOpenFileStorage': 
persistence.cpp:(.text.cvOpenFileStorage+0x7d0): undefined reference to `gzrewind' 
persistence.cpp:(.text.cvOpenFileStorage+0x80c): undefined reference to `gzclose' 
persistence.cpp:(.text.cvOpenFileStorage+0x88e): undefined reference to `gzopen' 
persistence.cpp:(.text.cvOpenFileStorage+0xe3e): undefined reference to `gzclose' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_png.cpp.o): In function `cv::PngEncoder::writeDataToBuf(void*, unsigned char*, unsigned int)': 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder14writeDataToBufEPvPhj+0x28): undefined reference to `png_get_io_ptr' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_png.cpp.o): In function `cv::PngDecoder::readDataFromBuf(void*, unsigned char*, unsigned int)': 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder15readDataFromBufEPvPhj+0x14): undefined reference to `png_get_io_ptr' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder15readDataFromBufEPvPhj+0xec): undefined reference to `png_error' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_png.cpp.o): In function `cv::PngDecoder::close()': 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder5closeEv+0x2a): undefined reference to `png_destroy_read_struct' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_png.cpp.o): In function `cv::PngDecoder::readHeader()': 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x1c): undefined reference to `png_create_read_struct' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x26): undefined reference to `png_create_info_struct' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x2e): undefined reference to `png_create_info_struct' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x66): undefined reference to `png_set_longjmp_fn' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xb2): undefined reference to `png_init_io' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xe0): undefined reference to `png_read_info' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xfa): undefined reference to `png_get_IHDR' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x166): undefined reference to `png_set_read_fn' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x180): undefined reference to `png_get_tRNS' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_png.cpp.o): In function `cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)': 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x26): undefined reference to `png_create_write_struct' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x68): undefined reference to `png_create_info_struct' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x88): undefined reference to `png_set_longjmp_fn' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xb2): undefined reference to `png_set_write_fn' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x13c): undefined reference to `png_set_compression_level' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x148): undefined reference to `png_set_compression_strategy' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x18a): undefined reference to `png_set_IHDR' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x19a): undefined reference to `png_write_info' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1aa): undefined reference to `png_set_packing' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1b4): undefined reference to `png_set_bgr' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1c8): undefined reference to `png_set_swap' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x22e): undefined reference to `png_write_image' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x23e): undefined reference to `png_write_end' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x252): undefined reference to `png_destroy_write_struct' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2e0): undefined reference to `png_init_io' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2f8): undefined reference to `png_set_filter' 
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x304): undefined reference to `png_set_compression_level' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_png.cpp.o): In function `cv::PngDecoder::readData(cv::Mat&)': 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x9e): undefined reference to `png_set_longjmp_fn' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0xf8): undefined reference to `png_set_gray_to_rgb' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0xfe): undefined reference to `png_set_interlace_handling' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x106): undefined reference to `png_read_update_info' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x128): undefined reference to `png_read_image' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x130): undefined reference to `png_read_end' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x14c): undefined reference to `png_set_rgb_to_gray' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x160): undefined reference to `png_set_bgr' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x168): undefined reference to `png_set_strip_alpha' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x174): undefined reference to `png_set_swap' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x180): undefined reference to `png_set_expand_gray_1_2_4_to_8' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x188): undefined reference to `png_set_strip_16' 
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x194): undefined reference to `png_set_palette_to_rgb' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function `global constructors keyed to grfmt_jpeg2000.cpp': 
grfmt_jpeg2000.cpp:(.text._GLOBAL__I_grfmt_jpeg2000.cpp+0x4): undefined reference to `jas_init' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function `cv::JasperInitializer::~JasperInitializer()': 
grfmt_jpeg2000.cpp:(.text._ZN2cv17JasperInitializerD1Ev[cv::JasperInitializer::~JasperInitializer()]+0x4): undefined reference to `jas_cleanup' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function `cv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)': 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0x1e): undefined reference to `jas_matrix_create' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0xa4): undefined reference to `jas_image_writecmpt' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0xbe): undefined reference to `jas_matrix_destroy' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function `cv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)': 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0x1e): undefined reference to `jas_matrix_create' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0xa4): undefined reference to `jas_image_writecmpt' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0xbe): undefined reference to `jas_matrix_destroy' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function `cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)': 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x64): undefined reference to `jas_image_create' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x9e): undefined reference to `jas_image_destroy' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xd0): undefined reference to `jas_stream_fopen' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xde): undefined reference to `jas_image_strtofmt' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xec): undefined reference to `jas_image_encode' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xf6): undefined reference to `jas_stream_close' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function `cv::Jpeg2KDecoder::close()': 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder5closeEv+0xa): undefined reference to `jas_stream_close' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder5closeEv+0x18): undefined reference to 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x94): undefined reference to `jas_image_getcmptbytype' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x118): undefined reference to `jas_matrix_destroy' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x172): undefined reference to `jas_matrix_create' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x18c): undefined reference to `jas_image_readcmpt' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x1ae): undefined reference to `jas_cmprof_createfromclrspc' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x1be): undefined reference to `jas_image_chclrspc' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x1ca): undefined reference to `jas_image_destroy' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x1d4): undefined reference to `jas_cmprof_destroy' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x246): undefined reference to `jas_cmprof_destroy' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function `cv::Jpeg2KDecoder::readHeader()': 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x12): undefined reference to `jas_stream_fopen' 
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x22): undefined reference to `jas_image_decode' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg.cpp.o): In function `cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)': 
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x7c): undefined reference to `jpeg_CreateCompress' 
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x84): undefined reference to `jpeg_std_error' 
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x158): undefined reference to `jpeg_set_defaults' 
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x164): 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg.cpp.o): In function `T.441': 
grfmt_jpeg.cpp:(.text.T.441+0x162): undefined reference to `jpeg_alloc_huff_table' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_jpeg.cpp.o): In function `cv::JpegDecoder::readData(cv::Mat&)': 
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x9a): undefined reference to `jpeg_start_decompress' 
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x108): undefined reference to `jpeg_read_scanlines' 
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x132): undefined reference to `jpeg_finish_decompress' 
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x17c): undefined reference to `jpeg_read_scanlines' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_exr.cpp.o): In function `cv::ExrDecoder::readHeader()': 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0xa): undefined reference to `Imf::globalThreadCount()' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x20): undefined reference to `Imf::InputFile::InputFile(char const*, int)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x2e): undefined reference to `Imf::InputFile::header() const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x32): undefined reference to `Imf::Header::dataWindow() const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x5a): undefined reference to `Imf::InputFile::header() const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x5e): undefined reference to `Imf::hasChromaticities(Imf::Header const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x68): undefined reference to `Imf::InputFile::header() const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x6c): undefined reference to `Imf::Header::channels() const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x76): undefined reference to `Imf::ChannelList::findChannel(char const*) const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x82): undefined reference to `Imf::ChannelList::findChannel(char const*) const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x8e): undefined reference to `Imf::ChannelList::findChannel(char const*) const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0xf2): undefined reference to `Imf::InputFile::header() const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0xf6): undefined reference to `Imf::chromaticities(Imf::Header const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x144): undefined reference to `Imf::ChannelList::findChannel(char const*) const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x15a): undefined reference to `Imf::ChannelList::findChannel(char const*) const' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x166): undefined reference to `Imf::ChannelList::findChannel(char const*) const' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_exr.cpp.o): In function `cv::ExrEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)': 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x70): undefined reference to `Imf::Header::Header(int, int, float, Imath::Vec2<float> const&, float, Imf::LineOrder, Imf::Compression)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x96): undefined reference to `Imf::Header::channels()' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xaa): undefined reference to `Imf::Channel::Channel(Imf::PixelType, int, int, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xb6): undefined reference to `Imf::ChannelList::insert(char const*, Imf::Channel const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xbc): undefined reference to `Imf::globalThreadCount()' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xd0): undefined reference to `Imf::OutputFile::OutputFile(char const*, Imf::Header const&, int)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x12e): undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x13a): undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x142): undefined reference to `Imf::OutputFile::setFrameBuffer(Imf::FrameBuffer const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x19c): undefined reference to `Imf::OutputFile::writePixels(int)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x21c): undefined reference to `half::convert(int)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x282): undefined reference to `half::convert(int)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2e6): undefined reference to `Imf::OutputFile::~OutputFile()' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2ec): undefined reference to `Imf::Header::~Header()' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x324): undefined reference to `half::_eLut' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x378): undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x384): undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x3ae): undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x3ba): undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x3e4): undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x3f0): undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x40c): undefined reference to `Imf::OutputFile::writePixels(int)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x436): undefined reference to `Imf::Header::channels()' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x44a): undefined reference to `Imf::Channel::Channel(Imf::PixelType, int, int, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x456): undefined reference to `Imf::ChannelList::insert(char const*, Imf::Channel const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x45c): undefined reference to `Imf::Header::channels()' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x470): undefined reference to `Imf::Channel::Channel(Imf::PixelType, int, int, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x47c): undefined reference to `Imf::ChannelList::insert(char const*, Imf::Channel const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x482): undefined reference to `Imf::Header::channels()' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x496): undefined reference to `Imf::Channel::Channel(Imf::PixelType, int, int, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x4a2): undefined reference to `Imf::ChannelList::insert(char const*, Imf::Channel const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x4d2): undefined reference to `Imf::OutputFile::~OutputFile()' 
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x4d8): undefined reference to `Imf::Header::~Header()' 
/home/jesus/opencv/build/lib/libopencv_highgui.a(grfmt_exr.cpp.o): In function `cv::ExrDecoder::readData(cv::Mat&)': 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xec): undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xf8): undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x14c): undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x158): undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x1ae): undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x1ba): undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x244): undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x250): undefined reference to `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)' 
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x2a0): undefined reference to `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)' 
collect2: ld returned 1 exit status 

我一直在寻找的东西BU T I不能得到任何东西。 有人可以帮忙? 谢谢你这么多 即使我调查,我发现,对于以确保所有的依赖性都包含我应该用pkgconfig这样编译:

arm-linux-g++ -o example IpCamPthread.cpp `pkg-config --static --cflags --libs opencv` 

和它创建了一个可执行文件,但是当我做可执行文件上的“file”结果如下: 例如:ELF 32位LSB可执行文件,ARM版本1(SYSV),动态链接(使用共享库),用于GNU/Linux 2.6.26,没有被去除 一个ARM文件,但动态链接,然后它不工作在我的ARM,我不明白为什么要做一个动态链接,当我在“opencv.pc”文件中有这样的:

# Package Information for pkg-config 

prefix=/home/jesus/opencv/build/install 
exec_prefix=${prefix} 
libdir= 
includedir_old=${prefix}/include/opencv 
includedir_new=${prefix}/include 

Name: OpenCV Description: Open Source Computer Vision Library Version: 2.4.9 Libs: ${exec_prefix}/lib/libopencv_contrib.a ${exec_prefix}/lib/libopencv_stitching.a ${exec_prefix}/lib/libopencv_nonfree.a ${exec_prefix}/lib/libopencv_superres.a ${exec_prefix}/lib/libopencv_ocl.a ${exec_prefix}/lib/libopencv_ts.a ${exec_prefix}/lib/libopencv_videostab.a ${exec_prefix}/lib/libopencv_gpu.a ${exec_prefix}/lib/libopencv_photo.a ${exec_prefix}/lib/libopencv_objdetect.a ${exec_prefix}/lib/libopencv_legacy.a ${exec_prefix}/lib/libopencv_video.a ${exec_prefix}/lib/libopencv_ml.a ${exec_prefix}/lib/libopencv_calib3d.a ${exec_prefix}/lib/libopencv_features2d.a ${exec_prefix}/lib/libopencv_highgui.a ${exec_prefix}/share/OpenCV/3rdparty/lib/libIlmImf.a ${exec_prefix}/share/OpenCV/3rdparty/lib/liblibjasper.a ${exec_prefix}/share/OpenCV/3rdparty/lib/liblibtiff.a ${exec_prefix}/share/OpenCV/3rdparty/lib/liblibpng.a ${exec_prefix}/share/OpenCV/3rdparty/lib/liblibjpeg.a ${exec_prefix}/lib/libopencv_imgproc.a ${exec_prefix}/lib/libopencv_flann.a ${exec_prefix}/lib/libopencv_core.a ${exec_prefix}/share/OpenCV/3rdparty/lib/libzlib.a -lrt -lpthread -lm -ldl -lstdc++ Cflags: -I${includedir_old} -I${includedir_new}

所有使用open.pc的库都是静态的,所以我不知道为什么编译和构建一个dinamic可执行文件。

有人??

回答

1

缺少一些-lSomeLib语句给链接器的经典案例。 pthread和gzip似乎缺失,等等。要手动找到你需要的库,grep你的符号名称的“lib”文件夹。

+0

嗨idinev谢谢你的回答,我可以看到一些如何在这种情况下使用grep的例子吗?有人告诉我,也许是libray格式的问题,所以说,这不是ARM格式问题,有一些命令,我可以用它来知道某些静态库是否是ARM格式??因为使用文件我无法做到这一点。 Thanksss – user3766585

1

嗨,大家好,谢谢Idinev我一直在寻找如何添加库,以及如何确保我需要的每个库链接属性。

因此,我尝试使用pkgconfig我如何说上面,但我无法得到静态可执行文件,最后这是一个sintaxis错误。我使用这个:

arm-linux-g ++ -static -o示例IPCamera。CPP pkg-config --cflags --libs opencv

和它的作品,它创造了一个可执行文件,当我执行 “文件可执行” 的输出为:

例如:ELF 32位LSB的可执行文件,ARM,版本1(SYSV),静态链接,对于GNU/Linux 2.6.26,没有剥离

静态链接!