alex-petrenko / megaverse

High-throughput simulation platform for Artificial Intelligence reseach
https://www.megaverse.info
MIT License
219 stars 20 forks source link

libopencv_core.so.4.5.5: undefined reference to `std::condition_variable::wait( #21

Closed erwincoumans closed 2 years ago

erwincoumans commented 2 years ago

Building the C++ project with cmake generates this error:

[ 84%] Built target megaverse
[ 85%] Linking CXX executable ../RelWithDebInfo/bin/viewer_app
/usr/bin/ld: /home/erwincoumans/anaconda3/envs/megaverse/lib/libopencv_core.so.4.5.5: undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.30'
collect2: error: ld returned 1 exit status
make[2]: *** [apps/CMakeFiles/viewer_app.dir/build.make:205: RelWithDebInfo/bin/viewer_app] Error 1
make[1]: *** [CMakeFiles/Makefile2:3482: apps/CMakeFiles/viewer_app.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

What version of g++ are you using?

alex-petrenko commented 2 years ago

Thank you for finding this! I just tried to install and rebuild everything from scratch and found the same issue. Perhaps versions of something changed since I did it last time.

I have the same error with g++ 8.4.0

alex-petrenko commented 2 years ago

@erwincoumans alright I fixed it with

conda uninstall opencv
conda install -c conda-forge "opencv==4.4.0"

Perhaps newer OpenCV expects a different version of stl. OpenCV is only used in the GUI apps mostly for debug purposes and it would've been relatively easy to get rid of it as a dependency, although this is the first time it had caused problems.

erwincoumans commented 2 years ago

It would be great to remove the dependency indeed. Thanks a lot for tracking this down, it works now.