2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[メモ] ラズパイ OpenCV 4.1.1 ビルド時の__atomic_~~エラー対処

Last updated at Posted at 2019-07-27

OpenCV 4.1.1、いつも通りにビルドしたら、エラーでませんか?

TL;DR

cmake へのパラメータに、-DCMAKE_SHARED_LINKER_FLAGS='-latomic'を追加する。

OPENCV_VERSION=4.1.1
cmake -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D OPENCV_EXTRA_MODULES_PATH=${HOME}/opencv_contrib-${OPENCV_VERSION}/modules \
    -D ENABLE_VFPV3=ON \
    -D ENABLE_NEON=ON \
    -D BUILD_TESTS=OFF \
    -D WITH_TBB=OFF \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_SKIP_PYTHON_LOADER=ON \
    -D OPENCV_PYTHON2_INSTALL_PATH=/usr/local/lib/python2.7/dist-packages \
    -D OPENCV_PYTHON3_INSTALL_PATH=/usr/local/lib/python3.7/dist-packages \
    -D OPENCV_GENERATE_PKGCONFIG=ON \
    -D BUILD_EXAMPLES=ON \
    -DCMAKE_SHARED_LINKER_FLAGS='-latomic' \
    ..

# 詳細な手順はのちほど。

動機

いつも通りにビルドしてみたら、こんなエラーがでた。

エラー
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to '__atomic_fetch_add_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to '__atomic_fetch_sub_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to '__atomic_store_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to '__atomic_load_8'
/usr/bin/ld: ../../lib/libopencv_core.so.4.1.1: undefined reference to '__atomic_compare_exchange_8'
collect2: error: ld returned 1 exit status
make[2]: *** [modules/core/CMakeFiles/opencv_perf_core.dir/build.make:541: bin/opencv_perf_core] Error 1
make[1]: *** [CMakeFiles/Makefile2:2597: modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

関連

環境

  • 2019-07-10-raspbian-buster (2019-07-27パッケージ更新:apt upgrade)
  • Raspberry Pi 4B (4GB) ファン付き

その他

  • OpenCV 3.4.7は、まだ、ためしていない。
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?