stanford-oval / genie-cloud

Genie As A Service and Thingpedia
https://genie.stanford.edu/
Apache License 2.0
295 stars 44 forks source link

`npm run install` fails on macOS (`libsystemd` related?) #1073

Open nrser opened 3 years ago

nrser commented 3 years ago

npm ci calls npm run install, which fails on macOS. While the NPM dependencies appear correctly installed and npm ci returns success, the error output can be confusing.

System

property value
os macOS 11.4 Big Sur
node 12.22.5 (LTS)
npm 6.14.14

Relevant output of npm ci:

> almond-cloud@2.0.0 install /Users/nrser/src/github.com/stanford-oval/almond-cloud
> make install

test -f /usr/local/bin/backend || ( cd go/backend && go build )
make -C sandbox all || echo WARNING: failed to compile the sandbox
make[1]: Entering directory '/Users/nrser/src/github.com/stanford-oval/almond-cloud/sandbox'
Package libsystemd was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsystemd.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsystemd' found
cc -o sandbox  -Wall -Werror -g -O2 -fno-strict-overflow -fstack-protector-strong -D_FORTIFY_SOURCE=2 sandbox.c
sandbox.c:184:9: error: implicit declaration of function 'strchrnul' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    q = strchrnul (p, ':');
        ^
sandbox.c:184:9: note: did you mean 'strchr'?
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:76:7: note: 'strchr' declared here
char    *strchr(const char *__s, int __c);
         ^
sandbox.c:184:7: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Werror,-Wint-conversion]
    q = strchrnul (p, ':');
      ^ ~~~~~~~~~~~~~~~~~~
2 errors generated.
make[1]: *** [Makefile:9: sandbox] Error 1
make[1]: Leaving directory '/Users/nrser/src/github.com/stanford-oval/almond-cloud/sandbox'
WARNING: failed to compile the sandbox
gcampax commented 3 years ago

This should just be a warning. You cannot compile the sandbox on anything but Linux, because the sandbox uses bwrap, which is a namespace-based sandbox. You need to set THINGENGINE_DISABLE_SANDBOX=1 to run natively on non-Linux POSIX OSes.