commaai / opendbc

democratize access to car decoder rings
MIT License
1.81k stars 1.07k forks source link

Sconscript: enable openpilot compilation for macOS #1059

Closed bongbui321 closed 5 days ago

bongbui321 commented 6 days ago

prereq for: https://github.com/commaai/openpilot/pull/32909

Good reference: http://clarkkromenaker.com/post/library-dynamic-loading-mac/#:~:text=On%20Mac%20and%20Linux%2C%20the,path%20embedded%20inside%20the%20executable.

MacOS linking to dynamic library on scons is very weird, and RPATH is not well supported on macOS.

reference: Similar trouble I encounter: https://github.com/SCons/scons/issues/3128 Weird behaviour on macOS for rpath: https://github.com/SCons/scons/issues/2127

Edit: Uses @loader_path instead, for relative path to the file referencing the dynamic lib