tmulle opened a new issue #3467:
URL: https://github.com/apache/netbeans/issues/3467


   ### Apache NetBeans version
   
   Latest release
   
   ### What happened
   
   When using the “Open in Terminal” option I get nothing but a blank terminal 
window when running on an M1 Silicon Pro MacBook Pro using native ARM based JDK
   
   After debugging the source code of Netbeans itself it comes down to a 
missing resource in the “_netbeans/ide/bin/nativeexecution/_“ folder for 
“_MacOSX-unknown_64/pty_”
   
   This is because the host information cannot figure out the *CPUFAMILY* and 
is returning “*UNKNOWN*”
   
   Things I tried:
   
   1. Changed the “_netbeans/ide/bin/nativeexecution/hostinfo.sh_” file as 
follows:
   
   Add another check for CPUFAMILY and return ARM:
   
   
   ```
   CPUFAMILY=`(echo ${CPUTYPE} | egrep "^i|x86_64|athlon|Intel" >/dev/null && 
echo x86) || echo ${CPUTYPE}`
   if [ "${CPUFAMILY}" = "sparc64" ]; then
      CPUFAMILY="sparc"
   fi
   
   # New check if ARM64 then return ARM so Java code will stop returning 
“UNKNOWN”
   if [ "${CPUFAMILY}" = "arm64" ]; then
      CPUFAMILY="arm"
   fi
   
   ```
   
   2. I’m a Java developer and don’t usually compile C++ but going into the 
“_netbeans/ide/dlight.nativeexecution/tools_” directory and manually running 
the ‘_buildall.sh_” script compiles almost all the files needed.
   
   ➜  tools git:(master) ✗ chmod +x ./buildall.sh
   ➜  tools git:(master) ✗ . ./buildall.sh
   
   ```
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   rm -rf ../release/bin/nativeexecution/MacOSX-arm 
../release/bin/nativeexecution/MacOSX-arm
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   gcc  -s -O2  -o ../release/bin/nativeexecution/MacOSX-arm/privp privp.c
   ld: warning: option -s is obsolete and being ignored
   gcc  -s -O2  -o ../release/bin/nativeexecution/MacOSX-arm/process_start 
process_start.c
   ld: warning: option -s is obsolete and being ignored
   gcc  -s -O2  -o ../release/bin/nativeexecution/MacOSX-arm/pty_open pty_open.c
   ld: warning: option -s is obsolete and being ignored
   gcc  -s -O2   -s  -o ../release/bin/nativeexecution/MacOSX-arm/sigqueue 
sigqueue.c
   sigqueue.c:53:12: error: implicit declaration of function 'sigqueue' is 
invalid in C99 [-Werror,-Wimplicit-function-declaration]
       return sigqueue(pid, signo, value);
              ^
   1 error generated.
   make: *** [sigqueue] Error 1
   /Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   rm -f -r 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/dist/MacOSX-arm
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   rm -f -r 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build
   rm -f -r 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/dist
   rm -f .make.state*
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   mkdir -p 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/dist/MacOSX-arm
   mkdir -p 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/env.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/src/env.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/error.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/src/error.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/loop.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/src/loop.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/options.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/src/options.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/pty_fork.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/src/pty_fork.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/pty.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/src/pty.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/util.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/src/util.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   
--------------------------------------------------------------------------------
   gcc  -s -O2   -s  -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/dist/MacOSX-arm/pty
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/env.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/error.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/loop.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/options.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/pty_fork.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/pty.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/build/MacOSX-arm/src/util.o
   ld: warning: option -s is obsolete and being ignored
   ld: warning: option -s is obsolete and being ignored
   
================================================================================
   
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/pty/dist/MacOSX-arm/pty
   
   -rwxr-xr-x  1 tmulle  staff  53520 Jan 14 13:25
   Mach-O 64-bit executable arm64
   
================================================================================
   /Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   expr: syntax error
   rm -f -r 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/build/MacOSX-arm
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/dist/MacOSX-arm
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   rm -f -r 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/build
   rm -f -r 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/dist
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   expr: syntax error
   mkdir -p 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/dist/MacOSX-arm
   mkdir -p 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/build/MacOSX-arm/src
   mkdir -p 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/build/MacOSX-arm/src/linux
   mkdir -p 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/build/MacOSX-arm/src/solaris
   mkdir -p 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/build/MacOSX-arm/src/macosx
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/build/MacOSX-arm/src/error.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/src/error.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/build/MacOSX-arm/src/killall.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/src/killall.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/src/killall.c:187:13:
 warning: enumeration value 'S_SID' not handled in switch [-Wswitch]
       switch (scope) {
               ^
   
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/src/killall.c:187:13:
 note: add missing switch cases
       switch (scope) {
               ^
   
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/src/killall.c:199:1:
 warning: non-void function does not return a value in all control paths 
[-Wreturn-type]
   }
   ^
   
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/src/killall.c:260:16:
 error: implicit declaration of function 'sigqueue' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
           return sigqueue(params.id, params.sig, value);
                  ^
   2 warnings and 1 error generated.
   make: *** 
[/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/killall/build/MacOSX-arm/src/killall.o]
 Error 1
   /Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   rm -f -r 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/build/MacOSX-arm
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/dist/MacOSX-arm
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   rm -f -r 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/build
   rm -f -r 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/dist
   rm -f .make.state*
   Platform: MacOSX-arm
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   Makefile:85: warning: overriding commands for target 
`/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/dist/MacOSX-arm'
   Makefile:81: warning: ignoring old commands for target 
`/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/dist/MacOSX-arm'
   make: Circular 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/dist/MacOSX-arm
 <- 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/dist/MacOSX-arm
 dependency dropped.
   mkdir -p 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/build/MacOSX-arm/src
   gcc  -s -O2   -c -o 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/build/MacOSX-arm/src/unbuffer.o
 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/src/unbuffer.c
   clang: warning: argument unused during compilation: '-s' 
[-Wunused-command-line-argument]
   mkdir -p 
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/dist/MacOSX-arm
   
================================================================================
   
/Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools/unbuffer/dist/MacOSX-arm/
   
   total 0
   drwxr-xr-x  2 tmulle  staff  64 Jan 14 13:25 .
   drwxr-xr-x  3 tmulle  staff  96 Jan 14 13:25 ..
   directory
   
================================================================================
   /Users/tmulle/Development/Projects/netbeans/ide/dlight.nativeexecution/tools
   ================================================
   buildall:               directory
   buildall/pty:           Mach-O 64-bit executable arm64
   buildall/pty_open:      Mach-O 64-bit executable arm64
   buildall/process_start: Mach-O 64-bit executable arm64
   buildall/privp:         Mach-O 64-bit executable arm64
   
   ```
   
   
   If I then make a directory called 
“_netbeans/ide/bin/nativeexecution/MacOSX-arm_64_” and copy the “_buildall/_“ 
output into that directory the terminal works and I they are running *natively* 
(Not Rosetta).
   
   Again, this worked for me but obviously someone with more knowledge will 
know how to fix this.
   
   And yes, I know that you need a M1 Silicon Mac to build the binaries :-(
   
   ### Quick Fix
   
   I was able to fix it temporarily with these steps but they are not ideal:
   
   1. Step (1) from above is required
   
   2. Copying the contents of 
“_netbeans/ide/bin/nativeexecution/MacOSX-x86_64_” to 
“_netbeans/ide/bin/nativeexecution/MacOSX-arm_64_”
   
   
   This works, however, any terminal window is now using *Rosetta* and _NOT 
native ARM_ code
   
    
   
   ### How to reproduce
   
   Try to open a Terminal window in either NetBeans 12.5 or 12.6 running on a 
native ARM JDK and you'll get a blank terminal window.
   
   ### Did this work correctly in an earlier version?
   
   - [X] This used to work!
   
   ### Operating System
   
   MacOS M1 Max Pro Monterey
   
   ### JDK
   
   openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment 
Temurin-17.0.1+12 (build 17.0.1+12) OpenJDK 64-Bit Server VM Temurin-17.0.1+12 
(build 17.0.1+12, mixed mode) also happens with JDK11
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### Anything else
   
   As requested from the email, here is the output:
   
   ```
   ➜  ~ uname -p
   arm
   ➜  ~ uname -n
   mars.fios-router.home
   ➜  ~ uname -s
   Darwin
   ➜  ~ uname -a
   Darwin mars.fios-router.home 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 
20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
   ➜  ~ sysctl hw.cpu64bit_capable
   hw.cpu64bit_capable: 1
   ➜  ~ hostinfo
   Mach kernel version:
         Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; 
root:xnu-8019.61.5~1/RELEASE_ARM64_T6000
   Kernel configured for up to 10 processors.
   10 processors are physically available.
   10 processors are logically available.
   Processor type: arm64e (ARM64E)
   Processors active: 0 1 2 3 4 5 6 7 8 9
   Primary memory available: 32.00 gigabytes
   Default processor set: 628 tasks, 2916 threads, 10 processors
   Load average: 1.34, Mach factor: 8.64
   ```
   
   Here is also "uname -m" on both my M1 Mac and Intel:
   
   "uname -m" = arm64
   "uname -m" = x86_64
   
   Original Request Email:
   
   Hi Tim,
   
   Thanks for your report!
   
   It seems we're not contemplating the new M1 Apple computers. Since not all 
of us have access to one of these, would you please add the following to this 
ticket?
   
   a) The result of "uname -p" (this is what we call CPUTYPE in [1])
   b) The result of "uname -n" (this is what we call HOSTNAME in [1])
   c) The result of "uname -s" (this is what we call OS in [1]).
   d) The result of "uname -a" (we use it elsewhere in [1]).
   e) The result of "sysctl hw.cpu64bit_capable" (may require 'sudo', this is 
what we call BITNESS, I assume this is 64 bit).
   f) The result of "hostinfo"
   
   It would be great if we could compile "dlight.nativeexecution/tools" for the 
new M1 processors by running "build.sh" in [2] on one of these computers (I 
don't own one, though). This will probably require adding new #include's in 
different parts of the code. We'll talk to ASF Infra to see if we can have one 
of these to compile.
   
   Thanks again,
   Antonio
   
   [1]
   
[https://github.com/apache/netbeans/blob/master/ide/dlight.nativeexecution/release/bin/nativeexecution/hostinfo.sh]
   
   [2]
   
[https://github.com/apache/netbeans/tree/master/ide/dlight.nativeexecution/tools]
   
   ### Are you willing to submit a pull request?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow the Apache Software Foundation's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct.html)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to