commaai / openpilot

openpilot is an operating system for robotics. Currently, it upgrades the driver assistance system on 275+ supported cars.
https://comma.ai/openpilot
MIT License
49.87k stars 9.09k forks source link

MacOS: rpath and library issues #23830

Closed pd0wm closed 1 year ago

pd0wm commented 2 years ago

When trying to run python services all kinds of library path issues pop up.

1) All paths seem to be relative against the basedir. Running something from within a folder doesn't work, and you get errors like:

ImportError: dlopen(/Users/willem/openpilot/opendbc/can/parser_pyx.so, 0x0002): Library not loaded: opendbc/can/libdbc.dylib
  Referenced from: /Users/willem/openpilot/opendbc/can/parser_pyx.so
  Reason: tried: 'opendbc/can/libdbc.dylib' (no such file), '/usr/local/lib/libdbc.dylib' (no such file), '/usr/lib/libdbc.dylib' (no such file)

2) Can't load acados

ImportError: dlopen(/Users/willem/openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_ocp_solver_pyx.so, 0x0002): Library not loaded: @rpath/libacados.dylib
  Referenced from: /Users/willem/openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/libacados_ocp_solver_long.dylib
  Reason: tried: '/usr/local/lib/libacados.dylib' (no such file), '/usr/lib/libacados.dylib' (no such file)
havvagulay commented 2 years ago

Any update on the issue? I am seeing the same errors while running the tests on macOS Monterey 12.2.1. @pd0wm do you have any workarounds to resolve this issue?

zorrobyte commented 2 years ago

Same after submitting the build fixes


  Reason: tried: 'opendbc/can/libdbc.dylib' (no such file), '/usr/local/lib/libdbc.dylib' (no such file), '/usr/lib/libdbc.dylib' (no such file)```
pd0wm commented 2 years ago

As a workaround: things work if you run them from the openpilot root folder. E.g. selfdrive/test/process_replay/test_processes.py --whitelist_procs controlsd