raisimTech / raisimLib

Visit www.raisim.com
http://www.raisim.com
Other
341 stars 91 forks source link

Symbol not found in flat namespace - raisimGymTorch #495

Closed santurini closed 1 year ago

santurini commented 1 year ago

OS: Mac OS Ventura 13.4.1

I have installed raisimGymTorch without errors, but when I try to run the runner.py example I get this error:

Traceback (most recent call last):
  File "/Users/arturo/Desktop/raisim/raisimLib/raisimGymTorch/raisimGymTorch/env/envs/rsg_anymal/runner.py", line 4, in <module>
    from raisimGymTorch.env.bin.rsg_anymal import NormalSampler
ImportError: dlopen(/Users/arturo/Desktop/raisim/raisimLib/raisimGymTorch/raisimGymTorch/env/bin/rsg_anymal.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_omp_get_thread_num'

I also tried to install openmp using brew and update the DYLD_LIBRARY_PATH but I keep getting the same error. I tried to compile raisim both with clang and g++ but nothing changes.

jhwangbo commented 1 year ago

This is about openmp. Someone recently solved the issue here #479 let me know if that works

santurini commented 1 year ago

I set the compiler flags to use llvm as suggested:

CC=/opt/homebrew/opt/llvm/bin/clang
CXX=/opt/homebrew/opt/llvm/bin/clang++

-- The CXX compiler identification is Clang 16.0.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/opt/llvm/bin/clang++ - skipped

Everything worked fine but then I have the same error in runner.py For completeness I also tried the small test to check whether omp was present and it worked perfectly fine.

[main] Building folder: omptest 
[build] Starting build
[proc] Executing command: /opt/homebrew/bin/cmake --build /Users/arturo/Desktop/omptest/build --config Debug --target all --
[build] [1/2  50% :: 0.451] Building CXX object CMakeFiles/omptest.dir/omptest.cpp.o
[build] [2/2 100% :: 0.515] Linking CXX executable omptest
[driver] Build completed: 00:00:00.529
[build] Build finished with exit code 0

omptest 0
omptest 4
omptest 3
omptest 2
omptest 1
omptest 7
omptest 6
omptest 5
santurini commented 1 year ago

I tried to add this line in the CMakeLists.txt to check which OpenMP_C_FLAGS was found:

message("OpenMP {${CMAKE_C_FLAGS}}")

And I get in return this during the compilation and the same error as before when launching the program:

OpenMP { }

These are the flags I use:

export CC=/opt/homebrew/Cellar/llvm/16.0.6/bin/clang
export CXX=/opt/homebrew/Cellar/llvm/16.0.6/bin/clang++
export LDFLAGS="-L/opt/homebrew/Cellar/llvm/16.0.6/lib"
export CPPFLAGS="-I/opt/homebrew/Cellar/llvm/16.0.6/include"
santurini commented 1 year ago

Solved making these changes #221 in rasimGymTorch -> CMakeLists.txt.