Linking Issue In opencv_createsamples - opencv

I'm setting up opencv 2.4.10 in an NVidia/Cuda:7.5-cudnn4-devel-centos7 Docker container. Running make install works almost to completion, then I get this error:
[ 99%] Built target opencv_haartraining_engine
Linking CXX executable ../../bin/opencv_createsamples
CMakeFiles/opencv_createsamples.dir/createsamples.cpp.o: In function `main':
createsamples.cpp:(.text.startup.main+0x2cb): undefined reference to `JpgDatasetGenerator::JpgDatasetGenerator(char const*)'
createsamples.cpp:(.text.startup.main+0x31f): undefined reference to `DatasetGenerator::create(char const*, int, int, char const*, int, int, int, double, double, double, bool, int, int)'
createsamples.cpp:(.text.startup.main+0x773): undefined reference to `PngDatasetGenerator::PngDatasetGenerator(char const*)'
createsamples.cpp:(.text.startup.main+0x7af): undefined reference to `cvCreateTrainingSamplesFromInfo(char const*, char const*, int, int, int, int)'
createsamples.cpp:(.text.startup.main+0x814): undefined reference to `cvCreateTrainingSamples(char const*, char const*, int, int, char const*, int, int, int, double, double, double, bool, int, int)'
createsamples.cpp:(.text.startup.main+0x857): undefined reference to `cvShowVecSamples(char const*, int, int, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_createsamples] Error 1
make[1]: *** [apps/haartraining/CMakeFiles/opencv_createsamples.dir/all] Error 2
make: *** [all] Error 2
I am able to get opencv 2.4.10 to work with CUDA 7.0 in CentOS 6, but this issue appears in CentOS 7 with CUDA 7.5.

I'm still unsure why this step was necessary here and not in my CentOS 6/CUDA 7.0 setup; I also find it surprising that this fix was not necessary until so far into the make install process, but the solution was simply
make clean
then
make install

Related

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_FIRMessaging"

Hello I am trying to build a firebase unity project in Xcode, after running pod install
and start building the project I get this error :
Undefined symbols for architecture arm64:
"OBJC_CLASS$_FIRMessaging", referenced from:
objc-class-ref in libFirebaseCppMessaging.a(messaging_231c52c311096cfce13e67fa91eb9ac5.o)
"firebase::ReferenceCountedFutureImpl::CompleteHandle(unsigned long)", referenced from:
void firebase::ReferenceCountedFutureImpl::CompleteInternal<void, void firebase::ReferenceCountedFutureImpl::CompleteInternal(unsigned long, int, char const*)::'lambda'(void*)>(unsigned long, int, char const*, void firebase::ReferenceCountedFutureImpl::CompleteInternal(unsigned long, int, char const*)::'lambda'(void*) const&) in libFirebaseCppMessaging.a(messaging_231c52c311096cfce13e67fa91eb9ac5.o)
"firebase::ReferenceCountedFutureImpl::ReleaseMutexAndRunCallback(unsigned long)", referenced from:
void firebase::ReferenceCountedFutureImpl::CompleteInternal<void, void firebase::ReferenceCountedFutureImpl::CompleteInternal(unsigned long, int, char const*)::'lambda'(void*)>(unsigned long, int, char const*, void firebase::ReferenceCountedFutureImpl::CompleteInternal(unsigned long, int, char const*)::'lambda'(void*) const&) in libFirebaseCppMessaging.a(messaging_231c52c311096cfce13e67fa91eb9ac5.o)
"firebase::util::ClassMethodImplementationCache::ReplaceOrAddMethod(objc_class*, objc_selector*, objc_object* ()(objc_object, objc_selector*, ...), objc_class*, bool)", referenced from:
_FirebaseMessagingHookAppDelegate in libFirebaseCppMessaging.a(messaging_231c52c311096cfce13e67fa91eb9ac5.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
any help?
One thing that you can do is make sure you've added your pod file correctly. Check the syntax is correct and if it's not working at all do a pod deinit, clean your build folder, then reinstall the pod again and run your project.
Making sure there is a link between your target and the file also could be worth looking at. Go to your project manager, select your target, and the link binary with libraries and add your pod file that way.
Xcode unittest build failed with error "Undefined symbols for architecture x86_64"
this helped also when looking around how to solve this. Best of luck.

Caffe build fails repeatedly

I am trying to compile the software OpenPose on an Ubuntu 14 machine. The installation script installs Caffe. While installing Caffe, I get the following error message:
CXX tools/upgrade_net_proto_text.cpp
CXX/LD -o .build_release/tools/upgrade_net_proto_text.bin
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1
From here, I have tried running ldconfig, I use OpenCV 3.2.0, so I have uncommented that in the makefile. I have also tried updating the OpenCV path in ~/.bashrc but I am not sure if I did it correctly. I did:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
After each of these steps, I ran the install script again but it fails with the same error message (shown above) every time.
I haven't seen anyone so far who successfully installed caffe with openCV 3.2.0,i faced the same problem and what i did was to downgrade to OpenCV 3.1.Another problem that came along was missing modules that are in open_contrib that you should install along opencv,i d refer you to this answer also related to OpenPose here

How to compile OpenCV in HEVC with Cmake?

I am modifying HEVC opensource project downloaded from bitbucket.
I have added OpenCV libraries now for some frame processing.
Code works fine with visual studio.
Problem is when I try to make it with cmake following error is producing:
libx265.so.102: undefined reference to `cv::dilate(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Point_<int>, int, int, cv::Scalar_<double> const&)'

