Skip to content

Patch-up iOS Simulator's architectures logic - #432

Open
MRK2009 wants to merge 1 commit into
openfl:mainfrom
MRK2009:main
Open

MRK2009 wants to merge 1 commit into
openfl:mainfrom
MRK2009:main

Conversation

@MRK2009

@MRK2009 MRK2009 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

This is based of Karim's patch in FunkinCrew's hxcpp fork

@MRK2009 MRK2009 changed the title Added a better support for ARM64 iOS Simulator Patch-up iOS Simulator's architectures logic Nov 8, 2026
@MRK2009
MRK2009 force-pushed the main branch 2 times, most recently from e29c29d to 9c15dc7 Compare November 8, 2026 16:06

@dimensionscape dimensionscape left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Two things need to change before it can go in, and I have one question.

  1. LIBEXTRA when both HXCPP_M64 and HXCPP_ARM64 are defined. The build tool sets both when the architecture comes from HXCPP_ARCH=arm64 or from the host on an Apple Silicon Mac (set64 in tools/hxcpp/BuildTool.hx). The current lines give .iphonesim-arm64 there. With the new section none of the three lines match, so LIBEXTRA falls through to the generic -64 further down finish-setup.xml and the library gets the wrong name. The current three lines already pick the right suffix in every case, so please leave them as they are.

  2. -target is added unconditionally, but its value is only added for HXCPP_M64 or HXCPP_ARM64. A build with neither gets a bare -target that takes -isysroot as its value. Putting the same condition on the flag fixes it: <flag value="-target" if="HXCPP_M64 || HXCPP_ARM64"/>, in both the compiler and the linker.

  3. What does -target fix? libhxcpp already builds arm64 simulator libraries with -arch arm64 and -mios-simulator-version-min, so I'd like to see the command and the error you get without it, and the Xcode version. If it's the dylib link, which has no version-min flag, say so in the PR and the commit message, and add a line to Changes.md. CI doesn't build for the simulator, so it can't tell us either way.

Please also drop the whitespace changes and the edit to the commented-out flag, so the diff is only the fix.

@MRK2009
MRK2009 marked this pull request as draft November 12, 2026 07:31
@MRK2009

MRK2009 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

I'll look when I have time.

@dimensionscape dimensionscape left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the LIBEXTRA section is right now: set64 defines both HXCPP_M64 and HXCPP_ARM64 for arm64, and it picks .iphonesim-arm64 there, with the other two cases coming out as before.

The flags won't build, though. Without -target, the triples are bare arguments after -arch arm64, so clang takes arm64-apple-ios-simulator as an input file and fails, in both the compiler and the linker blocks. Either put the flag back in front of them, guarded so there is never a bare -target:

<flag value="-target" if="HXCPP_M64 || HXCPP_ARM64"/>
<flag value="x86_64-apple-ios-simulator" if="HXCPP_M64" unless="HXCPP_ARM64" />
<flag value="arm64-apple-ios-simulator" if="HXCPP_ARM64" />

or drop the triples and keep -arch, if that with -mios-simulator-version-min already does what you need. Which one is right depends on the error you hit, so could you paste it, with your Xcode version? CI has no iOS simulator build, so it won't catch this either way.

The whitespace-only changes on the -arch lines and the edit to the commented-out version-min line can go too, so the diff is just the fix.

@MRK2009

MRK2009 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Yes, but I'm testing stuff with the change after I forked FunkinCrew's hxcpp.

@MRK2009

MRK2009 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

The reason why I added -target flag because it could lock the current architecture and won't target the legacy one.

@MRK2009

MRK2009 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Oh actually, I might try drop it because it looks unnecessary.

@MRK2009
MRK2009 marked this pull request as ready for review November 12, 2026 11:28
@MRK2009
MRK2009 force-pushed the main branch 2 times, most recently from bff2673 to 211af8b Compare November 12, 2026 16:41
@dimensionscape

Copy link
Copy Markdown
Member

Thanks for trimming it down. As it stands, though, the section gives the same LIBEXTRA as the three lines on main in every case: .iphonesim-arm64 with HXCPP_ARM64, .iphonesim-64 with HXCPP_M64 alone, and .iphonesim with neither. So it doesn't change any build, and the Changes.md line would say something was fixed when nothing behaves differently.

What did you hit on the simulator? The error, your Xcode version and the command you ran would tell us what actually needs to change. I've cancelled this commit's CI run for now, since it can't change any result and the runners are backed up. It runs again on your next push.

@MRK2009

MRK2009 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

It didn't hit any errors though, but tbh I don't have a Mac to test it locally.

But I would consider it as a chore than a fix, so I should probably change the `Changes.md' a bit.

Oh btw, I use 26 in Github Actions.

Co-Authored-By: Karim Akra <144803230+KarimAkra@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants