Skip to content

Undefined reference to __atomic_xxx #15278

@fnoop

Description

@fnoop
System information (version)

OpenCV => 4.1.1
OS => Raspbian Buster (Debian 10)

Detailed description

When compiling OpenCV 4.1.1 on Raspbian, i get various undefined references to __atomic_xxx calls. See #15192. Adding -DOPENCV_EXTRA_EXE_LINKER_FLAGS=-latomic to cmake allows OpenCV to compile and install, but the generated libraries are missing the atomic library reference:

[dev] [mav@maverick-raspberry ~]$ ldd -r /srv/maverick/software/opencv/lib/libopencv_core.so.4.1.1
	linux-vdso.so.1 (0xbec57000)
	/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb6c77000)
	libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6c41000)
	libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6c17000)
	librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb6c00000)
	libtbb.so.2 => /srv/maverick/software/tbb/lib/libtbb.so.2 (0xb6bca000)
	libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6b9f000)
	libopenblas.so.0 => /srv/maverick/software/openblas/lib/libopenblas.so.0 (0xb6269000)
	libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6122000)
	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb60a0000)
	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6073000)
	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb5f25000)
	/lib/ld-linux-armhf.so.3 (0xb6fac000)
	libgfortran.so.5 => /usr/lib/arm-linux-gnueabihf/libgfortran.so.5 (0xb5e4c000)
undefined symbol: __atomic_compare_exchange_8	(/srv/maverick/software/opencv/lib/libopencv_core.so.4.1.1)
undefined symbol: __atomic_fetch_sub_8	(/srv/maverick/software/opencv/lib/libopencv_core.so.4.1.1)
undefined symbol: __atomic_load_8	(/srv/maverick/software/opencv/lib/libopencv_core.so.4.1.1)
undefined symbol: __atomic_store_8	(/srv/maverick/software/opencv/lib/libopencv_core.so.4.1.1)
undefined symbol: __atomic_fetch_add_8	(/srv/maverick/software/opencv/lib/libopencv_core.so.4.1.1)

This means anything compiled against opencv also then has these same undefined errors.

I would expect cmake to detect if atomic library is needed and add it automatically, and it should be linked into the core library, and others where necessary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions