Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broke compilation of nodejs-mobile for iOS from a x64 macBook #184

Open
gengjiawen opened this issue Jan 10, 2023 · 2 comments
Open

broke compilation of nodejs-mobile for iOS from a x64 macBook #184

gengjiawen opened this issue Jan 10, 2023 · 2 comments
Labels

Comments

@gengjiawen
Copy link
Member

gengjiawen commented Jan 10, 2023

TL;DR this commit broke compilation of nodejs-mobile for iOS from an x64 macBook. See PR nodejs-mobile/nodejs-mobile#9

(I'm not sure if it's good practice to comment on old PRs, so feel free to tell me to move this discussion elsewhere.)

I maintain nodejs-mobile lately, and I'm updating our fork from Node 12.x to Node 16.x. Since we're compiling node.js for iOS, we want the arch to be arm64, but the host clang has flags like __amd64__ and this mixed with the iPhoneOS SDK headers ends up causing an Unsupported architecture compilation error.

Maybe a solution would be to patch this gyp-next script to detect whether we're running in arm64 darwin (such checks are common throughout the codebase, I've noticed) and then use the new logic. Else, use the old logic.

What do you think?

Originally posted by @staltz in #78 (comment)

@gengjiawen gengjiawen changed the title TL;DR this commit broke compilation of [nodejs-mobile](https://github.com/nodejs-mobile/nodejs-mobile) for iOS from an x64 macBoo broke compilation of [nodejs-mobile](https://github.com/nodejs-mobile/nodejs-mobile) for iOS from an x64 macBoo Jan 10, 2023
@gengjiawen
Copy link
Member Author

cc @MarshallOfSound @rvagg

@ryzokuken ryzokuken changed the title broke compilation of [nodejs-mobile](https://github.com/nodejs-mobile/nodejs-mobile) for iOS from an x64 macBoo broke compilation of nodejs-mobile for iOS from an x64 macBook Jan 10, 2023
@ryzokuken ryzokuken changed the title broke compilation of nodejs-mobile for iOS from an x64 macBook broke compilation of nodejs-mobile for iOS from a x64 macBook Jan 10, 2023
@simonecorsato
Copy link

simonecorsato commented Feb 14, 2023

Similar issue building on a x64 macBook using "nodejs-mobile-react-native": "16.17.4" for an iPhone simulator (iOS target 15). I'm using node version v16.15.1 . So I can't run "nodejs-mobile-react-native" on an iOS simulator.
I'm reporting the error below:

ld: warning: ignoring file /Users/simone.corsato/git/SwingMobile/node_modules/nodejs-mobile-react-native/ios/NodeMobile.framework/NodeMobile, building for iOS Simulator-x86_64 but attempting to link with file built for iOS-arm64
Undefined symbols for architecture x86_64:
  "_napi_call_function", referenced from:
      Channel::invokeNodeListener(char*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_close_handle_scope", referenced from:
      Channel::invokeNodeListener(char*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_coerce_to_string", referenced from:
      Method_SendMessage(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_create_reference", referenced from:
      Method_RegisterChannel(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_create_string_utf8", referenced from:
      Method_GetDataDir(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Channel::invokeNodeListener(char*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_define_properties", referenced from:
      Init(napi_env__*, napi_value__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_get_cb_info", referenced from:
      Method_RegisterChannel(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Method_SendMessage(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_get_global", referenced from:
      Channel::invokeNodeListener(char*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_get_last_error_info", referenced from:
      Method_RegisterChannel(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Method_SendMessage(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Method_GetDataDir(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Init(napi_env__*, napi_value__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_get_reference_value", referenced from:
      Channel::invokeNodeListener(char*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_get_value_string_utf8", referenced from:
      Method_RegisterChannel(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Method_SendMessage(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_is_exception_pending", referenced from:
      Method_RegisterChannel(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Method_SendMessage(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Method_GetDataDir(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Init(napi_env__*, napi_value__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_module_register", referenced from:
      _register_rn_bridge() in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_open_handle_scope", referenced from:
      Channel::invokeNodeListener(char*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_throw_error", referenced from:
      Method_RegisterChannel(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Channel::setNapiRefs(napi_env__*&, napi_ref__*&) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Method_SendMessage(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Method_GetDataDir(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Init(napi_env__*, napi_value__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_napi_typeof", referenced from:
      Method_RegisterChannel(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Method_SendMessage(napi_env__*, napi_callback_info__*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_node_start", referenced from:
      -[NodeRunner startEngineWithArguments::] in libnodejs-mobile-react-native.a(NodeRunner.o)
  "_uv_async_init", referenced from:
      Channel::setNapiRefs(napi_env__*&, napi_ref__*&) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_uv_async_send", referenced from:
      Channel::flushQueue() in libnodejs-mobile-react-native.a(rn-bridge.o)
      Channel::setNapiRefs(napi_env__*&, napi_ref__*&) in libnodejs-mobile-react-native.a(rn-bridge.o)
      Channel::queueMessage(char*) in libnodejs-mobile-react-native.a(rn-bridge.o)
  "_uv_default_loop", referenced from:
      Channel::setNapiRefs(napi_env__*&, napi_ref__*&) in libnodejs-mobile-react-native.a(rn-bridge.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@cclauss cclauss added the macOS label Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants