BUILD_SHARED_LIBS = 0オプションを使用して、静的リンクを使用してopencvをpandaboardにインストールしました。私はubuntu11.10を使用しています。また、サードパーティのライブラリpng、jpeg、jasper、zlibも作成しました。(cmakeオプションBUILD_PNG = ON BUILD_JASPER = ON BUILD_JPEG = ON BUILD_ZLIB = ON WITH_JPEG = ON WITH_PNG = ON WITH_JASPER = ON)。私のopencvのインストールは成功しました。ただし、テストプログラムをコンパイルすると、エラーへの未定義の参照が多数表示されます。これらのエラーはすべてjpeg、png、jasperライブラリに関連しているようですが、明示的にリンクしたときにlibhighguiがサードパーティのライブラリを参照できない理由がわかりません。これが私のプログラムをコンパイルする方法です:
g++ -static face_recognition.cpp -o fcarm -I/home/nandhini/opencv/2.4.2static/include/opencv -I/home/nandhini/opencv/2.4.2static/include -L/home/nandhini/opencv/2.4.2static/lib/ -L/home/nandhini/opencv/2.4.2static/share/OpenCV/3rdparty/lib -llibjpeg -llibjasper -llibpng -lzlib -lopencv_core -lopencv_contrib -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_flann -lopencv_photo -lopencv_legacy -pthread -lm -lrt -lstdc++ -ldl
私は長い間この問題に悩まされてきました。誰かが私に問題を解決するのを手伝ってくれたら本当にありがたいです。助けてください、ありがとう!
これが私のエラーのリストです:
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In function
icvGets(CvFileStorage *、char *、int)':persistence.cpp:(。text._ZL7icvGetsP13CvFileStoragePci + 0x7e):gzgets'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In function
_ZL16icvYMLSkipSpacesP13CvFileStoragePcii.constprop.61'への未定義の参照:persistence.cpp:(。 ):gzeof'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In function
icvPuts(CvFileStorage *、char const *)'への未定義の参照:persistence.cpp:(。text._ZL7icvPutsP13CvFileStoragePKc + 0x138):gzputs'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In function
icvXMLSkipSpaces(CvFileStorage *、char *、int)'への未定義の参照:persistence.cpp:(。 text._ZL16icvXMLSkipSpacesP13CvFileStoragePci + 0x1a2):gzeof'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In function
icvClose(CvFileStorage *、std :: basic_string、std :: allocator> *)への未定義の参照':persistence.cpp:(。text._ZL8icvCloseP13CvFileStoragePSs + 0x132)gzclose'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In function
cvOpenFileStorage':persistence.cpp:(。text.cvOpenFileStorage + 0x1b0):gzcloseへの未定義の参照gzrewind'
persistence.cpp:(.text.cvOpenFileStorage+0x6b6): undefined reference to
'persistence.cpp:(。text.cvOpenFileStorage + 0x734):gzcloseへの未定義の参照gzopen'
persistence.cpp:(.text.cvOpenFileStorage+0xcd4): undefined reference to
' /home/nandhini/opencv/2.4.2static/ lib // libopencv_highgui.a(grfmt_jpeg2000.cpp.o):関数cv::JasperInitializer::~JasperInitializer()':
grfmt_jpeg2000.cpp:(.text._ZN2cv17JasperInitializerD2Ev[_ZN2cv17JasperInitializerD5Ev]+0x4): undefined reference to
jas_cleanup'/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o):関数cv::Jpeg2KDecoder::close()':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder5closeEv+0x8): undefined reference to
jas_stream_close' grfmt_jpeg2000.cpp :(。text._ZN2cv13Jpeg2KDecoder5closeEv+0x14):cv :: Jpeg2KDecoder :: readHeader()'への未定義の参照:jas_image_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function
grfmt_jpeg2000.cpp:(。text._ZN2cv13Jpeg2KDecoder10readHeaderEv + 0xe):undefined jas_stream_fopen'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x1e): undefined reference to
.2static / lib // libopencv_highgui.a(grfmt_jpeg2000.cpp.o):機能中cv::Jpeg2KDecoder::readData(cv::Mat&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x5c): undefined reference to
jas_image_getcmptbytype 'grfmt_jpeg2000.cpp :( jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x74): undefined reference to
text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE + 0x68):未定義の参照にjas_image_getcmptbytype' grfmt_jpeg2000.cpp :( text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE + 0xb8):に未定義参照jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x126): undefined reference to
jas_matrix_create」grfmt_jpeg2000.cpp :( text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE + 0x13e)。 :への未定義参照jas_image_readcmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x16e): undefined reference to
jas_matrix_destroy 'grfmt_jpeg2000.cpp :( text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE + 0x184):未定義の参照にjas_cmprof_createfromclrspc'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x194): undefined reference to
jas_image_chclrspc' grfmt_jpeg2000.cpp :( text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE + 0x1a2):に未定義参照jas_image_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x1ac): undefined reference to
jas_cmprof_destroy」grfmt_jpeg2000.cpp :(テキスト。 _ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE + 0x220):未定義の参照jas_cmprof_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function
cv :: Jpeg2KEncoder :: writeComponent8u(void *、cv :: Mat const&)':grfmt_jpeg2000.cpp:(。text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE jas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0x86): undefined reference to
+ jas_matrix_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function
cv :: Jpeg2KEncoder :: writeComponent16u(void *、cv :: Mat const&)'への未定義の参照:grfmt_jpeg2000.cpp:(。text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE + 0x1c):jas_image_cmへの未定義のjas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0x86): undefined reference to
参照0xa0):jas_matrix_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function
cv :: Jpeg2KEncoder :: write(cv :: Mat const&、std :: vector> const&)'への未定義の参照':grfmt_jpeg2000.cpp:(。text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0未定義の参照jas_image_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x8c): undefined reference to
jas_image_destroy 'grfmt_jpeg2000.cpp :( text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0xbe):未定義の参照にjas_stream_fopen'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xcc): undefined reference to
jas_image_strtofmt' grfmt_jpeg2000.cpp :( text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0xda):未定義の参照jas_image_encode'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xe8): undefined reference to
jas_stream_close」/home/nandhini/opencv/2.4.2static/lib //libopencv_highgui.a(grfmt_jpeg2000.cpp.o):関数_GLOBAL__sub_I_grfmt_jpeg2000.cpp':
grfmt_jpeg2000.cpp:(.text.startup._GLOBAL__sub_I_grfmt_jpeg2000.cpp+0x2): undefined reference to
jas_init'/home/nandhini/opencv/2.4.2static/lib//libopencv_imgproc.a(templmatch.cpp.o):関数cv::crossCorr(cv::Mat const&, cv::Mat const&, cv::Mat&, cv::Size_<int>, int, cv::Point_<int>, double, int)':
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0x318): undefined reference to
cv :: getOptimalDFTSize(int )'templmatch.cpp:(。text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi + 0x33c):未定義の参照cv::getOptimalDFTSize(int)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0x7c4): undefined reference to
cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0xf66): undefined reference to
cv :: dft( cv :: _ InputArray const&、cv :: _ OutputArray const&、int、int)'templmatch.cpp:(。text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi + 0xefc):undefined :: _ InputArray const&、cv :: _ OutputArray const&、int、bool)'templmatch.cpp:(。text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi + 0xf8e):cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In function
cv :: PngDe ':grfmt_png.cpp:(。text._ZN2cv10PngDecoder15readDataFromBufEPvPhj + 0xc):png_errorへの未定義の参照png_get_io_ptr'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder15readDataFromBufEPvPhj+0x10a): undefined reference to
' /home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o):関数cv::PngDecoder::close()':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder5closeEv+0x26): undefined reference to
png_ home / nandhini / opencv / 2.4.2static / lib // libopencv_highgui.a(grfmt_png.cpp。o):機能中cv::PngDecoder::readHeader()':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x18): undefined reference to
png_create_read_struct'grfmt_png.cpp:(。text._ZN2cv10PngDecoder10readHeaderEv + 0x22):png_create_info_struct'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x2a): undefined reference to
png_create_info_struct'への未定義の参照png_set_longjmp_fn'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xae): undefined reference to
grfmt_png.cpp:(。text._ZN2cv10PngDecoder10readHeaderEv + 0x6a) :png_get_IHDRへの未定義の参照png_read_info'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xf0): undefined reference to
'grfmt_png.cpp:(。text._ZN2cv10PngDecoder10readHeaderEv + 0x166):png_set_read_fn'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In function
cv :: PngEncoder :: write(cv :: Mat const&、std :: vector> const&)'への未定義の参照:grfmt_png.c .text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x18):png_create_write_struct'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x7a): undefined reference to
png_create_info_struct'への未定義の参照grfmt_png.cpp:(。text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE +png_set_longjmp_fn'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xce): undefined reference to
png_set_write_fn 'grfmt_png.cpp :( text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x14a):に未定義の参照png_set_compression_mem_level'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x158): undefined reference to
png_set_compression_strategy' grfmt_png.cpp :( text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x19a):に未定義の参照png_set_IHDR'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ae): undefined reference to
png_write_info」grfmt_png.cpp :( text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x1ba)。 :png_set_bgr'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ce): undefined reference to
png_set_swap'への未定義の参照grfmt_png.cpp:(。text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x208):png_write_end'png_write_image'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x21c): undefined reference to
への未定義の参照png_destroy_write_struct'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x284): undefined reference to
_ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x2c6):未定義の参照png_set_filter'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2d4): undefined reference to
png_set_compression_level'/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o):関数cv::PngDecoder::readData(cv::Mat&)':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x8c): undefined reference to
内png_set_longjmp_fn' grfmt_png.cpp:(。png_set_gray_to_rgb'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x102): undefined reference to
text._ZN2cv10PngDecoder8readDataERNS_3Mat .cpp:(。text._ZN2cv10PngDecoder8readDataERNS_3MatE + 0x126):png_read_image'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x12e): undefined reference to
png_read_end'への未定義の参照grfmt_png.cpp:(。text._ZN2cv10PngDecoder8readDataERNS_3MatE + 0x14e): png_set_rgへpng_set_palette_to_rgb'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x16a): undefined reference to
の未定義の参照to png_set_bgr'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x178): undefined reference to
png_set_strip_alpha'grfmt_png.cpp:(。text._ZN2cv10PngDecoder8readDataERNS_3MatE + 0x180):未定義の参照png_set_swap'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x18c): undefined reference to
png_set_expand_gray_1_2_4_to_8'grfmt_png.cpp:(。text._ZN2cv10PngDecoder8readDataERNS_3MatE + 0x194):png_set_strip_16'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In function
cv :: PngEncoder :: writeDataToBuf(void *、unsigned char *、unsigned int)':grfmへの未定義の参照:未定義の参照png_get_io_ptr'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In function
_ZN2cvL16my_jpeg_load_dhtEP22jpeg_decompress_structPhPP9JHUFF_TBLS5_.constprop.30' :。grfmt_jpeg.cpp :( text.unlikely._ZN2cvL16my_jpeg_load_dhtEP22jpeg_decompress_structPhPP9JHUFF_TBLS5_.constprop.30 + 0xA4の):未定義の参照のjpeg_alloc_huff_table'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In function
cv :: JpegEncoder ::書き込み(CV ::マットのconst&、はstd :: vector> const&)':grfmt_jpeg.cpp:(。text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x6e):未定義の参照jpeg_CreateCompress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x78): undefined reference to
jpeg_std_error:」grfmt_jpeg.cpp :( text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0xdc)に未定義の参照jpeg_destroy_compress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x194): undefined reference to
grfmt_jpeg.cpp jpeg_set_defaults' :( text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x1a2):に未定義参照jpeg_set_quality'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ae): undefined reference to
jpeg_start_compress' grfmt_jpeg.cpp :( text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x1f6)。 :未定義の参照:への未定義参照jpeg_write_scanlines'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x208): undefined reference to
text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x25e):( grfmt_jpeg.cpp jpeg_finish_compress 。grfmt_jpeg.cpp :( text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE + 0x2fa)jpeg_stdio_dest'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2a6): undefined reference to
jpeg_write_scanlines':に未定義の参照jpeg_write_scanlines'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In function
CV :: JpegDecoder ::近いです()」 :grfmt_jpeg.cpp:(。text._ZN2cv11JpegDecoder5closeEv + 0xa):未定義の参照jpeg_destroy_decompress'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In function
cv :: JpegDecoder :: readData(cv :: Mat&)':grfmt_jpeg.cpp:(。text._ZN2cv11JpegDecoder8readDataERNS_3MatE + 0x90):jpeg_read_scanlinesへの未定義の参照jpeg_start_decompress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x10a): undefined reference to
' grfmt_jpeg.cpp:(。jpeg_finish_decompress'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In function
text._ZN2c :: JpegDecoder :: readHeader()':grfmt_jpeg.cpp:(。text._ZN2cv11JpegDecoder10readHeaderEv + 0x20):jpeg_CreateDecompressへの未定義の参照' jpeg_std_error'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x56): undefined reference to
grfmt_jpeg.cpp:(。text._ZN2cv11JpegDecoder10readHead jpeg_stdio_src'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x9a): undefined reference to
(.text._ZN2cv11JpegDecoder10readHeaderEv + 0x13c):未定義の参照jpeg_resync_to_restart'
collect2: ld returned 1 exit status