Skip to content

Building on Arm64 macOS using cmake throws an error. #2521

@sarooptech

Description

@sarooptech
  • axmol version: 2.5.9
  • devices test on: MacBook Air M3
  • developing environments
    • NDK version: r23c
    • Xcode version: 16.3
    • cmake version: 4.0.1
    • VS Code: 1.99.3
    • The default cmake project generator is "Unix Makefiles"

Steps to Reproduce:

  1. Create a new project using axmol CLI.
  2. Create a build directory and navigate into it using: mkdir build && cd build
  3. Generate build files using cmake: cmake ..
  4. Build the project using make
  5. It will fail to build and throw an error in the axmol/core/media/AvfMediaEngine.mm file, Line number 368.

Solution:

  • Replacing __weak with __unsafe_unretained fixes the problem.

Notes:

  • Building using the Xcode generator works without any problem.
  • I'm using VSCode, which does not use Xcode generator to create a project by default.
  • An error is thrown because the project is using ARC-style code with manual memory management for .mm files. For Xcode, it is working fine because the -fobjc-arc flag is applied to the mm files. The proper solution will be to use the same for other builders.

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

    Issue actions