commaai / msgq

MSGQ: A lock free single producer multi consumer message queue
184 stars 251 forks source link

Cannot build on macOS due to eventfd #475

Closed nworb-cire closed 1 year ago

nworb-cire commented 1 year ago

eventfd is only available on Linux, so building openpilot and its tools (specifically I'm trying to run cabana) fails on macOS due to the way IPC synchronization was implemented in https://github.com/commaai/cereal/pull/439.

Here is the full error I see, after freshly cloning master and running scons a second time:

$ scons -j8 -u -k
scons: Entering directory `/Users/ebrown1/PycharmProjects/openpilot3'
scons: Reading SConscript files ...
Git commit hash for gitversion.h: e1805f65
scons: done reading SConscript files.
scons: Building targets ...
clang++ -o cereal/messaging/event.os -c -std=c++1z -DGL_SILENCE_DEPRECATION -DSWAGLOG="\"common/swaglog.h\"" -g -fPIC -O2 -Wunused -Werror -Wshadow -Wno-unknown-warning-option -Wno-deprecated-register -Wno-register -Wno-inconsistent-missing-override -Wno-c99-designator -Wno-reorder-init-list -Wno-error=unused-but-set-variable -DGL_SILENCE_DEPRECATION -DSWAGLOG="\"common/swaglog.h\"" -fPIC -I/opt/homebrew/include -I/opt/homebrew/opt/openssl@3.0/include -I. -Ithird_party/acados/include -Ithird_party/acados/include/blasfeo/include -Ithird_party/acados/include/hpipm/include -Ithird_party/catch2/include -Ithird_party/libyuv/include -Ithird_party/json11 -Ithird_party/curl/include -Ithird_party/linux/include -Ithird_party/snpe/include -Ithird_party/mapbox-gl-native-qt/include -Ithird_party/qrcode -Ithird_party -Icereal -Iopendbc/can -Ithird_party/json11 cereal/messaging/event.cc
generate_dbc_json(["tools/cabana/generate_dbc_json"], [])
tools/cabana/dbc/generate_dbc_json.py --out tools/cabana/dbc/car_fingerprint_to_dbc.json
Traceback (most recent call last):
  File "tools/cabana/dbc/generate_dbc_json.py", line 5, in <module>
    from selfdrive.car.car_helpers import get_interface_attr
  File "/Users/ebrown1/PycharmProjects/openpilot3/selfdrive/car/car_helpers.py", line 5, in <module>
    from common.params import Params
  File "/Users/ebrown1/PycharmProjects/openpilot3/common/params.py", line 1, in <module>
    from common.params_pyx import Params, ParamKeyType, UnknownKeyName, put_nonblocking, put_bool_nonblocking # pylint: disable=no-name-in-module, import-error
ModuleNotFoundError: No module named 'common.params_pyx'
scons: *** Error 1
cereal/messaging/event.cc:9:10: fatal error: 'sys/eventfd.h' file not found
#include <sys/eventfd.h>
         ^~~~~~~~~~~~~~~
1 error generated.
scons: *** [cereal/messaging/event.os] Error 1
scons: done building targets (errors occurred during build).

As a temporary workaround, I was able to build cabana by checking out d0a8b3780c in the openpilot repo.

incognitojam commented 1 year ago

https://github.com/commaai/cereal/pull/452 will resolve this

fredyshox commented 1 year ago

Fixed by #476