Xcode: Undefined symbols for architecture i386: DebugStringToFile when building Unity Project for iOS Simulator

I'm struggling with a Linker Error for an iOS project that was created with Unity 4.2.2.
Since the last update of Unity, Xcode can't compile the project anymore, giving me the following error message:
Undefined symbols for architecture i386: "DebugStringToFile(char
const*, int, char const*, int, int, int, int, int)", referenced from:
prcore::Surface::ClearImage(prcore::color32 const&, prcore::Surface::ClearMode) in libiPhone-lib.a(blitter_integer.o)
prcore::Surface::BlitImage(prcore::Surface const&, prcore::Surface::BlitMode) in libiPhone-lib.a(blitter_integer.o) ld:
symbol(s) not found for architecture i386 clang: error: linker command
failed with exit code 1 (use -v to see invocation)
Screenshot:
Choosing the Device SDK and running it on the device works totally fine. But building for the iOS Simulator fails, no matter which settings I try to set in the project settings...
Unfortunately, this a bug in Unity 4.2.2, but will hopefully be fixed soon.
For the meanwhile, this simple workaround will do the job:
open the class main.mm in Xcode
satisfy the Linker by adding a definition for the missing function DebugStringToFile:
void DebugStringToFile(char const*, int, char const*, int, int, int, int, int) { }
Finally, hit build and you're good to go!
Update: Fixed in Unity 4.3:
iOS: Fixed iOS7 simulator support.
iOS: Fixed Xcode 5 build & run for simulator target

ROS Roboearth Ubuntu 12.04 vision_opencv linking error

