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

Fix lime.ndll build for Apple Silicon #1642

Merged
merged 4 commits into from
May 30, 2024

Conversation

tobil4sk
Copy link
Member

@tobil4sk tobil4sk commented Mar 1, 2023

Applies the patch from openfl/libopenal#1, along with some other fixes to get the openal config up to date with the version used in 8.2.0-Dev. Also applies fixes for pixman build.

These patches allow for successful building of the lime ndll on arm64 Mac systems.

See #1640.

@tobil4sk
Copy link
Member Author

tobil4sk commented Mar 1, 2023

On Apple Silicon it still builds the x86_64 ndll by default unless -DHXCPP_ARM64 is specified. Perhaps something needs to be updated in: https://github.com/openfl/lime/blob/8.2.0-Dev/project/Build.xml

@player-03
Copy link
Contributor

That's odd. I thought that was set in the platform class, but MacPlatform only sets one architecture at a time.

@joshtynjala
Copy link
Member

MacPlatform seems like the right place to me. What are you referring to when you mention multiple architectures? "Universal" apps that support both Apple Silicon and Intel?

@joshtynjala
Copy link
Member

I was looking at LinuxPlatform a bit today in relation to Raspberry Pi stuff. I realized that hxp's System.hostArchitecture doesn't have an ARM64 enum value yet. That's going to need to be updated for Lime tools to be able to detect that architecture.

@player-03
Copy link
Contributor

What are you referring to when you mention multiple architectures?

Me? I was responding to the fact that it's building multiple ndlls. I think it chooses which ndll to build based on which architectures are specified, so I was looking those up. But since it only specifies one architecture, I'd expect it to only build one ndll.

@tobil4sk
Copy link
Member Author

tobil4sk commented Mar 2, 2023

With 55ca39d, it would be good to double check that the pixman/openal changes here won't break anything for raspberry pi.

I realized that hxp's System.hostArchitecture doesn't have an ARM64 enum value yet

Created an issue here to keep track of the hxp changes: openfl/hxp#29

@joshtynjala
Copy link
Member

Sorry for the noise. I didn’t see any discussion about multiple ndlls being built. I guess I mistakenly thought the issue was that it built the wrong architecture by default, but still built only a single ndll.

@tobil4sk
Copy link
Member Author

tobil4sk commented Mar 2, 2023

I guess I mistakenly thought the issue was that it built the wrong architecture by default, but still built only a single ndll.

This is correct, on the m1 machine, by default it built Mac64. MacArm64 was only built with the -DHXCPP_ARM64 flag set.

@tobil4sk
Copy link
Member Author

tobil4sk commented Mar 5, 2023

I realized that hxp's System.hostArchitecture doesn't have an ARM64 enum value yet. That's going to need to be updated for Lime tools to be able to detect that architecture.

I've opened a PR to add this: openfl/hxp#30. I assume we'll have to wait for a new hxp release to make use of this?

@joshtynjala
Copy link
Member

I assume we'll have to wait for a new hxp release to make use of this?

Yeah.

@jgranick
Copy link
Member

iOS, Android and other platform targets use multiple architectures in a single build. If this is needed or desired for future macOS builds, that functionality could easily be copied and modified from those targets.

@JonnycatMeow
Copy link

i tried to build the arm64 ndll for macos but it gave me some errors
Screen Shot 2023-07-24 at 7 04 19 AM

@JonnycatMeow
Copy link

and i used the fix/m1-build-ndll

@JonnycatMeow
Copy link

and my machine is a x86_64 but i have xcode

@joshtynjala
Copy link
Member

Inline variable initialization must be a constant value

I recall that this one is caused by using the no-inline option with Haxe 4.3. You may need to temporarily downgrade to Haxe 4.2. I don't think our Haxe 4.3 fixes have been merged into the 8.2.0-Dev branch yet, which is what the PR is based on.

@JonnycatMeow
Copy link

oh ok

@tobil4sk
Copy link
Member Author

I don't think our Haxe 4.3 fixes have been merged into the 8.2.0-Dev branch yet

Actually, it looks like 8.2.0-Dev does have most of these patches now but my branch was still out of date. I've updated it now, hopefully this should solve those 4.3 errors.

@JonnycatMeow
Copy link

it builds good now thank you

@JonnycatMeow
Copy link

nvm got another error.
Screen Shot 2023-07-26 at 3 28 25 PM

@JonnycatMeow
Copy link

JonnycatMeow commented Jul 26, 2023

i used the branch fix/m1-build-dll

@tobil4sk
Copy link
Member Author

nvm got another error.

@JonnycatMeow Did you manage to resolve this? It's possible that your submodules were not updated after checking out to this branch. The location of the header files is different in the version of pixman used in this branch (because it is based on 8.2.0-Dev rather than develop).

See: https://github.com/openfl/lime/blob/8.2.0-Dev/project/README.md#build-troubleshooting

@tobil4sk
Copy link
Member Author

This PR just fixes compilation issues with the submodules, the rest of the apple silicon related changes are handled in #1642. This won't affect rosetta. Would it be possible to merge this?

@joshtynjala joshtynjala merged commit 54d6b72 into openfl:8.2.0-Dev May 30, 2024
26 checks passed
@tobil4sk tobil4sk deleted the fix/m1-build-ndll branch May 30, 2024 16:30
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.

5 participants