rviz_visual_tools ; Visualizing a plane in rviz (ROS C++) - ros

I get an error while following this instruction from README for visual tools:
In your class' constructor add: visual_tools_.reset(new rviz_visual_tools::RvizVisualTools("base_frame","/rviz_visual_markers")); Change the first parameter to the name of your robot's base frame
After looking into the ros_param.yaml file line: robot_base_frame: base_link I changed base_frame to base_link
I get an error in CMakeFiles:
CMakeFiles/listener.dir/src/listener.cpp.o: In function main': listener.cpp:(.text+0x16fe): undefined reference torviz_visual_tools::RvizVisualTools::RvizVisualTools(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> >, ros::NodeHandle)' collect2: error: ld returned 1 exit status

Related

Clang-3.8 undefined reference to `main' when compiling object file from llvm bytecode with global variables

I'm trying to implement nested functions in llvm through the C++ API. After i perform a semantic check (to assure that the program which is going to be compiled has correct nesting references etc) i define all function in the same scope in llvm and set all variables as global. I was expecting this to work but i found myself having huge problem while getting an executable from an .o file with the command:
"llvm-as-3.8 output.ll| llc-3.8 -filetype=obj | clang-3.8 ../library/library.a -v -o out"
By using either llvm::GlobalValue::WeakAnyLinkage or llvm::GlobalValue::ExternalLinkage linkage for global variables i get:
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12
...
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
Which seems to have to do with the definition of main, who in the definition of my ir code stands as:
; Function Attrs: nounwind uwtable
define void #main() #0 {
The thing is that the same command didn't have any problem when i didn't use global variables except of course the case where a variable was used in a child function, which was the reason i tried to change alloca to global.
Help find a solution to this problem.
Thanks in advance.
Note1: I use llvm-3.8
UPDATE:
when i removed -v from the clang command the result was:
refined_output.o: In function bsort':
refined_output.ll:(.text+0x4): undefined reference tox'
refined_output.ll:(.text+0xa): undefined reference to n'
refined_output.ll:(.text+0x10): undefined reference tochanged'
refined_output.ll:(.text+0x22): undefined reference to i'
refined_output.ll:(.text+0x2c): undefined reference tochanged'
refined_output.ll:(.text+0x42): undefined reference to i'
refined_output.ll:(.text+0x48): undefined reference ton'
refined_output.ll:(.text+0x50): undefined reference to i'
refined_output.ll:(.text+0x59): undefined reference tox'
refined_output.ll:(.text+0x60): undefined reference to i'
refined_output.ll:(.text+0x75): undefined reference tox'
refined_output.ll:(.text+0x7c): undefined reference to i'
refined_output.ll:(.text+0x95): undefined reference tochanged'
refined_output.ll:(.text+0xa3): undefined reference to changed'
refined_output.o: In functionswap':
refined_output.ll:(.text+0xc3): undefined reference to x.1'
refined_output.ll:(.text+0xca): undefined reference toy'
refined_output.ll:(.text+0xd1): undefined reference to x.1'
refined_output.ll:(.text+0xd9): undefined reference tot'
refined_output.ll:(.text+0xe0): undefined reference to x.1'
refined_output.ll:(.text+0xe7): undefined reference toy'
refined_output.ll:(.text+0xf2): undefined reference to y'
refined_output.ll:(.text+0xf8): undefined reference tot'
refined_output.o: In function main':
refined_output.ll:(.text+0x102): undefined reference toi.4'
refined_output.ll:(.text+0x10c): undefined reference to seed'
refined_output.ll:(.text+0x123): undefined reference tox.2'
refined_output.ll:(.text+0x12a): undefined reference to i.4'
refined_output.ll:(.text+0x130): undefined reference toseed'
refined_output.ll:(.text+0x15d): undefined reference to seed'
refined_output.ll:(.text+0x166): undefined reference toi.4'
refined_output.ll:(.text+0x16c): undefined reference to i.4'
refined_output.ll:(.text+0x177): undefined reference tox.2'
refined_output.ll:(.text+0x18d): undefined reference to x.2'
refined_output.ll:(.text+0x19e): undefined reference tox.2'
refined_output.o: In function printArray':
refined_output.ll:(.text+0x1c4): undefined reference tomsg'
refined_output.ll:(.text+0x1cb): undefined reference to x.2'
refined_output.ll:(.text+0x1d1): undefined reference ton.3'
refined_output.ll:(.text+0x1d8): undefined reference to msg'
refined_output.ll:(.text+0x1e3): undefined reference toi.4'
refined_output.ll:(.text+0x1f3): undefined reference to x.2'
refined_output.ll:(.text+0x1fa): undefined reference toi.4'
refined_output.ll:(.text+0x208): undefined reference to i.4'
refined_output.ll:(.text+0x20e): undefined reference toi.4'
refined_output.ll:(.text+0x214): undefined reference to n.3'
refined_output.ll:(.text+0x21c): undefined reference toi.4'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Where all this variables were defined at the start of my program in llvm IR as:
#x = external global i32*
#n = external global i32
#i = external global i32
#changed = external global i1
#x.1 = external global i32*
#y = external global i32*
#t = external global i32
#msg = external global i8*
#x.2 = external global i32*
#n.3 = external global i32
#i.4 = external global i32
#const_string_temp = private constant [3 x i8] c", \00", align 1
#const_string_temp.5 = private constant [2 x i8] c"\0A\00", align 1
#i.6 = external global i32
#x.7 = external global i32
#seed = external global i32
#const_string_temp.8 = private constant [16 x i8] c"Initial array: \00", align 1
#const_string_temp.9 = private constant [15 x i8] c"Sorted array: \00", align 1
I hope this helps you help me --- or else find the problem in my IR code generation.
I'm looking forward to it..
#x = external global i32*
and so on are global variable declarations, not definitions. Therefore, the "undefined reference" error is valid and you really need to define them.
See http://llvm.org/docs/LangRef.html#global-variables for more information
Also note that llvm-as / llc part is redundant - clang could compile .ll / .bc files just fine.

OpenCV Errors - Accurate eye center tracking

1>C:\opencv243\build\include\constants.h(15): warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>C:\opencv243\build\include\constants.h(26): warning C4305: 'initializing' : truncation from 'double' to 'const float'
1>prog.cpp(16): warning C4068: unknown pragma
1>prog.cpp(44): warning C4068: unknown pragma
1>prog.cpp(48): error C3861: 'round': identifier not found
1>prog.cpp(49): error C3861: 'round': identifier not found
1>prog.cpp(54): warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
1>prog.cpp(74): warning C4068: unknown pragma
1>prog.cpp(189): warning C4068: unknown pragma
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I want to run accurate eye center tracking programme but these are my errors... Please help me to fix this.. I havent got enough time for this project..
(if All of my code is necessary , i can send it)
*EDİT*
The last status of my project; it have build errors.. :
1>------ Build started: Project: MNOpenCV, Configuration: Debug Win32 ------
1>hkjn.obj : error LNK2019: unresolved external symbol "double __cdecl computeDynamicThreshold(class cv::Mat const &,double)" (?computeDynamicThreshold##YANABVMat#cv##N#Z) referenced in function "class cv::Point_<int> __cdecl findEyeCenter(class cv::Mat,class cv::Rect_<int>,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?findEyeCenter##YA?AV?$Point_#H#cv##VMat#2#V?$Rect_#H#2#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>hkjn.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl matrixMagnitude(class cv::Mat const &,class cv::Mat const &)" (?matrixMagnitude##YA?AVMat#cv##ABV12#0#Z) referenced in function "class cv::Point_<int> __cdecl findEyeCenter(class cv::Mat,class cv::Rect_<int>,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?findEyeCenter##YA?AV?$Point_#H#cv##VMat#2#V?$Rect_#H#2#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>hkjn.obj : error LNK2019: unresolved external symbol "bool __cdecl inMat(class cv::Point_<int>,int,int)" (?inMat##YA_NV?$Point_#H#cv##HH#Z) referenced in function "bool __cdecl floodShouldPushPoint(class cv::Point_<int> const &,class cv::Mat const &)" (?floodShouldPushPoint##YA_NABV?$Point_#H#cv##ABVMat#2##Z)
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\AA\Documents\Visual Studio 2010\Projects\MNOpenCV\Debug\MNOpenCV.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Maybe you forgot to add the include for the "double round (double x)" function?
#include <math.h>
If not, it might be an issue with your pragma instructions...
C++ Round Function Reference
Best regards!

Problems with OpenCV compilation with static linking on pandaboard

I installed opencv with static linking on pandaboard using BUILD_SHARED_LIBS=0 option. I am using ubuntu 11.10. I also built 3rd party libraries png, jpeg, jasper and zlib. (cmake options BUILD_PNG=ON BUILD_JASPER=ON BUILD_JPEG=ON BUILD_ZLIB=ON WITH_JPEG=ON WITH_PNG=ON WITH_JASPER=ON). My opencv installation was successful. However when I compile a test program I get a number of undefined reference to errors. All of these errors seem to be related to jpeg, png and jasper libraries but i can't understand why libhighgui is not able to refer to 3rd party libraries when I explicitly link them. Here is how I compile my program :
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
I've been stuck with this problem for a long time now and I would really appreciate it if someone can help me solve the problem. Please help, thanks !
Here is a list of my errors :
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functionicvGets(CvFileStorage*, char*, int)':
persistence.cpp:(.text._ZL7icvGetsP13CvFileStoragePci+0x7e): undefined reference to gzgets'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In function_ZL16icvYMLSkipSpacesP13CvFileStoragePcii.constprop.61':
persistence.cpp:(.text._ZL16icvYMLSkipSpacesP13CvFileStoragePcii.constprop.61+0x11e): undefined reference to gzeof'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functionicvPuts(CvFileStorage*, char const*)':
persistence.cpp:(.text._ZL7icvPutsP13CvFileStoragePKc+0x138): undefined reference to gzputs'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functionicvXMLSkipSpaces(CvFileStorage*, char*, int)':
persistence.cpp:(.text._ZL16icvXMLSkipSpacesP13CvFileStoragePci+0x1a2): undefined reference to gzeof'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functionicvClose(CvFileStorage*, std::basic_string, std::allocator >*)':
persistence.cpp:(.text._ZL8icvCloseP13CvFileStoragePSs+0x132): undefined reference to gzclose'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functioncvOpenFileStorage':
persistence.cpp:(.text.cvOpenFileStorage+0x1b0): undefined reference to gzrewind'
persistence.cpp:(.text.cvOpenFileStorage+0x6b6): undefined reference togzclose'
persistence.cpp:(.text.cvOpenFileStorage+0x734): undefined reference to gzopen'
persistence.cpp:(.text.cvOpenFileStorage+0xcd4): undefined reference togzclose'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function cv::JasperInitializer::~JasperInitializer()':
grfmt_jpeg2000.cpp:(.text._ZN2cv17JasperInitializerD2Ev[_ZN2cv17JasperInitializerD5Ev]+0x4): undefined reference tojas_cleanup'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function cv::Jpeg2KDecoder::close()':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder5closeEv+0x8): undefined reference tojas_stream_close'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder5closeEv+0x14): undefined reference to jas_image_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In functioncv::Jpeg2KDecoder::readHeader()':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0xe): undefined reference to jas_stream_fopen'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x1e): undefined reference tojas_image_decode'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function cv::Jpeg2KDecoder::readData(cv::Mat&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x5c): undefined reference tojas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x68): undefined reference to jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x74): undefined reference tojas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0xb8): undefined reference to jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x126): undefined reference tojas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x13e): undefined reference to jas_image_readcmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x16e): undefined reference tojas_matrix_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x184): undefined reference to jas_cmprof_createfromclrspc'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x194): undefined reference tojas_image_chclrspc'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x1a2): undefined reference to jas_image_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x1ac): undefined reference tojas_cmprof_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x220): undefined reference to jas_cmprof_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In functioncv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0x1c): undefined reference to jas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0x86): undefined reference tojas_image_writecmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0xa0): undefined reference to jas_matrix_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In functioncv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0x1c): undefined reference to jas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0x86): undefined reference tojas_image_writecmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0xa0): undefined reference to jas_matrix_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In functioncv::Jpeg2KEncoder::write(cv::Mat const&, std::vector > const&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x5a): undefined reference to jas_image_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x8c): undefined reference tojas_image_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xbe): undefined reference to jas_stream_fopen'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xcc): undefined reference tojas_image_strtofmt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xda): undefined reference to jas_image_encode'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xe8): undefined reference tojas_stream_close'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function _GLOBAL__sub_I_grfmt_jpeg2000.cpp':
grfmt_jpeg2000.cpp:(.text.startup._GLOBAL__sub_I_grfmt_jpeg2000.cpp+0x2): undefined reference tojas_init'
/home/nandhini/opencv/2.4.2static/lib//libopencv_imgproc.a(templmatch.cpp.o): In function 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 tocv::getOptimalDFTSize(int)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0x33c): undefined reference to cv::getOptimalDFTSize(int)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0x7c4): undefined reference tocv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0xefc): 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 tocv::mulSpectrums(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int, bool)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0xf8e): undefined reference to 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 functioncv::PngDecoder::readDataFromBuf(void*, unsigned char*, unsigned int)':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder15readDataFromBufEPvPhj+0xc): undefined reference to png_get_io_ptr'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder15readDataFromBufEPvPhj+0x10a): undefined reference topng_error'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In function cv::PngDecoder::close()':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder5closeEv+0x26): undefined reference topng_destroy_read_struct'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In function cv::PngDecoder::readHeader()':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x18): undefined reference topng_create_read_struct'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x22): undefined reference to png_create_info_struct'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x2a): undefined reference topng_create_info_struct'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x6a): undefined reference to png_set_longjmp_fn'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xae): undefined reference topng_init_io'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xd8): undefined reference to png_read_info'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xf0): undefined reference topng_get_IHDR'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x166): undefined reference to png_set_read_fn'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In functioncv::PngEncoder::write(cv::Mat const&, std::vector > const&)':
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x18): undefined reference to png_create_write_struct'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x7a): undefined reference topng_create_info_struct'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x9e): undefined reference to png_set_longjmp_fn'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xce): undefined reference topng_set_write_fn'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x14a): undefined reference to png_set_compression_mem_level'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x158): undefined reference topng_set_compression_strategy'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x19a): undefined reference to png_set_IHDR'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ae): undefined reference topng_write_info'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ba): undefined reference to png_set_bgr'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ce): undefined reference topng_set_swap'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x208): undefined reference to png_write_image'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x21c): undefined reference topng_write_end'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x22e): undefined reference to png_destroy_write_struct'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x284): undefined reference topng_init_io'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2c6): undefined reference to png_set_filter'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2d4): undefined reference topng_set_compression_level'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In function cv::PngDecoder::readData(cv::Mat&)':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x8c): undefined reference topng_set_longjmp_fn'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0xfa): undefined reference to png_set_gray_to_rgb'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x102): undefined reference topng_read_update_info'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x126): undefined reference to png_read_image'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x12e): undefined reference topng_read_end'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x14e): undefined reference to png_set_palette_to_rgb'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x16a): undefined reference topng_set_rgb_to_gray'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x170): undefined reference to png_set_bgr'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x178): undefined reference topng_set_strip_alpha'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x180): undefined reference to png_set_swap'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x18c): undefined reference topng_set_expand_gray_1_2_4_to_8'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x194): undefined reference to png_set_strip_16'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In functioncv::PngEncoder::writeDataToBuf(void*, unsigned char*, unsigned int)':
grfmt_png.cpp:(.text._ZN2cv10PngEncoder14writeDataToBufEPvPhj+0x16): undefined reference to 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): undefined reference to jpeg_alloc_huff_table'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In functioncv::JpegEncoder::write(cv::Mat const&, std::vector > const&)':
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x6e): undefined reference to jpeg_CreateCompress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x78): undefined reference tojpeg_std_error'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xdc): undefined reference to jpeg_destroy_compress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x194): undefined reference tojpeg_set_defaults'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1a2): undefined reference to jpeg_set_quality'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ae): undefined reference tojpeg_start_compress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1f6): undefined reference to jpeg_write_scanlines'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x208): undefined reference tojpeg_finish_compress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x25e): undefined reference to jpeg_stdio_dest'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2a6): undefined reference tojpeg_write_scanlines'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2fa): undefined reference to jpeg_write_scanlines'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In functioncv::JpegDecoder::close()':
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder5closeEv+0xa): undefined reference to jpeg_destroy_decompress'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In functioncv::JpegDecoder::readData(cv::Mat&)':
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x90): undefined reference to jpeg_start_decompress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x10a): undefined reference tojpeg_read_scanlines'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x15a): undefined reference to jpeg_finish_decompress'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In functioncv::JpegDecoder::readHeader()':
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x20): undefined reference to jpeg_std_error'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x56): undefined reference tojpeg_CreateDecompress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x92): undefined reference to jpeg_stdio_src'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x9a): undefined reference tojpeg_read_header'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x13c): undefined reference to jpeg_resync_to_restart'
collect2: ld returned 1 exit status
The order in which libraries are linked matters! This might be the problem.

Using Opencv as a static lib on a cross-compiling project

I'm using opencv on a arm board,with a cortex a8 processor and running on Debian.I wanted to use the processor's fpu to increase the performance of my application,so I succesfully cross-compiled opencv (following this guide) using a toolchain generated for this purpose.
With that said,I dont have experience with working with static libraries.When I compile my code,I get a lot of linking errors.Apparently,they are related with zlib or zlib2,as I've seen on this topic.The thing is,I didn't enabled the png support,but I still get those linking errors:
cxpersistence.cpp:(.text._ZL8icvCloseP13CvFileStorage+0x24): undefined reference to `gzclose'
/cv-lib-arm-hf/lib/libcxcore.a(cxpersistence.o): In function `icvPuts(CvFileStorage*, char const*)':
cxpersistence.cpp:(.text._ZL7icvPutsP13CvFileStoragePKc+0x3c): undefined reference to `gzputs'
/cv-lib-arm-hf/lib/libcxcore.a(cxpersistence.o): In function `icvGets(CvFileStorage*, char*, int)':
cxpersistence.cpp:(.text._ZL7icvGetsP13CvFileStoragePci+0x4c): undefined reference to `gzgets'
/cv-lib-arm-hf/lib/libcxcore.a(cxpersistence.o): In function `icvEof(CvFileStorage*)':
cxpersistence.cpp:(.text._ZL6icvEofP13CvFileStorage+0x30): undefined reference to `gzeof'
cxpersistence.cpp:(.text._ZL6icvEofP13CvFileStorage+0xc4): undefined reference to `gzeof'
/cv-lib-arm-hf/lib/libcxcore.a(cxpersistence.o): In function `cvOpenFileStorage':
cxpersistence.cpp:(.text.cvOpenFileStorage+0x674): undefined reference to `gzopen'
cxpersistence.cpp:(.text.cvOpenFileStorage+0xae8): undefined reference to `gzrewind'
cxpersistence.cpp:(.text.cvOpenFileStorage+0xb98): undefined reference to `gzrewind'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::SVD::operator()(cv::Mat const&, int)':
cxlapack.cpp:(.text._ZN2cv3SVDclERKNS_3MatEi+0x2b0): undefined reference to `dgesdd_'
cxlapack.cpp:(.text._ZN2cv3SVDclERKNS_3MatEi+0x4b8): undefined reference to `dgesdd_'
cxlapack.cpp:(.text._ZN2cv3SVDclERKNS_3MatEi+0x74c): undefined reference to `sgesdd_'
cxlapack.cpp:(.text._ZN2cv3SVDclERKNS_3MatEi+0x874): undefined reference to `sgesdd_'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::eigen(cv::Mat const&, cv::Mat&, cv::Mat&, bool, int, int)':
cxlapack.cpp:(.text._ZN2cvL5eigenERKNS_3MatERS0_S3_bii+0x4bc): undefined reference to `dsyevr_'
cxlapack.cpp:(.text._ZN2cvL5eigenERKNS_3MatERS0_S3_bii+0x66c): undefined reference to `dsyevr_'
cxlapack.cpp:(.text._ZN2cvL5eigenERKNS_3MatERS0_S3_bii+0xa7c): undefined reference to `ssyevr_'
cxlapack.cpp:(.text._ZN2cvL5eigenERKNS_3MatERS0_S3_bii+0xc30): undefined reference to `ssyevr_'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::solve(cv::Mat const&, cv::Mat const&, cv::Mat&, int)':
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x760): undefined reference to `dgelsd_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x8fc): undefined reference to `dgelsd_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0xb8c): undefined reference to `dgesv_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x1018): undefined reference to `dpotrf_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x105c): undefined reference to `dpotrs_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x10d4): undefined reference to `dgels_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x115c): undefined reference to `dgels_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x11e0): undefined reference to `sgelsd_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x123c): undefined reference to `sgelsd_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x12e0): undefined reference to `spotrf_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x1324): undefined reference to `spotrs_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x1398): undefined reference to `sgels_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x13e8): undefined reference to `sgels_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x1468): undefined reference to `sgesv_'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::determinant(cv::Mat const&)':
cxlapack.cpp:(.text._ZN2cv11determinantERKNS_3MatE+0x298): undefined reference to `dgetrf_'
cxlapack.cpp:(.text._ZN2cv11determinantERKNS_3MatE+0x40c): undefined reference to `sgetrf_'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::invert(cv::Mat const&, cv::Mat&, int)':
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0x460): undefined reference to `dgetri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0x4c8): undefined reference to `dgetrf_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0x7e4): undefined reference to `dpotrf_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0x82c): undefined reference to `sgetri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xa78): undefined reference to `sgetrf_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xab0): undefined reference to `sgetri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xaf8): undefined reference to `dgetri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xb28): undefined reference to `spotrf_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xb5c): undefined reference to `spotri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xb84): undefined reference to `dpotri_'
Can anyone shed a light on what I need to do?What am I missing?
UPDATE:
I tried compiling zlib and bzip2 using the same toolchain,but the error persists.Now I have no idea of what I'm doing wrong.Can anyone help?

Errors while building ACE program

i just started ACE with a "HELLO WORLD" program. It compiled successfully but while building it produces some of the errors.Can anyone help me.
CODE:
#include <stdio.h>
#include "ace/Log_Msg.h"
#include "ace/OS_main.h"
int ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
ACE_DEBUG((LM_DEBUG, "Hello World\n"));
return 0;
}
ERROR:
/tmp/cccwdbA0.o: In function `main':
hello.cpp:(.text+0xa): undefined reference to `ACE_Log_Msg::last_error_adapter()'
hello.cpp:(.text+0x13): undefined reference to `ACE_Log_Msg::instance()'
hello.cpp:(.text+0x43): undefined reference to `ACE_Log_Msg::conditional_set(char const*, int, int, int)'
hello.cpp:(.text+0x5f): undefined reference to `ACE_Log_Msg::log(ACE_Log_Priority, char const*, ...)'
collect2: ld returned 1 exit status
Compilation failed.
Without seeing the build commands it's hard to tell but it looks like you didn't add a link-time reference to the ACE library.
It's hard to tell what you've done to make this not work. If I were to guess, it looks as if you've updated your include path in your makefile but forgotten to link libACE.so to your project. This would result in the undefined compilation behaviour you're seeing.

Resources