QNX_HOST environment variable not set - qnx

I am compiling mlpack using QNX.Keep reporting the following errors:
CMake Error at CMakeLists.txt:28 (message):QNX_HOST environment variable not set!!!
I have added the following to CMakeLists.txt:
set (QNX_HOST “/data/QNX/qnx700/host/linux”)
set (QNX_TARGET “/data/QNX/qnx700/target/qnx7”)
I first executed the following command:
source /etc/bash.bashrc_qnx qnx_aarch64
source /data/QNX/qnx700/qnxsdp-env.sh
=>
QNX_HOST=/data/QNX/qnx700/host/linux/x86_64
QNX_TARGET=/data/QNX/qnx700/target/qnx7
MAKEFLAGS=-I/data/QNX/qnx700/target/qnx7/usr/include
And cmake .. But sudo make command still report an error–“error: environment variables QNX_HOST and QNX_TARGET not defined”.The following is the content of part document CMakeLists.txt:
set(CMAKE_SYSTEM_NAME QNX)
set(CMAKE_HOST_SYSTEM_NAME QNX)
set(QNX_PROCESSOR arm)
set(CMAKE_SYSTEM_VERSION 7.0.0)
set(CMAKE_CROSSCOMPILING 1)
set( TOOLCHAIN QNX )
set(CMAKE_SYSROOT "$ENV{TOOLCHAIN_PATH}")
#set (QNX_HOST "/data/QNX/qnx700/host/linux")
#set (QNX_TARGET "/data/QNX/qnx700/target/qnx7")
set(QNX_HOST "$ENV{QNX_HOST}")
set(QNX_TARGET "$ENV{QNX_TARGET}")
message(STATUS "*********************************")
message(STATUS "${QNX_HOST}")
message(STATUS "${QNX_TARGET}")
message(STATUS "*********************************")
#Check environment variables
if ("$ENV{QNX_HOST}" STREQUAL "")
#message(FATAL_ERROR "QNX_HOST environment variable not set")
endif()
if ("$ENV{QNX_TARGET}" STREQUAL "")
#message(FATAL_ERROR "QNX_TARGET environment variable not set")
endif()
set(CMAKE_C_COMPILER "/data/QNX/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc")
set(CMAKE_CXX_COMPILER "/data/QNX/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-g++")
#set(CMAKE_CXX_COMPILER "/usr/bin/x86_64-linux-gnu-g++")
set(CMAKE_CXX_STANDARD 14) # C++14...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS ON) #...without compiler extensions like gnu++14
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
When I running make without sudo, it still report an error–-
[ 10%] Linking CXX executable ../../bindings/julia/mlpack/build/bin/generate_jl_sparse_coding
../../../../lib/libmlpack.so.3.4: undefined reference to `dpotrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpotri_'
../../../../lib/libmlpack.so.3.4: undefined reference to `ddot_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbsvx_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgeqrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dposvx_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgemm_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesdd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgels_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dnrm2_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dlansy_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpotrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dtrcon_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dsyevd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbcon_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbtrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dposv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgetri_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgemv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesvd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbtrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dlange_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dtrtrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgecon_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dlangb_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dsyrk_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgetrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesvx_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpbtrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgetrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgelsd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `ilaenv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dsyev_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbsv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dorgqr_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dtrtri_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgtsv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpocon_'
collect2: error: ld returned 1 exit status
src/mlpack/methods/sparse_coding/CMakeFiles/generate_jl_sparse_coding.dir/build.make:119: recipe for target 'src/mlpack/bindings/julia/mlpack/build/bin/generate_jl_sparse_coding' failed
make[2]: *** [src/mlpack/bindings/julia/mlpack/build/bin/generate_jl_sparse_coding] Error 1
CMakeFiles/Makefile2:6388: recipe for target 'src/mlpack/methods/sparse_coding/CMakeFiles/generate_jl_sparse_coding.dir/all' failed
make[1]: *** [src/mlpack/methods/sparse_coding/CMakeFiles/generate_jl_sparse_coding.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
Does anyone know what should I do ?

You need to ensure that you've added the QNX build toolchain to your environment. QNX provides the 'qnxsdp-env.sh' shell script (or qnx-sdp-env.bat for Windows) to set up the toolchain. This will set all appropriate environment variables. Run this script before trying to use any other build commands such as cmake, make, qcc, etc.
Inferring from your example that you're using QNX 7.0 on a Linux host, try:
$ source /data/QNX/qnxsdp-env.sh
$ cmake
Note that source is important: it instructs the shell to run the script such that it can modify the current shell environment, rather than launching it in a subshell. If you run the script without source, the script will have no effect.
Reference: http://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.prog/topic/devel_OS_version.html

Related

/lib/libmlpack.so.3.4: undefined reference to `dpotrf_'

