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

Native addon directory structure when building for iOS targets #3

Open
kr617 opened this issue Nov 16, 2023 · 0 comments
Open

Native addon directory structure when building for iOS targets #3

kr617 opened this issue Nov 16, 2023 · 0 comments

Comments

@kr617
Copy link

kr617 commented Nov 16, 2023

I'm prototyping a simple C++ addon that will run on iOS devices and simulators (as well as Android devices) as part of a Node application using Node.js for Mobile Apps. When building my addon for iOS with prebuild-for-nodejs-mobile, the tool produces some output that confuses me. Here's an example:

% npx prebuild-for-nodejs-mobile ios-arm64-simulator
Minimum iOS version supported is incorrect (14.0), patching it with "vtool" to become 13.0
BUILT prebuilds/ios-arm64-simulator/dummyaddon.node
% tree prebuilds
prebuilds
└── ios-arm64-simulator
    └── dummyaddon.node
        └── dummyaddon

3 directories, 1 file

I have two questions. First, what is the cause of the "Minimum iOS version" warning and should this concern me?

Second, why does the tool place the final addon inside a directory with a ".node" extension, but the addon itself has no ".node" extension? I tried loading the addon in my Node app (running within an iOS simulator) using variations of the following:

const addon = require('./prebuilds/ios-arm64-simulator/dummyaddon.node');

All of these attempts failed until I finally renamed the inner-most file from "dummyaddon" to "dummyaddon.node" as follows:

const addon = require('./prebuilds/ios-arm64-simulator/dummyaddon.node/dummyaddon.node');

I was then able to successfully call my C++ code from JavaScript.

Why does the tool produce this strange directory structure for iOS builds, rather than a simple .node file as it does for Android builds? Additionally, is there some method to package multiple iOS-related build targets together?

Thanks in advance for any help you can provide!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant