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