Linking CXX executable ../../bindings/julia/mlpack/build/bin/generate_jl_sparse_coding
../../../../lib/libmlpack.so.3.4: undefined reference to `dpotrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpotri_'
../../../../lib/libmlpack.so.3.4: undefined reference to `ddot_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbsvx_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgeqrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dposvx_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgemm_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesdd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgels_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dnrm2_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dlansy_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpotrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dtrcon_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dsyevd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbcon_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbtrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dposv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgetri_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgemv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesvd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbtrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dlange_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dtrtrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgecon_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dlangb_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dsyrk_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgetrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgesvx_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpbtrf_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgetrs_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgelsd_'
../../../../lib/libmlpack.so.3.4: undefined reference to `ilaenv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dsyev_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgbsv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dorgqr_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dtrtri_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dgtsv_'
../../../../lib/libmlpack.so.3.4: undefined reference to `dpocon_'
collect2: error: ld returned 1 exit status
src/mlpack/methods/sparse_coding/CMakeFiles/generate_jl_sparse_coding.dir/build.make:119: recipe for target 'src/mlpack/bindings/julia/mlpack/build/bin/generate_jl_sparse_coding' failed
make[2]: *** [src/mlpack/bindings/julia/mlpack/build/bin/generate_jl_sparse_coding] Error 1
CMakeFiles/Makefile2:6388: recipe for target 'src/mlpack/methods/sparse_coding/CMakeFiles/generate_jl_sparse_coding.dir/all' failed
make[1]: *** [src/mlpack/methods/sparse_coding/CMakeFiles/generate_jl_sparse_coding.dir/all] Error 2 Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2
I reported the above errors when compiling mlpack with QNX.And I have compiled necessary dependencies like armadillo and boost. I would like to ask why this error is reported? And what should I do?

Why is cmake linking to opencv in conda environment when I have specified the path to opencv 4 installation?

