Skip to content

Need to turn off precompiled headers to build Mac universal binary. #14755

@abcbarryn

Description

@abcbarryn

MAME version

0.283

System information

Darwin dynamic8.s2.abcm.com 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:03:25 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T8122 arm64
Xcode 26.2

INI configuration details

N/A

Emulated system/software

N/A

Incorrect behaviour

clang++: error: cannot use 'precompiled-header' output with multiple -arch options

Expected behaviour

Ability to compile a universal MacOS binary or cross compile an X86_64 binary on an Apple silicon ARM64 Mac.

Steps to reproduce

In the makefile on an Apple silicon Mac set these options:

ARCHOPTS = -Xclang -target-sdk-version=11.1 --sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=11.1 -arch x86_64
ARCHOPTS_C = -Xclang -target-sdk-version=11.1 --sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=11.1 -arch x86_64
ARCHOPTS_CXX = -Xclang -target-sdk-version=11.1 --sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=11.1 -arch x86_64
ARCHOPTS_OBJC = -Xclang -target-sdk-version=11.1 --sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=11.1 -arch x86_64
ARCHOPTS_OBJCXX = -Xclang -target-sdk-version=11.1 --sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=11.1 -arch x86_64
# OPT_FLAGS =
LDOPTS = -Xclang -target-sdk-version=11.1 -Wl,-macos_version_min,11.1 --sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=11.1 -arch x86_64

The run:
make TARGETOS=macosx REGENIE=1 TOOLS=1

Additional details

I can build an X86_64 MAME binary on an Intel Mac and then use lipo to combine it with an ARM64 binary to make a universal binary, but I can't cross compile an X86_64 binary on an ARM64 Mac, or pass multiple -arch flags to compile a universal binary. I have been unable to find where to successfully set the NoPCH flag in the build system to disable precompiled headers so this will work.

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