Need help on installing opencv in termux. Can anyone help?

Followed this instructions - keep.01ue.com/?pi=785007&_a=app&_c=index&_m=p
At the point 5, when run make, 50% with the error:

$ make 
 [ 2%] Built target zlib 
 [ 5%] Built target libjpeg-turbo 
 [ 8%] Built target libtiff 
 [ 16%] Built target libwebp 
 [ 19%] Built target libjasper 
 [ 21%] Built target libpng 
 [ 26%] Built target IlmImf 
 [ 31%] Built target libprotobuf 
 [ 31%] Built target quirc 
 [ 35%] Built target carotene_objs 
 [ 35%] Built target tegra_hal 
 [ 36%] Built target ade 
 [ 36%] Built target opencv_videoio_plugins
[ 42%] Built target opencv_core 
[ 46%] Built target opencv_imgproc 
 [ 48%] Built target opencv_imgcodecs 
 [ 49%] Built target opencv_videoio 
 [ 49%] Built target opencv_highgui 
 [ 50%] Built target opencv_ts 
[ 50%] Linking CXX executable ../../bin/opencv_perf_core
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ../../lib/libopencv_ts.a(ts_perf.cpp.o): in function `cv::operator<<(std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >&, cv::Mat const&)': ts_perf.cpp:(.text._ZN2cvlsERNSt6__ndk113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_3MatE+0xb8): undefined reference to `__atomic_fetch_add_4' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ts_perf.cpp:(.text._ZN2cvlsERNSt6__ndk113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_3MatE+0xdc): undefined reference to `__atomic_fetch_add_4' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ts_perf.cpp:(.text._ZN2cvlsERNSt6__ndk113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_3MatE+0x198): undefined reference to `__atomic_fetch_add_4' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ts_perf.cpp:(.text._ZN2cvlsERNSt6__ndk113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_3MatE+0x1d8): undefined reference to `__atomic_fetch_add_4' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ../../lib/libopencv_core.so.4.1.0: undefined reference to `__atomic_fetch_sub_8'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ../../lib/libopencv_core.so.4.1.0: undefined reference to `__atomic_load_4' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ../../lib/libopencv_core.so.4.1.0: undefined reference to `__atomic_load_8' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ../../lib/libopencv_core.so.4.1.0: undefined reference to `__atomic_store_4' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ../../lib/libopencv_core.so.4.1.0: undefined reference to `__atomic_compare_exchange_8' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ../../lib/libopencv_core.so.4.1.0: undefined reference to `__atomic_load_1' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ../../lib/libopencv_core.so.4.1.0: undefined reference to `__atomic_store_1' /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: ../../lib/libopencv_core.so.4.1.0: undefined reference to `__atomic_fetch_add_8'
/data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld generated: undefined reference to `__atomic_fetch_add_4' clang 8: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [modules/core/CMakeFiles/opencv_perf_core.the dir/build.make:542: bin/opencv_perf_core] Error 1 make[1]: *** [CMakeFiles/Makefile2:1595: modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2 
make: *** [Makefile:163: all] Error 2 
$


Tell me what to do? Who faced similar =(
March 23rd 20 at 19:08
2 answers
March 23rd 20 at 19:10
According undefined reference to `__atomic_fetch_add_4' used CPU is no need of atomic instructions and the compiler tries to use the library libatomic. Try adding it to the flags:

LDFLAGS=" -llog -lpython3 -latomic" ...
Added but when I run make exactly the same error( - bailee.Romaguera59 commented on March 23rd 20 at 19:13
@bailee.Romaguera59strange. You can still try the Makefile to look for places of connection of libraries and add libatomic hands. - kelli93 commented on March 23rd 20 at 19:16
@kelli93so, and how to do it? - bailee.Romaguera59 commented on March 23rd 20 at 19:19
@bailee.Romaguera59, before running make, open any text editor file Makefile and find the right place and to write -latomic For this, of course, you need to understand how gcc and make. - kelli93 commented on March 23rd 20 at 19:22
March 23rd 20 at 19:12
Most likely, an error in the action of 5-th step:
LDFLAGS=" -llog -lpython3" cmake -DCMAKE_BUILD_TYPE=RELEASE-DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_opencv_python3=on -DBUILD_opencv_python2=off -DWITH_QT=OFF -DWITH_GTK=OFF ..

In the end there should be 2 dots (represents the parent directory).
And in advance, of course, go to the build directory:
cd build
I wrote them,without them wouldn't have worked anyway) - bailee.Romaguera59 commented on March 23rd 20 at 19:15

Find more questions by tags OpenCVC++Android