Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lime rebuild ios fails on M1 due to multiple architecture flags #1733

Closed
tobil4sk opened this issue Dec 20, 2023 · 4 comments
Closed

lime rebuild ios fails on M1 due to multiple architecture flags #1733

tobil4sk opened this issue Dec 20, 2023 · 4 comments

Comments

@tobil4sk
Copy link
Contributor

By default, when running lime rebuild ios, both armv7 and arm64 architecture flags are active. See:

var armv7 = (command == "rebuild"
|| (project.architectures.indexOf(Architecture.ARMV7) > -1 && !project.targetFlags.exists("simulator")));
var armv7s = (project.architectures.indexOf(Architecture.ARMV7S) > -1 && !project.targetFlags.exists("simulator"));
var arm64 = (command == "rebuild"
|| (project.architectures.indexOf(Architecture.ARM64) > -1 && !project.targetFlags.exists("simulator")));

This means that HXCPP_ARMV7 and HXCPP_ARM64 are set at once:

if (armv7) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7"]);
if (armv7s) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7S"]);
if (arm64) commands.push(["-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARM64"]);

The hxcpp code does not allow for these flags to be set at once (see https://github.com/HaxeFoundation/hxcpp/blob/18f87b949464ddcf24c6a83a2f7b8f76233540bc/toolchain/iphoneos-toolchain.xml#L43-L47).

The compiler receives -arch armv7 arm64, so only armv7 is treated as an architecture flag, and the arm64 is treated as a file to be compiled, resulting in the error:

Error: clang: error: no such file or directory: 'arm64'

Perhaps it's fine to just no longer set HXCPP_ARMV7 by default? Considering the commit message here: f34b595.

@player-03
Copy link
Contributor

In IOSPlatform, commands is an array of arrays. Each sub-array is handled independently, meaning the two flags aren't set at once. Your error must be coming from somewhere else.

@tobil4sk
Copy link
Contributor Author

Each sub-array is handled independently, meaning the two flags aren't set at once.

Ah you're right... So the HXCPP_ARM64 flag is being set from elsewhere. Worth noting that this problem happened when compiling ios from m1.

@tobil4sk tobil4sk changed the title lime rebuild ios fails due to multiple architecture flags lime rebuild ios fails on M1 due to multiple architecture flags Dec 20, 2023
@tobil4sk
Copy link
Contributor Author

Maybe the problem is just that the host architecture results in a flag being added, when that should not be happening.

This would go unnoticed on intel mac is because the x86_64 architecture does not result in a -arch flag being set, so even if the host architecture bled through into the compiler flags it wouldn't cause any issues:

https://github.com/HaxeFoundation/hxcpp/blob/18f87b949464ddcf24c6a83a2f7b8f76233540bc/toolchain/iphoneos-toolchain.xml#L43-L47

@tobil4sk
Copy link
Contributor Author

After further debugging, it looks like the problem lies with hxcpp, not lime: HaxeFoundation/hxcpp#1079

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

No branches or pull requests

2 participants