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

Mac M1 Support #41

Closed
andriy-gerasika opened this issue Mar 9, 2021 · 15 comments
Closed

Mac M1 Support #41

andriy-gerasika opened this issue Mar 9, 2021 · 15 comments

Comments

@andriy-gerasika
Copy link
Contributor

Hi,
is it possible to upgrade the library to include Mac M1 support:

  • JNA v5.7 has Mac M1 support
  • Zulu OpenJDK (incl. JavaFX 8 on Mac M1)
@shannah
Copy link
Owner

shannah commented Mar 9, 2021

I just gave a feeble effort to build it on my arm mac in the hope that it would just work. But no such luck. I'm getting some build errors related to JavaNativeFoundation not being available. I fished around a bit but don't have time right now.

I'll give it another try later (no ETA) when I have more time to work on it.

@andriy-gerasika
Copy link
Contributor Author

create a sample PR solving the problem w/ JavaNativeFoundation

I have one more question:
why it is said on the front page the project requires Java 11 or higher on MacOS? I am using current version w/ Java 8 on MacOS and plan to use the upcoming version on Mac M1 using Azul/Zulu Java 8 -- is it possible not to make Java 11 a requirement in the future version and compile the JAR w/ Java 8 compatibility option on?

Thanks

@shannah
Copy link
Owner

shannah commented Mar 10, 2021

Up until recently it supported Java 8. Some PRs came in that moved it to Java11. I didn't see any reason why not to bump to Java11. Probably wouldn't be hard to backport. I think it just uses a few convenience features of Java11. Nothing fundamental. If you want to try building for Java 8, I'm sure you could flush out the build errors relatively quickly.

shannah added a commit that referenced this issue Mar 10, 2021
…ation

bugfix for #41 -- remove JavaNativeFoundation framework
@shannah
Copy link
Owner

shannah commented Mar 10, 2021

Thank for the PR.
Build works. Tests fail on ARM (meaning build didn't really work).
https://gist.github.com/shannah/836d8e8944559cb733c12334387ff404

Don't have time to dig into details of it right now.
If you have time to dig into this, I can give you SSH access to the Arm box so you can play with it.

@andriy-gerasika
Copy link
Contributor Author

sorry, I did not ran test on my Mac M1 -- there is indeed a problem w/ Mac M1 (not Intel though). I receive the following Java crash logs on "mvn clean install":
http://www.gerixsoft.com/tmp/hs_err_pid8603.log
http://www.gerixsoft.com/tmp/hs_err_pid8450.log
-- looks like there is a bug in JNA v5.7 on ARM or there is some problem with binding to Objective C runtime lib

@andriy-gerasika
Copy link
Contributor Author

Hi,
I was able to find a problem -- for some reason methodSignatureForSelector on Mac M1 returns null:
http://www.gerixsoft.com/tmp/methodSignatureForSelector.png
but I am not sure why...

@shannah
Copy link
Owner

shannah commented Mar 24, 2021

At the break point in the screenshot, what is context of that methodSignatureForSelector: call? I.e. What is the receiver/object and what is the selector?

@andriy-gerasika
Copy link
Contributor Author

receiver is "NSObject", selector is "alloc"
http://www.gerixsoft.com/tmp/methodSignatureForSelector2.png

@shannah
Copy link
Owner

shannah commented Mar 25, 2021

Thanks for that. Odd. I'm not sure why this should be the case. NSObject certainly supports the "alloc" selector.
I'll need to dig into it. Perhaps there is a change to how Objective-C classes work (since in this case, the receiver is a Class, and not an NSObject instance).

@ghost
Copy link

ghost commented Jul 22, 2021

Has anyone had the chance to check into this a little more?

Perhaps this would be helpful?

https://developer.apple.com/documentation/apple-silicon/addressing-architectural-differences-in-your-macos-code#Enable-Strict-Type-Enforcement-for-Dynamic-Method-Dispatching

I am not sure if it is relevant or not as this is beyond my scope of knowledge but I am willing to test any changes or help in any other way possible if necessary.

@shannah
Copy link
Owner

shannah commented Jul 22, 2021

I just picked up an M1 mac over the weekend but haven't had a chance to set it up yet. Well look into this further once it is set up.

@dkocher
Copy link

dkocher commented Nov 8, 2021

You might be interested in this PR tackling the same issues for Rococoa.

@rednoah
Copy link

rednoah commented Dec 1, 2021

@shannah I'd be happy to hire you as a freelancer to work on M1 support for objc bridge.

@shannah
Copy link
Owner

shannah commented Dec 1, 2021

Thanks @rednoah. Much appreciated. Send me an email at [email protected] and let's talk.

shannah pushed a commit that referenced this issue Dec 4, 2021
Thanks to @rednoah for sponsoring this work.
@shannah shannah closed this as completed Dec 4, 2021
@ViRb3
Copy link

ViRb3 commented Dec 6, 2021

@rednoah @shannah Thank you so much for the sponsorship and effort respectively, thanks to you Minecraft is one step closer to fully functioning on M1 - https://github.com/MinecraftMachina/ManyMC.

marcesengel added a commit to marcesengel/buck that referenced this issue Mar 3, 2022
Updated jna, java-objc-bridge, sqlite-jdbc and zstd-jni to supported version

Breaks java 8 support due to java-objc-bridge bump
shannah/Java-Objective-C-Bridge#41 (comment)
cortinico pushed a commit to marcesengel/buck that referenced this issue Aug 17, 2022
Updated jna, java-objc-bridge, sqlite-jdbc and zstd-jni to supported version

Breaks java 8 support due to java-objc-bridge bump
shannah/Java-Objective-C-Bridge#41 (comment)
cortinico pushed a commit to facebook/buck that referenced this issue Oct 31, 2022
Updated jna, java-objc-bridge, sqlite-jdbc and zstd-jni to supported version

Breaks java 8 support due to java-objc-bridge bump
shannah/Java-Objective-C-Bridge#41 (comment)
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

5 participants