I have tried asking this question on ROS answers with no luck so I am going to try here.
I am trying to compile the ROS Roboearth package and there seem to be some linking errors with vision_opencv.
When I first tried compiling via the instructions provided I was not able to do build because I had old compiler and I did not have Fuerte. So, I upgraded my Ubuntu to 12.04 and updated to ROS Fuerte.
I then realized that 12.04 does not have the required ros-fuerte-vision-opencv2 dependency. So, I compiled and built OpenCV 2.4.3 from source, that went great. I then realized that I am also not able to pull ros-fuerte-vision-opencv which I again got from here, checked out the "fuerte" branch and compiled in /opt/ros/fuerte/stacks/vision_opencv.
Now, when I try to make roboearth via
rosmake roboearth
I get the following linking errors.
Thank you for your help. It may be just my lack of knowledge of C++ but I tried everything from checking dependencies to re-setting the order of compiler flags and dependencies and I just can't seem to get this to work.
[rosmake-1] Starting >>> ar_pose [ make ]
[ rosmake ] Last 40 lines_vision: 30.7 sec ] [ ar_pose: 4.2 sec ] [ 2 Active 47/103 Complete ]
{-------------------------------------------------------------------------------
make[3]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
[ 70%] Built target rosbuild_precompile
make[3]: Entering directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
make[3]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
make[3]: Entering directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
Linking CXX executable ../bin/ar_multi
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `ar_pose::ARSinglePublisher::arInit()':
/home/sasha/ros/stacks/ccny_vision/ar_pose/src/ar_multi.cpp:140: undefined reference to `cvCreateImage'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `CvBridge':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:67: undefined reference to `cvCreateImageHeader'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `~CvBridge':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:73: undefined reference to `cvReleaseImageHeader'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:78: undefined reference to `cvReleaseImage'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::reallocIfNeeded_(_IplImage**, CvSize, int, int)':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:91: undefined reference to `cvReleaseImage'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:97: undefined reference to `cvCreateImage'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::reallocIfNeeded(_IplImage**, int, int)':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:109: undefined reference to `cvGetSize'
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::fromImage(sensor_msgs::Image_<std::allocator<void> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:199: undefined reference to `cvInitMatHeader'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:200: undefined reference to `cvGetImage'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:229: undefined reference to `cvCreateMat'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:230: undefined reference to `cvConvertScale'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:236: undefined reference to `cvConvertScale'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:243: undefined reference to `cvCvtColor'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:245: undefined reference to `cvCvtColor'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:247: undefined reference to `cvCvtColor'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:249: undefined reference to `cvCvtColor'
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:253: undefined reference to `cvCvtColor'
CMakeFiles/ar_multi.dir/src/ar_multi.o:/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:255: more undefined references to `cvCvtColor' follow
CMakeFiles/ar_multi.dir/src/ar_multi.o: In function `sensor_msgs::CvBridge::fromImage(sensor_msgs::Image_<std::allocator<void> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/opt/ros/fuerte/stacks/vision_opencv/cv_bridge/include/cv_bridge/CvBridge.h:293: undefined reference to `cvReleaseMat'
collect2: ld returned 1 exit status
make[3]: *** [../bin/ar_multi] Error 1
make[3]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
make[2]: *** [CMakeFiles/ar_multi.dir/all] Error 2
make[2]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sasha/ros/stacks/ccny_vision/ar_pose/build'
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package ar_pose written to:
[ rosmake ] /home/sasha/.ros/rosmake/rosmake_output-20130212-145046/ar_pose/build_output.log
[rosmake-1] Finished <<< ar_pose [FAIL] [ 4.31 seconds ]
[ rosmake ] Halting due to failure in package ar_pose.
[ rosmake ] Waiting for other threads to complete.
[ rosmake ] Last 40 lines_vision: 182.3 sec ] [ 1 Active 47/103 Complete ]
{-------------------------------------------------------------------------------
../lib/libObjectDetectorFunctions.so: undefined reference to `cvReleaseMat'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::reshape(int, int, int const*) const'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvSetZero'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::warpPerspective(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::getTextSize(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, double, int, int*)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::zeros(int, int, int)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::_InputArray::_InputArray(cv::MatExpr const&)'
../lib/libDVision.so: undefined reference to `cv::read(cv::FileNode const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::DescriptorMatcher::DescriptorCollection::~DescriptorCollection()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::FlannBasedMatcher::train()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvCvtColor'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
../lib/libDVision.so: undefined reference to `cv::FeatureDetector::~FeatureDetector()'
../lib/libDUtilsCV.so: undefined reference to `cv::line(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)'
../lib/libDVision.so: undefined reference to `cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::initUndistortRectifyMap(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, int, cv::_OutputArray const&, cv::_OutputArray const&)'
../lib/libDVision.so: undefined reference to `cv::WriteStructContext::~WriteStructContext()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvCreateImageHeader'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::inv(int) const'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&)'
../lib/libDVision.so: undefined reference to `cv::operator<<(cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::flann::IndexParams::~IndexParams()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvGetSize'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Mat::deallocate()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::_InputArray::_InputArray(double const&)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cvCreateImage'
../lib/libDUtilsCV.so: undefined reference to `cv::namedWindow(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::Algorithm::~Algorithm()'
../lib/libObjectDetectorFunctions.so: undefined reference to `cv::FlannBasedMatcher::FlannBasedMatcher(cv::Ptr<cv::flann::IndexParams> const&, cv::Ptr<cv::flann::SearchParams> const&)'
../lib/libDVision.so: undefined reference to `cv::Algorithm::set(char const*, bool)'
collect2: ld returned 1 exit status
make[3]: *** [../bin/ObjectDetector] Error 1
make[3]: Leaving directory `/home/sasha/ros/stacks/roboearth/re_vision/build'
make[2]: *** [CMakeFiles/ObjectDetector.dir/all] Error 2
make[2]: Leaving directory `/home/sasha/ros/stacks/roboearth/re_vision/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sasha/ros/stacks/roboearth/re_vision/build'
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package re_vision written to:
[ rosmake ] /home/sasha/.ros/rosmake/rosmake_output-20130212-145046/re_vision/build_output.log
[rosmake-0] Finished <<< re_vision [FAIL] [ 182.31 seconds ]
[ rosmake ] Halting due to failure in package re_vision.
Ok so I was able to solve the problem.
First I did sudo apt-get update and I saw that I was getting the following message:
W: Duplicate sources.list entry http://archive.canonical.com/ubuntu/ precise/partner i386 Packages (/var/lib/apt/lists/archive.canonical.com_ubuntu_dists_precise_partner_binary-i386_Packages)
To resolve this I went to `Synaptic Package Manager-> Settings -> Repositories -> Other Software' and unchecked "Canonical Partners - Added by software center".
Then did sudo apt-get update again. This solved the above problem.
Then, I went to the following file /etc/apt/sources.list.d/ros-latest.list and saw that the url was commented out. I uncommented the following line deb http://packages.ros.org/ros/ubuntu precise main and ran sudo apt-get update again.
After this point I was able to install all of the dependencies which are needed for roboearth and via apt-get and was able to successfully make roboearth with rosmake roboearth

Resources