Enabling OpenMP Support for Chrono on MacOSX

38 views
Skip to first unread message

Rhein Ferdous

unread,
Jan 9, 2023, 2:48:08 PM1/9/23
to ProjectChrono
Hi everybody,

I've been spending the day trying to get Chrono up and running. The last step I completed is the 'make install' to install the Chrono libraries. However, since I am on a Mac:

Screen Shot 2023-01-09 at 2.44.46 PM.png

I ran into this exact issue and have been attempting to resolve it, but I am still unsuccessful. I installed brew and libomp, however, I don't know how to 'configure Chrono'.
How do a define the right compiler flags for the compiler and linker?

Thanks,
Rhein

dr.ratz...@gmail.com

unread,
Jan 10, 2023, 1:42:14 AM1/10/23
to ProjectChrono
Hi Rhein,

this works on my machine:

        -DOpenMP_CXX_FLAGS:STRING="-Xclang -fopenmp" \
        -DOpenMP_C_FLAGS:STRING="-Xclang -fopenmp" \
        -DOpenMP_C_INCLUDE_DIR:PATH=-L/opt/homebrew/opt/libomp/lib \
        -DOpenMP_CXX_INCLUDE_DIR:PATH=/opt/homebrew/opt/libomp/include \
        -DOpenMP_C_LIB_NAMES:STRING=libomp \
        -DOpenMP_CXX_LIB_NAMES:STRING=libomp \
        -DOpenMP_libomp_LIBRARY:FILEPATH="/opt/homebrew/opt/libomp/lib/libomp.dylib" \

These are options for my commandline cmake call. You can set this also with cmake-gui

Best
Rainer

Rhein Ferdous

unread,
Jan 10, 2023, 4:19:20 PM1/10/23
to ProjectChrono
Rainer,

Thank you for the suggestion. Somehow I was able to build the project without changing anything. However, I did run into further problems. I am extremely excited to use Chrono, but I'm having a lot of trouble just running it.


Screen Shot 2023-01-10 at 4.16.19 PM.png

I built chrono inside a 'chrono_build' folder in my project. I ran 'make'. I used CMake GUI to configure and generate the binaries into chrono_build.

When I build the project, however, it doesn't recognize chrono at all, so I can't run the file. 

Rhein

dr.ratz...@gmail.com

unread,
Jan 13, 2023, 1:21:22 PM1/13/23
to ProjectChrono
Hi Rhein,

actually the template_project does not do good under MacOS, that would be a good starting point for an user project. But we also can do it in good old unix fashion. We have to provide three include directories and a library directory.

clang++ -std=c++14 -o your_prog -I/Users/rainerge/Documents/GitHub/chrono/src -Ibuild_chrono -I/opt/homebrew/include/eigen3 your_prog.cpp -Lbuild_chrono/lib -lChronoEngine

Here I believe your little test program is in your_prog.cpp and the hopefully running executable is named your_prog. Note the build command is on one line!

Good Luck
Reply all
Reply to author
Forward
0 new messages