Skip to content

Native addon directory structure when building for iOS targets #3

@kr617

Description

@kr617

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kr617

        Issue actions

          Native addon directory structure when building for iOS targets · Issue #3 · nodejs-mobile/prebuild-for-nodejs-mobile