I'm trying to run the sample dnn program from opencv's website for object detection
Here's what my CMakeLists.txt looks like:
project( IOT_MINI )
set(CMAKE_CXX_STANDARD 14)
SET(OpenCV DIR /usr/local/include/opencv4)
find_package(OpenCV 4 REQUIRED)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
message(STATUS "OpenCV library status:")
message(STATUS " config: ${OpenCV_DIR}")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
add_executable( Dog_detector Dog_detector.cpp )
target_link_libraries( Dog_detector ${OpenCV_LIBS} )
I can successfully find OpenCv 4. cmake .. runs successfully. But while make it links(?) to conda environment.
I don't know how to reproduce this exactly since I have ROS, conda and opencv installed and I don't know what exactly is causing the problem.
$ make
Scanning dependencies of target Dog_detector
[ 50%] Building CXX object CMakeFiles/Dog_detector.dir/Dog_detector.cpp.o
[100%] Linking CXX executable Dog_detector
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: warning: libgtk-x11-2.0.so.0, needed by /usr/local/lib/libopencv_highgui.so.4.0.0, not found (try using -rpath or -rpath-link)
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: warning: libgdk-x11-2.0.so.0, needed by /usr/local/lib/libopencv_highgui.so.4.0.0, not found (try using -rpath or -rpath-link)
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: warning: libcairo.so.2, needed by /usr/local/lib/libopencv_highgui.so.4.0.0, not found (try using -rpath or -rpath-link)
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: warning: libgdk_pixbuf-2.0.so.0, needed by /usr/local/lib/libopencv_highgui.so.4.0.0, not found (try using -rpath or -rpath-link)
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_bus_timed_pop_filtered'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `avio_close#LIBAVFORMAT_57'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_app_src_push_buffer'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `dc1394_capture_setup'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_set_write_fn#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_window_get_title'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `av_seek_frame#LIBAVFORMAT_57'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `jas_matrix_destroy'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_widget_new'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `jpeg_destroy_decompress#LIBJPEG_8.0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_core.so.4.0.0: undefined reference to `gzclose'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `jpeg_stdio_src#LIBJPEG_8.0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_file_chooser_set_do_overwrite_confirmation'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_core.so.4.0.0: undefined reference to `gzgets'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `av_frame_free#LIBAVUTIL_55'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_init'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_write_end#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_element_factory_make'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_set_packing#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_element_get_static_pad'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_read_info#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `sws_scale#LIBSWSCALE_4'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `dc1394_get_control_registers'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_read_image#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `sws_getCachedContext#LIBSWSCALE_4'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `Imf_2_2::OutputFile::OutputFile(char const*, Imf_2_2::Header const&, int)'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `av_init_packet#LIBAVCODEC_57'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `g_cond_timed_wait'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `av_codec_get_tag#LIBAVFORMAT_57'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `jas_cmprof_createfromclrspc'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `TIFFGetField#LIBTIFF_4.0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `jpeg_default_qtables#LIBJPEG_8.0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_hbox_new'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `TIFFOpen#LIBTIFF_4.0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `dc1394_video_get_supported_modes'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `Imf_2_2::InputFile::setFrameBuffer(Imf_2_2::FrameBuffer const&)'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_encoding_container_profile_new'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_bin_iterate_elements'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `av_codec_get_id#LIBAVFORMAT_57'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `avformat_open_input#LIBAVFORMAT_57'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_structure_get_string'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `g_value_unset'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_read_end#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `av_frame_alloc#LIBAVUTIL_55'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_is_missing_plugin_message'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_widget_get_events'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `jpeg_write_scanlines#LIBJPEG_8.0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_window_fullscreen'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `g_type_check_class_cast'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `WebPGetFeaturesInternal'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `avformat_write_header#LIBAVFORMAT_57'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_dnn.so.4.0.0: undefined reference to `powf#GLIBC_2.27'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `avcodec_get_name#LIBAVCODEC_57'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_encoding_container_profile_add_profile'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_core.so.4.0.0: undefined reference to `gzputs'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_bin_iterate_sources'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_set_read_fn#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_hscale_new_with_range'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_get_tRNS#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_dnn.so.4.0.0: undefined reference to `expf#GLIBC_2.27'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_set_compression_level#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gdk_cairo_set_source_pixbuf'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_set_swap#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_videoio.so.4.0.0: undefined reference to `gst_app_sink_get_max_buffers'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_init_io#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_imgcodecs.so.4.0.0: undefined reference to `png_set_strip_alpha#PNG16_0'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_widget_set_realized'
/home/atmadeep/.conda/envs/AI/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: /usr/local/lib/libopencv_highgui.so.4.0.0: undefined reference to `gtk_style_set_background'
... [Shortened for brevity]
collect2: error: ld returned 1 exit status
CMakeFiles/Dog_detector.dir/build.make:98: recipe for target 'Dog_detector' failed
make[2]: *** [Dog_detector] Error 1
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/Dog_detector.dir/all' failed
make[1]: *** [CMakeFiles/Dog_detector.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

OpenCV-3.0.0-beta failure to build on 32-bits and 64-bits Ubuntu12.04 - IPP symbols undefined

Linking CXX executable ../../bin/opencv_perf_core
../../lib/libopencv_core.so.3.0.0: undefined reference to ippiTranspose_16u_C4IR'
../../lib/libopencv_core.so.3.0.0: undefined reference toippiMean_StdDev_16u_C1R'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to ippiFilterSobelHorizBorder_8u16s_C1R'
../../lib/libopencv_core.so.3.0.0: undefined reference toippiNorm_L2_32f_C4R'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to ippiMulC_16s_C1IRSfs'
../../lib/libopencv_core.so.3.0.0: undefined reference toippiNormDiff_L1_8u_C4R'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to ippiResizeLinear_16u_C3R'
../../lib/libopencv_core.so.3.0.0: undefined reference toippiNormDiff_Inf_32f_C1MR'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to ippiCopySubpixIntersect_8u_C1R'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference toippiErodeBorder_8u_C1R'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to `ippiCrossCorrNormGetBufferSize'
You can add that libippicv.a library as simple object file to linker command line at the end. Or, treat it as a library "cc ..... -L 3rdparty/ippicv/unpack/ippicv_lnx/lib/ia32 -lippicv" so as ordinary libraries are used while linking.

OpenCV compilation error in Fedora 21

I've got OpenCV source code from github and I get the following error when trying to compile it:
/lib64/libavutil.so.54: undefined reference to `clReleaseMemObject#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clReleaseCommandQueue#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clCreateBuffer#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clBuildProgram#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clSetKernelArg#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clGetDeviceIDs#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clEnqueueUnmapMemObject#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clGetPlatformInfo#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clCreateProgramWithSource#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clGetDeviceInfo#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clReleaseContext#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clCreateContextFromType#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clCreateCommandQueue#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clEnqueueMapBuffer#OPENCL_1.0'
/lib64/libavutil.so.54: undefined reference to `clGetPlatformIDs#OPENCL_1.0'
My machine is a laptop with Intel i7 and a GT630M graphics card and I'm using Bumblebee.
Thanks.
If you happen to have CUDA 8.0 installed, this is caused by Nvidia's careless packaging for it, which puts /usr/local/cuda-8.0/targets/x86_64-linux/lib ahead of /usr/lib/x86_64-linux-gnu during compile time and run time.
The quick fix is to use:
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu make
Source: https://github.com/OpenKinect/libfreenect2/issues/804

