Compiling ROS Kinetec from source fails when building opencv - opencv

I'm using an Arch machine and trying to compile ROS desktop full from source. The build fails when image_proc is trying to link executable.
Here is the error log:
[ 23%] Built target image_proc_gencfg
[ 84%] Built target image_proc
[ 92%] Linking CXX executable /home/alphayed/ROS/ros_catkin_ws/devel_isolated/image_proc/lib/image_proc/image_proc
/home/alphayed/ROS/ros_catkin_ws/install_isolated/lib/libopencv_viz3.so.3.1.0: undefined reference to `vtkSTLReader::New()'
/home/alphayed/ROS/ros_catkin_ws/install_isolated/lib/libopencv_viz3.so.3.1.0: undefined reference to `vtkOBJReader::New()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/image_proc_exe.dir/build.make:219: /home/alphayed/ROS/ros_catkin_ws/devel_isolated/image_proc/lib/image_proc/image_proc] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/image_proc_exe.dir/all] Error 2
make: *** [Makefile:139: all] Error 2
I think the problem is related to opencv3. I removed it from the system and recompiled it from source but that didn't solve the issue. Can you please help?

I have found a fix as per this thread. You need to modify opencv3/cmake/OpenCVDetectVTK.cmake, for every find_package(VTK QUIET COMPONENTS ... add an entry vtkIOGeometry

Related

When trying to build Halide on Linux system with llvm-10.0 on release/10.x and master branches, facing the below issue

[ 53%] Linking CXX executable test_function_dag
/bin/ld: ../../libHalide.so.10.0.0: undefined reference to `typeinfo for llvm::SectionMemoryManager'
collect2: error: ld returned 1 exit status
make[2]: *** [src/autoschedulers/adams2019/CMakeFiles/test_function_dag.dir/build.make:134: src/autoschedulers/adams2019/test_function_dag] Error 1
make[1]: *** [CMakeFiles/Makefile2:2328: src/autoschedulers/adams2019/CMakeFiles/test_function_dag.dir/all] Error 2
make: *** [Makefile:182: all] Error 2
I'm using pre-built LLVM binaries and below cmake command to configure
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_DIR=/home/harry/llvm/lib/cmake/llvm ../
Any advice and suggestions will be greatly appreciated.
I cloned Halide from release/10.x, and compiled against the LLVM 10.0.0 binaries obtained here. On Ubuntu 20.04 LTS, I had to also apt install libtinfo5 because these binaries are built against old system libraries.
I noticed that the official binaries are not built with RTTI enabled (ugh) and was able to repro and fix. There's a bug in dependencies/llvm/CMakeLists.txt. Find the line that reads:
$<$<COMPILE_LANG_AND_ID:CXX,GCC,Clang,AppleClang>:-fno-rtti>)
and change GCC to GNU. We don't test with non-RTTI LLVM, which is why this wasn't caught.

Error building opencv on a raspberry pi 3

I was following this example and received the following error when running make
In file included from /root/src/opencv-3.1.0/modules/videoio/src/cap_ffmpeg.cpp:45:0:
/root/src/opencv-3.1.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool OutputMediaStream_FFMPEG::open(const char*, int, int, double)’:
/root/src/opencv-3.1.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2207:41: warning: ignoring return value of ‘int avformat_write_header(AVFormatContext*, AVDictionary**)’, declared with attribute warn_unused_result [-Wunused-result]
avformat_write_header(oc_, NULL);
^
Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/lib/libx264.a(common.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libx264.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:215: recipe for target 'lib/libopencv_videoio.so.3.1.0' failed
make[2]: *** [lib/libopencv_videoio.so.3.1.0] Error 1
CMakeFiles/Makefile2:4058: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2
I have successfully installed opencv on Raspberry Pi 3 by following the steps in the link http://www.pyimagesearch.com/2015/02/23/install-opencv-and-python-on-your-raspberry-pi-2-and-b/
The changes i made while following the steps are:
Use 'aptitude' instead of 'apt-get' and accept all recommendations given
Before following Step 11, run 'source ~/.profile'. To quit, run 'deactivate'
Hope this helps :)

Wireshark make error: undefined reference to symbol 'g_module_name'

I'm trying to compile wireshark-P2P-1.7.0 but it fails showing the following error:
/usr/bin/ld: gtk/libui.a(libui_a-plugins_dlg.o): undefined reference to symbol 'g_module_name'
//usr/lib/i386-linux-gnu/libgmodule-2.0.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [wireshark] Error 1
make[2]: Leaving directory `/home/sniffer/Desktop/P2P_install/Sigma_Sniffer-P2P-Ubuntu_v8.1.0/wireshark-P2P-1.7.0'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/sniffer/Desktop/P2P_install/Sigma_Sniffer-P2P-Ubuntu_v8.1.0/wireshark-P2P-1.7.0'
make: *** [all] Error 2
I'm not sure if it requires special libraries to run on a 64bit processor since this version of wireshark is 32 bit.
I cannot use a standard version of wireshark or download it from anywhere else. I have to use this one because is specially configure to make WFA tests.
Thank you!!
Oscar.
The only way a source code version of Wireshark would "[be] 32 bit" would be if somebody had added code to it that assumed that long or pointer data types were 32-bit; no code in the Wireshark source from wireshark.org is "32 bit" or "64 bit", it's all portable (and the Wireshark build infrastructure builds and tests both 32-bit and 64-bit versions).
What it does need is a version of GLib that includes g_module_name(), and you need to be linking with GLib (Wireshark uses it).

I cannot obtain the rpm of ContextBroker

I have tried to obtain the rpm associated to ContextBroker component (https://github.com/telefonicaid/fiware-orion.git) but I have obtained the following error after executing make rpm.
[ 98%] Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/mongoNotifyContextAvailability.cpp.o
Linking CXX static library libmongoBackend.a
make[4]: Leaving directory `/home/develenv/app/jenkins/config-history/jobs/ContextBroker-Build/fiware-orion/rpm/BUILD/contextBroker-0.14.1_next/BUILD_RELEASE'
[ 98%] Built target mongoBackend
make[3]: Leaving directory `/home/develenv/app/jenkins/config-history/jobs/ContextBroker-Build/fiware-orion/rpm/BUILD/contextBroker-0.14.1_next/BUILD_RELEASE'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/develenv/app/jenkins/config-history/jobs/ContextBroker-Build/fiware-orion/rpm/BUILD/contextBroker-0.14.1_next/BUILD_RELEASE'
make[1]: *** [release] Error 2
make[1]: Leaving directory `/home/develenv/app/jenkins/config-history/jobs/ContextBroker-Build/fiware-orion/rpm/BUILD/contextBroker-0.14.1_next'
error: Bad exit status from /var/tmp/rpm-tmp.NPtnCN (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.NPtnCN (%build)
make: *** [rpm] Error 1
Previously to this stage I compiled and executed the unit tests as well as functional tests with no problems I am working on Red Hat 4.4.7-3 with repo/branch:
https://github.com/telefonicaid/fiware-orion/tree/release/iotplatform-v1
Thanks for your help
UPDATE:
The linux distribution used was CentOS 6.4
This problems is solved if you install cantcoap and COAP client, as described in the Orion README.md file, then execute make rpm.
Note that although COAP stuff is optional to build the code itself with make release or make debug the RPM building target needs them by the time being (we probably fix this in the future).
UPDATE: the fix of the RPM makefile target is being dealed at this Github.com issue: https://github.com/telefonicaid/fiware-orion/issues/579

llvm/clang compile error with Memory exhausted

I am trying to build the latest llvm/clang code on my ubuntu 14.04 vm, which has 2GB memory.
What I did is a normal configure/make procedure, without any parameters to these two commands.
at last, I have the following error:
llvm[4]: Linking Debug+Asserts executable clang
/usr/bin/ld: failed to set dynamic section sizes: Memory exhausted
collect2: error: ld returned 1 exit status
make[4]: *** [/home/alex/Downloads/llvm_build/Debug+Asserts/bin/clang] Error 1
make[4]: Leaving directory /home/alex/Downloads/llvm_build/tools/clang/tools/driver'
make[3]: *** [driver/.makeall] Error 2
make[3]: Leaving directory/home/alex/Downloads/llvm_build/tools/clang/tools'
make[2]: * [all] Error 1
make[2]: Leaving directory /home/alex/Downloads/llvm_build/tools/clang'
make[1]: *** [clang/.makeall] Error 2
make[1]: Leaving directory/home/alex/Downloads/llvm_build/tools'
make: *** [all] Error 1
Does anyone know how to resolve this?
You need to do one of the following:
Add more RAM to your VM, or
Use gold instead of ld as a linker, or
Build Release(-DCMAKE_BUILD_TYPE=Release), not Debug build
Another consideration: If you have Make running parallel jobs (e.g., make -j8), the concurrently executing jobs may require too much memory.

Resources