question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NetBeans 12.5/12.6 missing ARM based binaries for MacOSX terminal support in NetBeans

See original GitHub issue

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

  1. 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?

  • 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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
oyarzuncommented, Jan 18, 2022

Remove needs:triage - think we’re sure this is a bug - @vieiro @oyarzun please remove that label on responding to an issue.

I would say this is a feature rather than a bug as it is a new unsupported architecture. While we are adding this, we probably should add Linux arm as there are no binaries either.

For NB13 I wonder whether we should make the quick fix change at least, if we can’t get this in?

IMHO, these changes can wait until after NB13.

Swift launcher also going to be related to this?

I looked at this as well, for the launcher we can create a universal binary that contains both the x86-64 and arm-64. Currently the NetBeans launcher is built when the macOS installer is created. @mcdonnell-john has been building these on his Mac. It can be created with the following command with the latest Swift 5.4 tools, and maybe 5.3.

swift build --configuration release --arch arm64 --arch x86_64

Did you see the issue about possible resource leak above comment? in #3467 (comment)

@tmulle I just pushed a commit which should fix building the killall macOS arm binary.

Also added needs:discussion as something to follow up on dev@ here - we should move the location of the binaries to Maven if possible, similar to the Windows launcher, and wind down usage of OSUOSL https://lists.apache.org/thread/9tf28w5r3wxx9fwbl12m6x36sb3pfdry

There are a few platform specific binaries that would benefit from moving the compilation and packaging to a better process. I will start a discussion thread on the dev mailing list.

0reactions
tmullecommented, Dec 8, 2022

I just installed NetBeans 16 and looks like the changes still aren’t in for the terminal. I have to copy my modified hostinfo.sh and ARM folder I locally built.

Will this be in a future release? I know not everyone has M1 Macs…

I think there are companies you can rent M1 Macs in the cloud for build processes for those that don’t or can’t have the proper machines.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use Apache Netbeans 10 binaries on macos high sierra?
But when I try to run /Application/netbeans/bin/netbeans I get the an error in the terminal: Unknown option: n follow by the help message....
Read more >
Welcome to Apache NetBeans
Apache NetBeans provides editors, wizards, and templates to help you create applications in Java, PHP and many other languages. Apache NetBeans can be ......
Read more >
How to Install NetBeans IDE on macOS - YouTube
In this video I am going to show How to install the Netbeans IDE on Mac.We are going to install Apache NetBeans 12...
Read more >
NetBeans - JDK is missing error on Mac - Resolved - YouTube
Hello Friends,In this video tutorials session, we will see how to fix JDK missing errors on mac for NetBeans. I have explained the...
Read more >
Big Sur + Netbeans : cannot open/c… | Apple Developer Forums
After MacOS upgrade to Big Sur and having made changes to ... So I suppose Netbeans is not allowed to access files on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found