nodejs-mobile / nodejs-mobile-react-native

Node.js for Mobile Apps React Native plugin
https://nodejs-mobile.github.io
MIT License
180 stars 42 forks source link

On the ARM version of Mac, unable to correctly build native modules for the simulator. #50

Closed CaryTrivett closed 1 year ago

CaryTrivett commented 1 year ago
if [ "$PLATFORM_NAME" == "iphoneos" ]
then
  GYP_DEFINES="OS=ios" \
  CARGO_BUILD_TARGET="aarch64-apple-ios" \
  NODEJS_MOBILE_GYP="~/Downloads/AwesomeProject/node_modules/nodejs-mobile-gyp/bin/node-gyp.js" \
  npm_config_node_gyp="~/Downloads/AwesomeProject/node_modules/nodejs-mobile-gyp/bin/node-gyp.js" \
  npm_config_nodedir="~/Downloads/AwesomeProject/node_modules/nodejs-mobile-react-native/ios/libnode" \
  npm_config_platform="ios" \
  npm_config_format="make-ios" \
  npm_config_arch="arm64" \
  npm --verbose --foreground-scripts rebuild --build-from-source
else
  GYP_DEFINES="OS=ios" \
  CARGO_BUILD_TARGET="x86_64-apple-ios" \
  NODEJS_MOBILE_GYP="$NODEJS_MOBILE_GYP_BIN_FILE" \
  npm_config_node_gyp="$NODEJS_MOBILE_GYP_BIN_FILE" \
  npm_config_nodedir="$NODEJS_HEADERS_DIR" \
  npm_config_platform="ios" \
  npm_config_format="make-ios" \
  npm_config_arch="x64" \
  npm --verbose --foreground-scripts rebuild --build-from-source
fi
popd

When PLATFORM_NAME is not iphoneos, npm_config_arch="x64"

CaryTrivett commented 1 year ago

Related to this discussion. https://github.com/orgs/nodejs-mobile/discussions/22