Skip to content

[GUIDE] Building for ios on aarch64-mac running macos 12.3.1 #9902

@mahmoudajawad

Description

@mahmoudajawad

Is your feature request related to a problem? Please describe.

Used feature template as not to get the bug label added and disrupt the team. This guide is meant as self reference as well as suggested changes for adding support for using python3 for team.

As NativeScript team indicated in docs, support for python2 has been dropped with macos 12.3. For x86_64 cpus, solution is as simple as installing the language package from Python website, however for aarch64 cpus no build is available, leaving them in the dust.

The docs suggested creating symlink /usr/local/bin/python pointing at /usr/bin/python3, but this seems to hit some issue with xcode 13.3, macos 12.3.1, where xcode will try to install developer tools again if the symlink is created. I found no solution around this at all.

Instead, I went ahead and made the changes to move my current setup to use python3. I'm hoping this guide will help the team figure out needed changes to implement, as well as, a reference for me if I lose the progress I made earlier.

For starter, I'm having the following setup:
Nx workspace: 12.4
NativeScript CLI: 8.2.3
NativeScript ios: 8.2.3

Changes

NativeScript CLI

First thing I had issue with is CLI refusing to work as command python -c 'import six' is failing, so I went ahead and fixed that ~/.npm-global/lib/node_modules/nativescript/node_modules/@nativescript/doctor/src/sys-info.js*:

// Change line 540 from:
// return [4, this.childProcess.exec("python -c \"import six\"")];
// to:
return [4, this.childProcess.exec("python3 -c \"import six\"")];

Now, running CLI should not fail.

NativeScript ios

In this section, I'm making a lot of changes, first of all I'm changes following files**:

path/to/projcet/node_modules/@nativescript/ios/framework/internal/metadata-generator-arm64/bin/build-step-metadata-generator.py
path/to/project/node_modules/@nativescript/ios/framework/internal/metadata-generator-x86_64/bin/build-step-metadata-generator.py
path/to/project/platforms/ios/internal/metadata-generator-arm64/bin/build-step-metadata-generator.py
path/to/project/platforms/ios/internal/metadata-generator-x86_64/bin/build-step-metadata-generator.py

the shebang value needed to be changes:

# from:
# #!/usr/bin/env python
# to:
#!/usr/bin/env python3

And, the files themselves, needed to be changes as done by @NathanWalker here: NativeScript/ios@1e0c0ce

* I'm showing global npm packages location as to allow reader to easily distinguish whether this file is relative to global package, or local one.
** Files updated here include changes not needed as they are for files for x86_64 cpus, I'm leaving it here as is, as that is the actual change I made.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Anything else?

No response

Please accept these terms

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-pending-triageA new feature request pending triage to confirm validity.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions