-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Proper Mac M1 support, updated node, npm and yarn #204
Conversation
Hi @iamironz, thank you for the PR, but I'd just like to confirm something first, the On M1 macs (with the correct JVM) We also have a task in this project that can be used to test these: gradle-node-plugin/build.gradle.kts Lines 94 to 97 in 9418c44
I'm hoping to be able to take a good look at it tomorrow, the logic here is a bit hairy to read through :P |
oh and there'll probably be test failures from updating the node/npm/yarn versions in the tests |
Hey @deepy !
Exactly, I've debugged your plugin implementation a few times and can confirm that I've receiving
It is correct jvm version as the |
Could you test it with the But I also found that a lot of people have Gradle running under a different JDK without knowing about it and if you are running under Rosetta (or the JDK used by Gradle is) then using the arm node is going to fail. Looking at |
Yeah, the output is:
It is interesting why conditions sometimes returns then x86_64. As I said I'm using arm64 compatible build of Azul jdk, my java processes is not running under Rosetta 2. |
Stranger things happened now: |
Yes, I can confirm that the problem with |
That's where Since it shows all parameters and their result. But I suspect that if you were to try and use an I wonder where something goes wrong, maybe they've made a mistake with their jdk8? |
Hey!
No, definitely, all my JDK's are all running In Apple environment. I may admit that JDK 11 is also affected by this issue. Proof: As you can see only one instance of JRE are running and the kind are Apple instead of Intel: In one of my projects with Gradle gradle-7.2 it is after the few iteration of compilation start reporting for me x86_64 :) It was totally broken :D |
A person on my team who is using an M1 Mac is reporting the same issue where things worked for them yesterday when it comes to downloading node but today they are getting:
So this also looks like an intermittent issue on our end. Please let me know if there is anything I can do to help with getting a fix for this merged and released. |
I've been asking around a bit to try and figure out how this could be happening and I can't really find a good answer, but if i.e. if uname says we're x64 then we need to assume we're running under Rosetta and get the x64 binary since the arm ones won't work. I don't have a M1 Mac to test things out on so I can't confirm these but @erdi to get more output you could add something like this: def parameterTest = tasks.register("runParameterTest"){
doLast {
def instance = com.github.gradle.node.util.PlatformHelper.INSTANCE
project.logger.lifecycle("Your os.name is: '${System.getProperty("os.name")}' and is parsed as: ${instance.osName}")
project.logger.lifecycle("Your os.arch is: '${System.getProperty("os.arch")}' and is parsed as: ${instance.osArch}")
}
}
tasks.named("nodeSetup").configure {
finalizedBy(parameterTest)
} If that ends up saying |
That is so bizarre :D One easy way to test this would be to clone this repository (and use the branch master) and add it to And then edit PlatformHelper's |
Of course, when I try to run a test with the includeBuild method, it magically reverts to working again. This must have been what happened to me yesterday, as I was initially running our build fine, and it only occurred later in the day after I ran the build a few times. I checked the output of the
I have walked through everything I can think of that I did yesterday when it happened and have not yet been able to trigger it again so far. I still tried the tests as you suggested, even though my build is magically working again: -when
-when
If the issue comes back, I will try to dig deeper by using the includeBuild method you suggested. If there is anything else you want me to try let me know 👍🏼 |
@deepy Hey! What's the status of this PR? Users still facing issues on M1 |
@iamironz this specific one has failing tests, but I'll push a branch tomorrow and hopefully create an init-script so it could be tested without modifying the build. afaik, if uname reports x86_64 we're running under Rosetta and using an arm64 binary is not going to work so it's going to resolve to x64 |
Even if we were launched by aarch64 Java, see #204 for discussion.
@deepy Again: I'm not running any Rosetta (means x86) builds of JDK. It is a bug of JDK or the libc (I don't know actually but the bug definitely exists) in the current days which indicates invalid |
I get that you're not running under Rosetta intentionally but I'm not finding any references to people having this issue without running under Rosetta. I guess the proper solution is checking the output of |
Even if we were launched by aarch64 Java, see #204 for discussion.
I'm currently recovering from a fever but will be releasing a minor with some fixes, currently I've added the x86_64 since I know for certain it would work in all cases. I want to replace it with checking against |
My next work computer seems like it's going to be a M1 Mac, so I'll be able to have a better look then |
Hi, is there any update on this one? I ran runParameterTest from master version on a M1 pro and I got the following:
but with all these it still fails with:
UPDATE Tried to do some debug and I think I spot the cause. In my opinion for M1 final name of the node artefact should be like node--darwin-x64.tar.gz, at least for my case. The thing is that I'm not that familiar with kotlin so I'm not currently able to make all the tests run and build properly. If any of you could help me I will really appreciate it! |
@gtebrean if you're on 3.2.1 there's a fix available. |
Thank you so much for the hint, now it finally worked! Maybe it will help if this project readme will be updated with this reference. |
As "uname" syscall in M1 Mac always returns "x86_64" on some Java builds, this value it's not possible to determine in a general way (as previously was described in osArch field lazy block) correct architecture. The good way is first to check for osName and then decide the arch.