Tim-Salzmann / l4casadi

Use PyTorch Models with CasADi for data-driven optimization or learning-based optimal control. Supports Acados.
MIT License
379 stars 29 forks source link

OSError: libqpOASES_e.so: cannot open shared object file: No such file or directory #56

Closed zhupit closed 6 days ago

zhupit commented 1 week ago

Hi Tim,

Thank you very much for this excellent library. I can run examples/realtime/readme.py and examples/realtime/simple_nlp.py successfully. However, I encountered an issue when running examples/realtime/mpc_mlp_example.py, the output is:

/home/zxy/anaconda3/envs/l4casadi-main/bin/python /home/zxy/l4casadi-main/l4casadi-main/examples/realtime/mpc_mlp_example.py 
field AcadosOcpDims.N has been migrated to AcadosOcpOptions.N_horizon. setting AcadosOcpOptions.N_horizon = N. For future comppatibility, please use AcadosOcpOptions.N_horizon directly.
rm -f libacados_ocp_solver_wr.so
rm -f acados_solver_wr.o
cc -fPIC -std=c99   -O2 -I/home/zxy/anaconda3/envs/acados/include -I/home/zxy/anaconda3/envs/acados/include/acados -I/home/zxy/anaconda3/envs/acados/include/blasfeo/include -I/home/zxy/anaconda3/envs/acados/include/hpipm/include  -c -o acados_solver_wr.o acados_solver_wr.c
cc -fPIC -std=c99   -O2 -I/home/zxy/anaconda3/envs/acados/include -I/home/zxy/anaconda3/envs/acados/include/acados -I/home/zxy/anaconda3/envs/acados/include/blasfeo/include -I/home/zxy/anaconda3/envs/acados/include/hpipm/include  -c -o wr_model/wr_expl_ode_fun.o wr_model/wr_expl_ode_fun.c
cc -fPIC -std=c99   -O2 -I/home/zxy/anaconda3/envs/acados/include -I/home/zxy/anaconda3/envs/acados/include/acados -I/home/zxy/anaconda3/envs/acados/include/blasfeo/include -I/home/zxy/anaconda3/envs/acados/include/hpipm/include  -c -o wr_model/wr_expl_vde_forw.o wr_model/wr_expl_vde_forw.c
cc -fPIC -std=c99   -O2 -I/home/zxy/anaconda3/envs/acados/include -I/home/zxy/anaconda3/envs/acados/include/acados -I/home/zxy/anaconda3/envs/acados/include/blasfeo/include -I/home/zxy/anaconda3/envs/acados/include/hpipm/include  -c -o wr_model/wr_expl_vde_adj.o wr_model/wr_expl_vde_adj.c
cc -shared acados_solver_wr.o wr_model/wr_expl_ode_fun.o wr_model/wr_expl_vde_forw.o wr_model/wr_expl_vde_adj.o -o libacados_ocp_solver_wr.so -L/home/zxy/anaconda3/envs/acados/lib -lacados -lhpipm -lblasfeo -lm  \
-L -l
Traceback (most recent call last):
  File "/home/zxy/l4casadi-main/l4casadi-main/examples/realtime/mpc_mlp_example.py", line 244, in <module>
    run()
  File "/home/zxy/l4casadi-main/l4casadi-main/examples/realtime/mpc_mlp_example.py", line 201, in run
    solver = MPC(model=model.model(), N=N).solver
  File "/home/zxy/l4casadi-main/l4casadi-main/examples/realtime/mpc_mlp_example.py", line 88, in solver
    return AcadosOcpSolver(self.ocp())
  File "/home/zxy/anaconda3/envs/l4casadi-main/lib/python3.10/site-packages/acados_template/acados_ocp_solver.py", line 231, in __init__
    self.__acados_lib = get_shared_lib(libacados_filepath, self.winmode)
  File "/home/zxy/anaconda3/envs/l4casadi-main/lib/python3.10/site-packages/acados_template/utils.py", line 129, in get_shared_lib
    shared_lib = DllLoader(shared_lib_name)
  File "/home/zxy/anaconda3/envs/l4casadi-main/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libqpOASES_e.so: cannot open shared object file: No such file or directory

Then, I run ldd libacados_ocp_solver_wr.so in examples/realtime/c_generated_code, the output is:

        linux-vdso.so.1 (0x00007fffa3173000)
    libacados.so => /home/zxy/anaconda3/envs/acados/lib/libacados.so (0x00007fef71680000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fef7147d000)
    libqpOASES_e.so => /home/zxy/anaconda3/envs/acados/lib/libqpOASES_e.so (0x00007fef71440000)
    libhpipm.so => /home/zxy/anaconda3/envs/acados/lib/libhpipm.so (0x00007fef712cc000)
    libblasfeo.so => /home/zxy/anaconda3/envs/acados/lib/libblasfeo.so (0x00007fef710ce000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fef70f7f000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fef71727000)

The file libqpOASES_e.so seems to be correctly located under /home/zxy/anaconda3/envs/acados/lib, but the script still reports it as missing. Could you please guide me on how to resolve this issue?

Best regards, Zhao