Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error: undefined reference to symbol [...] #364

Closed
ryuuji06 opened this issue Sep 6, 2018 · 9 comments
Closed

Build error: undefined reference to symbol [...] #364

ryuuji06 opened this issue Sep 6, 2018 · 9 comments

Comments

@ryuuji06
Copy link

ryuuji06 commented Sep 6, 2018

Hello,

I'm using Ubuntu 18.04, I've build and installed all OpenMVS required libraries, but I got the follwing error during build, as shown below. I have no idea what is that symbol reference.

Can anyone help me?

Thank you

*** LIBRARIES FOUND WHEN USING CMAKE ***

-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY)
-- Can't find CUDA. Continuing without it.
-- WARNING: BREAKPAD was not found: Please specify BREAKPAD directory using BREAKPAD_ROOT env. variable
-- Can't find BreakPad. Continuing without it.
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- iostreams
-- program_options
-- system
-- serialization
-- regex
-- Eigen 3.2.10 found (include: /usr/local/include/eigen3)
-- Found OpenCV: /usr/local (found version "3.4.1")
-- OpenCV 3.4.1 found (include: /usr/local/include;/usr/local/include/opencv)
-- CGAL 4.11 found (include: /usr//include)
-- VCG found (include: /home/ryuuji/program-files/vcglib)
-- GLEW found (include: /usr/include)
-- GLFW3 3.2.1 found (include: )

*** BUILD ERROR ***

[ 85%] Linking CXX executable ../../bin/InterfaceVisualSFM
/usr/bin/x86_64-linux-gnu-ld: CMakeFiles/InterfaceVisualSFM.dir/InterfaceVisualSFM.cpp.o: undefined reference to symbol '_ZN2cv7imwriteERKNS_6StringERKNS_11_InputArrayERKSt6vectorIiSaIiEE'
//usr/local/lib/libopencv_imgcodecs.so.3.4: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
apps/InterfaceVisualSFM/CMakeFiles/InterfaceVisualSFM.dir/build.make:95: recipe for target 'bin/InterfaceVisualSFM' failed
make[2]: *** [bin/InterfaceVisualSFM] Error 1
CMakeFiles/Makefile2:399: recipe for target 'apps/InterfaceVisualSFM/CMakeFiles/InterfaceVisualSFM.dir/all' failed
make[1]: *** [apps/InterfaceVisualSFM/CMakeFiles/InterfaceVisualSFM.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2Steps to reproduce the problem

@quiliro
Copy link

quiliro commented Sep 18, 2018

I run either of these commands with OpenMVS:
make
make InterfaceVisualSFM
make ReconstructMesh
make DensifyPointCloud
I always get this error:
undefined reference to symbol 'ZN5boost15program_options29options_description_easy_initclEPKcS3'
Is it the same issue?

@cdcseacave
Copy link
Owner

pls try the latest release

@elliestath
Copy link

Hello, I still get this error with the latest release
CMakeFiles/InterfaceVisualSFM.dir/InterfaceVisualSFM.cpp.o: undefined reference to symbol '_ZN2cv7imwriteERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERKSt6vectorIiSaIiEE' //usr/local/lib/libopencv_imgcodecs.so.4.1: error adding symbols: DSO missing from command line /usr/bin/ld: CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: undefined reference to symbol '_ZN2cvmlERKNS_3MatES2_' //usr/local/lib/libopencv_core.so.4.1: error adding symbols: DSO missing from command line

@cdcseacave
Copy link
Owner

I never tested OpenMVS with OpenCV 4.x, pls submit a patch if OpenMVS needs one

@elliestath
Copy link

elliestath commented Jun 3, 2019

It's OpenCV3.2
dpkg -s libopencv-dev | grep 'Version' Version: 3.2.0+dfsg-4ubuntu0.1

@elliestath
Copy link

elliestath commented Jun 4, 2019

ok, so it seems I have OpenCV4 under usr/local/include (required for another software) but I have also installed with sudo apt-get -y install libopencv-dev, installed in /usr/share/doc/libopencv-dev and as I wrote above grep shows this version.

I try to make with cmake . ../openMVS -DCMAKE_BUILD_TYPE=Release -DVCG_ROOT="mypath/vcglib" -DEIGEN_INCLUDE_DIR_HINTS=mypath/eigen/include/eigen3 -DEIGEN_DIR=mypath/eigen/include/eigen3 -DOpenCV_DIR="/usr/share/doc/libopencv-dev" -DBUILD_SHARED_LIBS=ON -DOpenCV_CAN_BREAK_BINARY_COMPATIBILITY=OFF
but I get the following output:

`CMake Deprecation Warning at CMakeLists.txt:30 (cmake_policy):
  The OLD behavior for policy CMP0011 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- cotire 1.8.0 loaded.
-- Detected version of GNU GCC: 74 (704)
Compiling with C++14
-- WARNING: BREAKPAD was not found: Please specify BREAKPAD directory using BREAKPAD_ROOT env. variable
-- Can't find BreakPad. Continuing without it.
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   iostreams
--   program_options
--   system
--   serialization
--   regex
-- Eigen 3.2.10 found (include: mypath/eigen/include/eigen3)
-- OpenCV 4.1.0 found (include: /usr/local/include/opencv4)
-- CGAL 4.11 found (include: /usr//include)
-- VCG  found (include: mypath/vcglib)
-- GLEW  found (include: /usr/include)
-- GLFW3 3.2.1 found (include: )
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    OPENCV_DIR


-- Build files have been written to: mypath/openMVS_build
`

@elliestath
Copy link

elliestath commented Jun 5, 2019

I resolve the problem with OpenCV, as I uninstall completely the 4.x and re-install and compile 3.3.1
Now all the dependencies seems to be ok, but still I get this undefined reference to symbol error for both InterfaceCOLMAP and InterfaceVisualSFM. Can I build without these?

My cmake

`cmake . ../openMVS -DCMAKE_BUILD_TYPE=Release -DVCG_ROOT="mypath/vcglib" -DEIGEN_INCLUDE_DIR_HINTS="/usr/local/include/eigen3" -DEIGEN_DIR="/usr/local/include/eigen3" -DBUILD_SHARED_LIBS=ON  -DOpenCV_CAN_BREAK_BINARY_COMPATIBILITY=OFF

CMake Deprecation Warning at CMakeLists.txt:30 (cmake_policy):
  The OLD behavior for policy CMP0011 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- cotire 1.8.0 loaded.
-- Detected version of GNU GCC: 74 (704)
Compiling with C++14
-- WARNING: BREAKPAD was not found: Please specify BREAKPAD directory using BREAKPAD_ROOT env. variable
-- Can't find BreakPad. Continuing without it.
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   iostreams
--   program_options
--   system
--   serialization
--   regex
-- Eigen 3.2.10 found (include: /usr/local/include/eigen3)
-- OpenCV 3.3.1 found (include: /usr/local/include;/usr/local/include/opencv)
-- CGAL 4.11 found (include: /usr//include)
-- VCG  found (include:mypath/vcglib)
-- GLEW  found (include: /usr/include)
-- GLFW3 3.2.1 found (include: )
-- Configuring done
-- Generating done
-- Build files have been written to:mypath/openMVS_build
`

and the build error

`[ 74%] Linking CXX executable ../../bin/InterfaceVisualSFM
/usr/bin/ld: CMakeFiles/InterfaceVisualSFM.dir/InterfaceVisualSFM.cpp.o: undefined reference to symbol '_ZN2cv7imwriteERKNS_6StringERKNS_11_InputArrayERKSt6vectorIiSaIiEE'
//usr/local/lib/libopencv_imgcodecs.so.3.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
apps/InterfaceVisualSFM/CMakeFiles/InterfaceVisualSFM.dir/build.make:95: recipe for target 'bin/InterfaceVisualSFM' failed
make[2]: *** [bin/InterfaceVisualSFM] Error 1
CMakeFiles/Makefile2:659: recipe for target 'apps/InterfaceVisualSFM/CMakeFiles/InterfaceVisualSFM.dir/all' failed
make[1]: *** [apps/InterfaceVisualSFM/CMakeFiles/InterfaceVisualSFM.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 76%] Linking CXX executable ../../bin/InterfaceCOLMAP
/usr/bin/ld: CMakeFiles/InterfaceCOLMAP.dir/InterfaceCOLMAP.cpp.o: undefined reference to symbol '_ZN2cv6String10deallocateEv'
//usr/local/lib/libopencv_core.so.3.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/build.make:95: recipe for target 'bin/InterfaceCOLMAP' failed
make[2]: *** [bin/InterfaceCOLMAP] Error 1
CMakeFiles/Makefile2:604: recipe for target 'apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/all' failed
make[1]: *** [apps/InterfaceCOLMAP/CMakeFiles/InterfaceCOLMAP.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
`

@elliestath
Copy link

elliestath commented Jun 7, 2019

Ok, in my case the problem was solved by setting -DBUILD_SHARED_LIBS=OFF
Do not know if this will cause me a problem later, but for not is is built and installed with no errors.

@jiapei100
Copy link

Okay... Yes... I met exactly the same issue.... This is a kind of weird... Maybe openMVS is NOT compatible with OpenCV4 yet...

And @elliestath 's solution works for me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants