Bug 572115 - Eclipse Mac arm64 fails to launch
Summary: Eclipse Mac arm64 fails to launch
Status: VERIFIED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Launcher (show other bugs)
Version: 4.20   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 4.20 M2   Edit
Assignee: Lakshmi P Shanmugam CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 572515
Blocks: 565690
  Show dependency tree
 
Reported: 2021-03-19 11:13 EDT by Lakshmi P Shanmugam CLA
Modified: 2021-04-13 06:13 EDT (History)
6 users (show)

See Also:


Attachments
Script to launch Eclipse (602 bytes, text/plain)
2021-03-31 03:48 EDT, Lakshmi P Shanmugam CLA
no flags Details
Log from JNA launch (34.63 KB, application/octet-stream)
2021-03-31 09:00 EDT, Jesse Gallagher CLA
no flags Details
Log with fixed -arch (50.07 KB, application/octet-stream)
2021-03-31 09:36 EDT, Jesse Gallagher CLA
no flags Details
Script to launch eclipse (1.00 KB, text/plain)
2021-04-08 10:33 EDT, Lakshmi P Shanmugam CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lakshmi P Shanmugam CLA 2021-03-19 11:13:00 EDT
From https://bugs.eclipse.org/bugs/show_bug.cgi?id=570540#c29, the Eclipse Mac arm64 build fails to launch with this error:

% open -a Eclipse.app
The application /Applications/Eclipse.app cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10826 "kLSNoLaunchPermissionErr: User doesn't have permission to launch the app (managed networks)" UserInfo={_LSFunction=_LSLaunchWithRunningboard, _LSLine=2508, NSUnderlyingError=0x13bf26e40 {Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x13bf25ac0 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed with error: 153}}}}}


Link to latest build - https://download.eclipse.org/eclipse/downloads/drops4/I20210319-0030/download.php?dropFile=eclipse-SDK-I20210319-0030-macosx-cocoa-arm64.dmg
Comment 1 Lakshmi P Shanmugam CLA 2021-03-19 11:15:41 EDT
Bug 572096 and Bug 572113 tracks rebuilding of the core.filesystem and equinox.security natives libraries.
Comment 2 Lakshmi P Shanmugam CLA 2021-03-27 08:08:43 EDT
All native libraries are now ported to Arm64, can someone try the latest build and see if it works - https://download.eclipse.org/eclipse/downloads/drops4/I20210326-1800/download.php?dropFile=eclipse-SDK-I20210326-1800-macosx-cocoa-arm64.dmg
Comment 3 Jesse Gallagher CLA 2021-03-29 13:21:28 EDT
Trying that build and the one from today, I ended up with the same error trail that you had originally. `pkgutil --check-signature` reports an invalid signature, but my untrained attempts at using `codesign` to re-sign it (like https://stackoverflow.com/a/64985297/858171 ) weren't effective.
Comment 4 Lakshmi P Shanmugam CLA 2021-03-30 07:18:21 EDT
(In reply to Jesse Gallagher from comment #3)
> Trying that build and the one from today, I ended up with the same error
> trail that you had originally. `pkgutil --check-signature` reports an
> invalid signature, but my untrained attempts at using `codesign` to re-sign
> it (like https://stackoverflow.com/a/64985297/858171 ) weren't effective.

Thanks for checking.

I verified the signature of the arm64 build (on x86_64 machine) using codesign and pkgutil, but it was valid.

/Applications % codesign --verify --verbose Eclipse.app

Eclipse.app: valid on disk
Eclipse.app: satisfies its Designated Requirement

/Applications % pkgutil --check-signature Eclipse.app

Package "Eclipse":
   Status: signed by a certificate trusted by macOS
   Certificate Chain:
    1. Developer ID Application: Eclipse Foundation, Inc. (JCDTMS22B4)
       Expires: 2024-08-26 17:23:13 +0000
       SHA256 Fingerprint:
           1B 8E 95 57 A8 0E 3B FC 44 C8 A7 6C 78 2B 76 D7 71 4C F9 2E F9 64 
           52 9B 26 52 1C 1E 2A 86 93 BE
       ------------------------------------------------------------------------
    2. Developer ID Certification Authority
       Expires: 2027-02-01 22:12:15 +0000
       SHA256 Fingerprint:
           7A FC 9D 01 A6 2F 03 A2 DE 96 37 93 6D 4A FE 68 09 0D 2D E1 8D 03 
           F2 9C 88 CF B0 B1 BA 63 58 7F
       ------------------------------------------------------------------------
    3. Apple Root CA
       Expires: 2035-02-09 21:40:36 +0000
       SHA256 Fingerprint:
           B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C 
           68 C5 BE 91 B5 A1 10 01 F0 24
Comment 5 Jesse Gallagher CLA 2021-03-30 18:03:44 EDT
I've checked with a fresh download and I see what you see when it comes to signatures - I suspect that I tainted my own tests by trying other fixes in that SO thread, so my apologies for that.

Unfortunately, I still see the same trouble trying to launch it, but at least it's good to know that it's not that the signature is corrupt as such. I'm going to attempt to build Eclipse locally to see if it behaves any differently, though I see it's a bit of a bear, so I may not succeed.
Comment 6 Lakshmi P Shanmugam CLA 2021-03-31 03:44:50 EDT
(In reply to Jesse Gallagher from comment #5)
> I've checked with a fresh download and I see what you see when it comes to
> signatures - I suspect that I tainted my own tests by trying other fixes in
> that SO thread, so my apologies for that.
> 
No problem, thanks Jesse for trying again and confirming.

> Unfortunately, I still see the same trouble trying to launch it, but at
> least it's good to know that it's not that the signature is corrupt as such.
> I'm going to attempt to build Eclipse locally to see if it behaves any
> differently, though I see it's a bit of a bear, so I may not succeed.

Looks like some permission issue(s) while trying to launch Eclipse.app, not sure if it's related to the build. Can you try launching Eclipse using the java launcher, instead of Eclipse.app?
Comment 7 Lakshmi P Shanmugam CLA 2021-03-31 03:48:35 EDT
Created attachment 285994 [details]
Script to launch Eclipse

> 
> Looks like some permission issue(s) while trying to launch Eclipse.app, not
> sure if it's related to the build. Can you try launching Eclipse using the
> java launcher, instead of Eclipse.app?

Can you please use this script to launch Eclipse with java launcher? Eclipse path is set to /Applications/Eclipse.app, please modify it as required.
Comment 8 Jesse Gallagher CLA 2021-03-31 09:00:49 EDT
Created attachment 285997 [details]
Log from JNA launch

I ended up with mixed results running it from the command line (both with a basic `java -jar` launch and with the extra options from your script. Fortunately, the immediate culprit looks clear: the version of JNA included doesn't include macOS/arm64 support. I'll drop the logs in as an attachment here, though they mostly reinforce the JNA bit.

The good part of the mixed results, though, is that I was able to launch arm64 Eclipse from within another Eclipse installation by adding the 5.8.0 builds of jna and jna-platform from Maven into the Target Platform. There are some odd text-alignment issues, but, other than that, it runs like a dream: https://www.dropbox.com/s/7nch4xdkdk0h0hq/Screen%20Shot%202021-03-31%20at%208.57.27%20AM.png?raw=1
Comment 9 Lakshmi P Shanmugam CLA 2021-03-31 09:31:41 EDT
(In reply to Jesse Gallagher from comment #8)
> Created attachment 285997 [details]
> Log from JNA launch
> 
> I ended up with mixed results running it from the command line (both with a
> basic `java -jar` launch and with the extra options from your script.
> Fortunately, the immediate culprit looks clear: the version of JNA included
> doesn't include macOS/arm64 support. I'll drop the logs in as an attachment
> here, though they mostly reinforce the JNA bit.
> 
> The good part of the mixed results, though, is that I was able to launch
> arm64 Eclipse from within another Eclipse installation by adding the 5.8.0
> builds of jna and jna-platform from Maven into the Target Platform. There
> are some odd text-alignment issues, but, other than that, it runs like a
> dream:
> https://www.dropbox.com/s/7nch4xdkdk0h0hq/Screen%20Shot%202021-03-
> 31%20at%208.57.27%20AM.png?raw=1

That's great, thanks for trying it out!

From the log, I just realized that arch is not set correctly. It is set to -arch x86_64 in the command line, it should be set to -arch arm64. Can you pls try with that?
 
Sorry, I was testing the script with x86_64 and forgot to update it.
Comment 10 Jesse Gallagher CLA 2021-03-31 09:36:15 EDT
Created attachment 286002 [details]
Log with fixed -arch

Ah! Yeah, I missed that too. In any event, the result is at least largely the same, with a stack of failed bundle resolutions coming down to the non-arm64 JNA build.
Comment 11 Lakshmi P Shanmugam CLA 2021-04-01 02:58:54 EDT
(In reply to Jesse Gallagher from comment #10)
> Created attachment 286002 [details]
> Log with fixed -arch
> 
> Ah! Yeah, I missed that too. In any event, the result is at least largely
> the same, with a stack of failed bundle resolutions coming down to the
> non-arm64 JNA build.

Thanks a lot for investigating this!
Yes, the problem is with JNA resolution. We either have to use the newer JNA 5.8 which has arm64 support or remove the dependency if possible . I'll create a bug to investigate this.
Comment 12 Lakshmi P Shanmugam CLA 2021-04-01 03:26:50 EDT
(In reply to Lakshmi P Shanmugam from comment #11)
> (In reply to Jesse Gallagher from comment #10)
> > Created attachment 286002 [details]
> > Log with fixed -arch
> > 
> > Ah! Yeah, I missed that too. In any event, the result is at least largely
> > the same, with a stack of failed bundle resolutions coming down to the
> > non-arm64 JNA build.
> 
> Thanks a lot for investigating this!
> Yes, the problem is with JNA resolution. We either have to use the newer JNA
> 5.8 which has arm64 support or remove the dependency if possible . I'll
> create a bug to investigate this.

Opened Bug 572515.
Comment 13 Lakshmi P Shanmugam CLA 2021-04-08 05:33:45 EDT
The latest build [1] includes JNA 5.8. I can launch Eclipse arm64 now using the Java launcher.

Opening the Eclipse.app still doesn't work, gives the same permission error as before.

[1] - https://download.eclipse.org/eclipse/downloads/drops4/I20210407-1800/download.php?dropFile=eclipse-SDK-I20210407-1800-macosx-cocoa-arm64.dmg
Comment 14 Lakshmi P Shanmugam CLA 2021-04-08 10:33:28 EDT
Created attachment 286065 [details]
Script to launch eclipse

Script used to launch Eclipse using Java launcher. JAVA_HOME should be set to Java home of arm64 Java before launching.
Comment 15 Eclipse Genie CLA 2021-04-09 07:05:05 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.framework/+/179095
Comment 16 Lakshmi P Shanmugam CLA 2021-04-09 10:58:57 EDT
Checking the eclipse launcher executable using lldb says Malformed Mach-o file. Seems like using the linker flag -pagezero_size 1000 on Mac arm64 breaks the binary. Building launcher without the flag fixes the error. Found a few references [1] of this issue online, but didn't find any official documentation on this problem.

The flag was added by Bug 540659 to support JVMs like OpenJ9. The patch updates the makefile, to use the linker flag only for x86_64. Removing this does not affect Eclipse launcher for x86_64.

[1] - https://github.com/wg/wrk/issues/448, https://github.com/LuaJIT/LuaJIT/issues/649, https://developer.apple.com/forums/thread/655950
Comment 19 Jesse Gallagher CLA 2021-04-10 12:03:40 EDT
Good news on this front: with the build from today, once I configured eclipse.ini to point to the Zulu JVM, it launches and runs speedily. I've installed the plugins from my normal environment and, other than visual oddities, everything has loaded up smoothly and it's, as you'd expect, noticeably faster.
Comment 20 Lakshmi P Shanmugam CLA 2021-04-12 05:51:06 EDT
(In reply to Jesse Gallagher from comment #19)
> Good news on this front: with the build from today, once I configured
> eclipse.ini to point to the Zulu JVM, it launches and runs speedily. I've
> installed the plugins from my normal environment and, other than visual
> oddities, everything has loaded up smoothly and it's, as you'd expect,
> noticeably faster.

Thanks for verifying Jesse!

I tried the latest build [1] and Eclipse launches fine when:
- Zulu JVM is installed and /usr/libexec/java_home points to it 
- or eclipse.ini points to the Zulu VM
- or run ./eclipse -vm <path-to-vm> on command-line

[1] - https://download.eclipse.org/eclipse/downloads/drops4/I20210411-1800/download.php?dropFile=eclipse-SDK-I20210411-1800-macosx-cocoa-arm64.dmg
Comment 21 Lakshmi P Shanmugam CLA 2021-04-13 06:13:21 EDT
Verified with I20210411-1800 on Mac M1.

Thanks Tom for the review!