libqpOASES not found yet ACADOS_SOURCE_DIR and LD_LIBRARY_PATH

Hi there,

I am trying to build acados on a M2 mac and succeded to do so with the following configuration:

cmake -DACADOS_WITH_QPOASES=ON \
    -DACADOS_WITH_OSQP=ON \
    -DACADOS_WITH_OPENMP=ON \
    -DACADOS_WITH_HPMPC=OFF \
    -DACADOS_EXAMPLES=OFF \
    -DBLASFEO_TARGET=GENERIC \
    -DACADOS_PYTHON=ON \
    -DHPIPM_TARGET=GENERIC \
    -G "Unix Makefiles" \
    -B . \
    -S ..

I should also mention that I compiled casadi from source and therefore commented the corresponding line in /acados/interfaces/acados_template/setup.py.

However, when I try to run acados/examples/acados_python/getting_started/ocp/minimal_example_ocp.py, I get the following error:

Traceback (most recent call last):
  File "/Users/tudoroancea/acados/examples/acados_python/getting_started/ocp/minimal_example_ocp.py", line 102, in <module>
    ocp_solver = AcadosOcpSolver(ocp, json_file = 'acados_ocp.json')
  File "/Users/tudoroancea/acados/interfaces/acados_template/acados_template/acados_ocp_solver.py", line 953, in __init__
    self.__acados_lib = CDLL(libacados_filepath)
  File "/Users/tudoroancea/.pyenv/versions/3.9.13/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/tudoroancea/acados/lib/libacados.dylib, 0x0006): Library not loaded: 'libqpOASES_e.3.1.dylib'
  Referenced from: '/Users/tudoroancea/acados/lib/libacados.dylib'
  Reason: tried: 'libqpOASES_e.3.1.dylib' (no such file), '/usr/local/lib/libqpOASES_e.3.1.dylib' (no such file), '/usr/lib/libqpOASES_e.3.1.dylib' (no such file), '/Users/tudoroancea/acados/examples/acados_python/getting_started/ocp/libqpOASES_e.3.1.dylib' (no such file), '/usr/local/lib/libqpOASES_e.3.1.dylib' (no such file), '/usr/lib/libqpOASES_e.3.1.dylib' (no such file)

It is weird because I set ACADOS_SOURCE_DIR to the correct installation dir (in my case /Users/tudoroancea/acados) and also appended /Users/tudoroancea/acados/lib to my LD_LIBRARY_PATH variables, and yet this dir doesn’t seem to be explored.
I also tried to create symlinks for all the dynamic libraries located in this dir in /usr/local/lib but I got the same error message.

Any idea what I missed ? Thank you in advance.

Best,

Tudor

Hi Tudor,

shouldn’t it be DYLD_LIBRARY_PATH on MacOS?

1 Like

I tried both and I get the same error :frowning_face:

Is it just a qpOASES issue?
Or do you get a similar error if you compile without qpOASES?

Hi Jonathan, I just encounter the same problem as Tudor and fixed it after seeing your answer here. I believe updating the Documentation here would be really helpful! Maybe just add a line in comment telling people it should be DYLD_LIBRARY_PATH on MacOS. Could help new users save time :slight_smile:

Hi,
thanks for the feedback, I just added the note!

1 Like

hey folks ! hope you’re doing great

i stumbled in the same issue here on my mac, cannot find the lib when running the getting started example:

acados/examples/acados_python/getting_started/libqpOASES_e.dylib’ (no such file)

I tried the following hjowever it’s not working still. any hints?
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:"<acados>/lib"

any help appreciated. thanks!

Hi :wave:

the path in your error message acados/examples/acados_python/getting_started/libqpOASES_e.dylib looks weird. Please make sure that DYLD_LIBRARY_PATH contains the path to <acados root directory>/lib and check that <acados root directory>/lib indeed contains a file named qpOASES_e.dylib (if it doesn’t recompile acados with the flag -DACADOS_WITH_QPOASES=ON)

Best, Katrin

Hi Katrin, thanks for your quick reply!

I checked the env variables with echo and they point to the right folders and the .dylib file is there.

Please see below the detailed error message when I run the minimal ocp example in the getting started folder for python interface.

Many thanks!

Traceback (most recent call last):
File “/Users/user_macbook/acados/examples/acados_python/getting_started/minimal_example_ocp.py”, line 109, in
main()
File “/Users/user_macbook/acados/examples/acados_python/getting_started/minimal_example_ocp.py”, line 88, in main
ocp_solver = AcadosOcpSolver(ocp)
File “/Users/user_macbook/acados/interfaces/acados_template/acados_template/acados_ocp_solver.py”, line 239, in init
self.__acados_lib = get_shared_lib(libacados_filepath, self.winmode)
File “/Users/user_macbook/acados/interfaces/acados_template/acados_template/utils.py”, line 130, in get_shared_lib
shared_lib = DllLoader(shared_lib_name)
File “/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/ctypes/init.py”, line 366, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/user_macbook/acados/lib/…/lib/libacados.dylib, 0x0006): Library not loaded: libqpOASES_e.dylib
Referenced from: <751133E9-561C-39BD-990B-42D2499B749F> /Users/user_macbook/acados/lib/libacados.dylib
Reason: tried: ‘libqpOASES_e.dylib’ (no such file), ‘/System/Volumes/Preboot/Cryptexes/OSlibqpOASES_e.dylib’ (no such file), ‘libqpOASES_e.dylib’ (no such file), ‘/Users/user_macbook/acados/examples/acados_python/getting_started/libqpOASES_e.dylib’ (no such file), ‘/System/Volumes/Preboot/Cryptexes/OS/Users/user_macbook/acados/examples/acados_python/getting_started/libqpOASES_e.dylib’ (no such file), ‘/Users/user_macbook/acados/examples/acados_python/getting_started/libqpOASES_e.dylib’ (no such file)