Opencv linker error while cross-compiling the sample cpp (libopencv_calib3d.so: could not read symbols)

I am trying to cross compile a sample OpenCV cpp code for my beaglebone which has a ARM Cortex A8 based AM3359 processor. However when I start the cross-compiling I get the following error:
/usr/local/lib/libopencv_calib3d.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
It seems like a linker error. I am pretty sure that there is nothing wrong with libopencv_calib3d.so. Because when I compile the program for my PC, everything works fine. Therefore maybe the problem is with the method that I am using for cross compiling. Here is what I do:
I wrote a script in the name of compile_opencvarm.sh:
echo "Cross-Compiling $1"
if [[ $1 == *.c ]]
then
arm-linux-gnueabi-gcc -ggdb `pkg-config --cflags opencv` -o `basename $1 .c` $1 `pkg-config --libs opencv`;
elif [[ $1 == *.cpp ]]
then
arm-linux-gnueabi-g++ -ggdb `pkg-config --cflags opencv` -o `basename $1 .cpp` $1 `pkg-config --libs opencv`;
else
echo "Please compile only .c or .cpp files with this script"
fi
echo "Cross-Compiled Output => ${1%.*}"
and then added it to bashrc:
alias opencv_arm="~/.compile_opencvarm.sh"
Now when I do:
root#ghostrider:/home/zero/Desktop# opencv_arm peopledetect.cpp
Cross-Compiling peopledetect.cpp
/usr/local/lib/libopencv_calib3d.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
Cross-Compiled Output => peopledetect
Only difference with compiling script and cross-compiling script is that I used arm-linux-gnueabi prefix in the cross-compiling script. When I only compile the cpp file:
root#ghostrider:/home/zero/Desktop# opencv peopledetect.cpp
compiling peopledetect.cpp
Output file => peopledetect
Everything is OK. Program is executable.
Now what do you think my problem is? Is it a linker error or is it related to my cross-compiling process?
Regards
edit: Oh, now I noticed that I did not install arm-based cross libraries before the arm-linux-gnueabi compiler used them. So I installed them with:
sudo xapt -a armel -m libv4l-dev libgtk2.0-dev libcv-dev libcvaux-dev libhighgui-dev
and edited the script as following:
arm-linux-gnueabi-g++ -ggdb `arm-linux-gnueabi-pkg-config --cflags opencv` -o `basename $1 .cpp` $1 `arm-linux-gnueabi-pkg-config --libs opencv`;
But now I get the problem:
root#ghostrider:/home/zero/Desktop# opencv_arm peopledetect.cpp
compiling peopledetect.cpp
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: warning: liblapack.so.3gf, needed by /usr/arm-linux-gnueabi/lib/libcxcore.so, not found (try using -rpath or -rpath-link)
/tmp/ccDzUCLJ.o: In function `main':
/home/zero/Desktop/peopledetect.cpp:49: undefined reference to `cv::HOGDescriptor::setSVMDetector(cv::_InputArray const&)'
/home/zero/Desktop/peopledetect.cpp:84: undefined reference to `cv::HOGDescriptor::detectMultiScale(cv::Mat const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, cv::Size_<int>, cv::Size_<int>, double, double, bool) const'
/tmp/ccDzUCLJ.o: In function `cv::Mat::operator=(cv::Mat const&)':
/usr/include/opencv2/core/mat.hpp:317: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/tmp/ccDzUCLJ.o: In function `cv::Mat::release()':
/usr/include/opencv2/core/mat.hpp:382: undefined reference to `cv::Mat::deallocate()'
/tmp/ccDzUCLJ.o: In function `_InputArray<float>':
/usr/include/opencv2/core/mat.hpp:1108: undefined reference to `vtable for cv::_InputArray'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dgelsd_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dpotrf_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dpotri_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dsyevr_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dgesv_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dpotrs_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dgetri_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `sgels_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `sgesv_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dgetrf_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `sgetrf_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dgels_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `spotrf_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `sgelsd_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `sgesdd_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `spotri_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `ssyevr_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `dgesdd_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `spotrs_'
/usr/arm-linux-gnueabi/lib/libcxcore.so: undefined reference to `sgetri_'
collect2: ld returned 1 exit status
Output file => peopledetect
I solved my problem by cross-compiling all the OpenCV libraries by following this guide: http://processors.wiki.ti.com/index.php/Building_OpenCV_for_ARM_Cortex-A8
I followed this guide but "lnclude/opencv2" directory in the root of opencv distributive is empty after the building. So in fact i have libraries but dont have headers. What am i doing wrong?
UPD: I should be a little more careful, all answers in http://processors.wiki.ti.com/index.php/Building_OpenCV_for_ARM_Cortex-A8

Resources