C++ compiler giving segmentation fault while trying to compile euclidean_resection.cc (OpenCV with CUDA Enabled)

I have been trying to compile opencv 4.4.0.

Attached are the build and configuration log. My board is jetson nano (https://developer.nvidia.com/embedded/jetson-nano-developer-kit)
having image from - https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit#write

This compiler segmentation fault happens each time at same place . (euclidean_resection.cc - compilation)
Tried options:

  1. Increasing swap memory (currently total swap memory is 6G)
  2. Compiling with make (without any processor number specified)
  3. Compiling with make -j1
  4. Tried to compile 4.5.1, 4.5.2, 4.1.1, 4.4.0 - all are failing at same file compilation
  5. Cross compilation with cuda support enabled on VM - Ubuntu 18.04 - facing configuration issues

build.log (142.1 KB)
configure.log (27.9 KB)

Need help on…

  1. Segmentation fault while trying to compile the euclidean_resection.cc file in cc1plus program (C++ compiler) - request to see attached screen shot
  2. Document/thread listing out steps for cross compilation of opencv on ubuntu VM (with CUDA/GPU support enabled)

Your help is highly appreciated as have been stuck here since quite some time and am relatively new to the world of CUDA/GPU support in OpenCV.

Nirav

I successfully built opencv 4.5.4 with clang-10 (-D CMAKE_CXX_COMPILER=clang+±10)

It seems to be a problem of libmv_light or gcc.

I build an incomplete opencv by commenting out:

“euclidean_resection.cc fundamental.cc fundamental_kernel.cc
homography.cc robust_resection.cc robust_fundamental.cc
robust_estimation.cc projection.cc panography.cc
panography_kernel.cc” in opencv_contrib/modules/sfm/src/libmv_light/libmv/multiview

but it does not work when I import it from python3:

Python 3.6.9 (default, Dec  8 2021, 21:08:43)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/dist-packages/cv2/__init__.py", line 180, in <module>
    bootstrap()
  File "/usr/lib/python3.6/dist-packages/cv2/__init__.py", line 152, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /usr/lib/aarch64-linux-gnu/libopencv_sfm.so.4.5: undefined symbol: _ZN5libmv26NormalizedEightPointSolverERKN5Eigen6MatrixIdLin1ELin1ELi0ELin1ELin1EEES4_PNS1_IdLi3ELi3ELi0ELi3ELi3EEE

g++ -v:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/7/lto-wrapper
Target: aarch64-linux-gnu
Configured with: …/src/configure -v --with-pkgversion=‘Ubuntu/Linaro 7.5.0-3ubuntu1~18.04’ --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)

Thanks 1332019995 for reply!

I could resolve it with the default clang compiler. (/usr/bin/clang++), compiled latest 4.5.4 OpenCV with clang++.

My configure and build logs after successful compilation are attached herewith for some one to refer.

So there seems to be some problem with the g++ compiler coming up with jetpack sdk image for jetson nano - but not the opencv.

build.log (604.0 KB)
configure.log (29.5 KB)
.

Nirav

Hi all,
Compile OpenCV4.5, please follow this topic"

I compiled opencv 4.5 but did not update Python-Opencv - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums

If any one has done it without clang++ compiler (on jetpack 4.6 and opencv 4.5.1 onward with cuda/dnn support enabled) - please share your steps/experience.

Nirav

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.