Opened 9 months ago

Last modified 7 days ago

#69440 new defect

openjdk21 @21.0.2_1: build fails with missing symbols

Reported by: cooljeanius (Eric Gallager) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.9.1
Keywords: Cc: breun (Nils Breunese)
Port: openjdk21

Description

Split off from #69213, similar to the failure in #66325:

Creating support/modules_libs/java.base/libsyslookup.dylib from 1 file(s)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libz.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libz.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libnet.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
Undefined symbols for architecture x86_64:
  "_NET_Bind", referenced from:
      _Java_sun_nio_ch_Net_bind0 in Net.o
  "_NET_GetPortFromSockaddr", referenced from:
      _Java_sun_nio_ch_Net_localPort in Net.o
      _Java_sun_nio_ch_Net_remotePort in Net.o
  "_NET_GetSockOpt", referenced from:
      _Java_sun_nio_ch_Net_getIntOption0 in Net.o
  "_NET_InetAddressToSockaddr", referenced from:
      _Java_sun_nio_ch_Net_bind0 in Net.o
      _Java_sun_nio_ch_Net_connect0 in Net.o
  "_NET_SetSockOpt", referenced from:
      _Java_sun_nio_ch_Net_setIntOption0 in Net.o
  "_NET_SockaddrToInetAddress", referenced from:
      _Java_sun_nio_ch_InheritedChannel_inetPeerAddress0 in InheritedChannel.o
      _Java_sun_nio_ch_InheritedChannel_peerPort0 in InheritedChannel.o
      _Java_sun_nio_ch_Net_accept in Net.o
      _Java_sun_nio_ch_Net_localInetAddress in Net.o
      _Java_sun_nio_ch_Net_remoteInetAddress in Net.o
  "_NET_SocketAvailable", referenced from:
      _Java_sun_nio_ch_Net_available in Net.o
  "_initInetAddressIDs", referenced from:
      _Java_sun_nio_ch_InheritedChannel_initIDs in InheritedChannel.o
      _Java_sun_nio_ch_Net_initIDs in Net.o
  "_ipv4_available", referenced from:
      _Java_sun_nio_ch_Net_socket0 in Net.o
  "_ipv6_available", referenced from:
      _Java_sun_nio_ch_Net_isIPv6Available0 in Net.o
      _Java_sun_nio_ch_Net_socket0 in Net.o
  "_reuseport_available", referenced from:
      _Java_sun_nio_ch_Net_isReusePortAvailable0 in Net.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [Lib.gmk:74: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga/build/release/support/modules_libs/java.base/libnio.dylib] Error 1
gmake[3]: *** Waiting for unfinished jobs....
gmake[3]: Leaving directory '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga/make'
gmake[2]: *** [make/Main.gmk:199: java.base-libs] Error 2
gmake[2]: Leaving directory '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga'

ERROR: Build failed for target 'images' in configuration 'release' (exit code 2) 
gmake[2]: Entering directory '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga'
Stopping javac server

=== Output from failing command(s) repeated here ===
* For target support_native_java.base_libnio_BUILD_LIBNIO_link:
ld: warning: dylib (/opt/local/lib/libnet.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
ld: warning: dylib (/opt/local/lib/libunwind.dylib) was built for newer macOS version (11.0) than being linked (10.12)
Undefined symbols for architecture x86_64:
  "_NET_Bind", referenced from:
      _Java_sun_nio_ch_Net_bind0 in Net.o
  "_NET_GetPortFromSockaddr", referenced from:
      _Java_sun_nio_ch_Net_localPort in Net.o
      _Java_sun_nio_ch_Net_remotePort in Net.o
  "_NET_GetSockOpt", referenced from:
      _Java_sun_nio_ch_Net_getIntOption0 in Net.o
  "_NET_InetAddressToSockaddr", referenced from:
      _Java_sun_nio_ch_Net_bind0 in Net.o
      _Java_sun_nio_ch_Net_connect0 in Net.o
  "_NET_SetSockOpt", referenced from:
   ... (rest of output omitted)

* All command lines available in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga/build/release/make-support/failure-logs.
=== End of repeated output ===

No indication of failed target found.
HELP: Try searching the build log for '] Error'.
HELP: Run 'make doctor' to diagnose build problems.

gmake[2]: Leaving directory '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga'
gnumake[1]: *** [main] Error 2
gnumake[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga'
gnumake: *** [images] Error 2
gnumake: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga" && /usr/bin/gnumake -w images 
Exit code: 2
Error: Failed to build openjdk21: command execution failed
DEBUG: Error code: CHILDSTATUS 87085 2
DEBUG: Backtrace: command execution failed
    while executing
"system {*}$notty {*}$callback {*}$nice $fullcmdstring"
    invoked from within
"command_exec -callback portprogress::target_progress_callback build"
    (procedure "portbuild::build_main" line 10)
    invoked from within
"$procedure $targetname"
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/main.log for details.
Error: Problem while installing openjdk21

make doctor output:

$ sudo make doctor
Password:
Building target 'doctor' in configuration 'release'

"make doctor" will help you analyze your build environment. It can highlight
certain well-known problems, but it can never find all possible errors.

* Verifying that configure has picked up git...

* Checking for warnings from configure...
 ---
The following warnings were produced. Repeated here for convenience:
WARNING: pandoc is version 3.1.12, not the recommended version 2.19.2
WARNING: Ignoring CFLAGS(-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch x86_64) found in environment. Use --with-extra-cflags
WARNING: Ignoring CXXFLAGS(-pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch x86_64) found in environment. Use --with-extra-cxxflags
WARNING: Ignoring LDFLAGS(-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch x86_64) found in environment. Use --with-extra-ldflags
 ---
! Inspect the warnings, fix any problems, and re-run configure
fatal: not a git repository (or any of the parent directories): .git

* Checking for left-over core files...
fatal: not a git repository (or any of the parent directories): .git

* Checking for untracked files with illegal names...

* If all else fails, try removing the entire build directory and re-creating
the same configuration using:
 ---
configure_command_line=$(make print-configuration)
make dist-clean
bash configure $configure_command_line
 ---

* The build README (doc/building.md) is a great source of information,
especially the chapter "Fixing Unexpected Build Failures". Check it out!

* If you still need assistance please contact build-dev@openjdk.org.

Finished building target 'doctor' in configuration 'release'

Attachments (5)

openjdk21_main.log (107.6 KB) - added by cooljeanius (Eric Gallager) 9 months ago.
main.log for openjdk21
failure-summary.log (1.3 KB) - added by cooljeanius (Eric Gallager) 9 months ago.
failure-summary.log from openjdk21's /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga/build/release/make-support directory
successful_openjdk21_build_on_macos_14_main.log.gz (30.4 KB) - added by breun (Nils Breunese) 9 months ago.
openjdk21_main.log.diff (680.8 KB) - added by cooljeanius (Eric Gallager) 9 months ago.
diff between successful and failing openjdk21 build logs
openjdk21_main1.log.diff (618.0 KB) - added by cooljeanius (Eric Gallager) 9 months ago.
diff between successful and failing openjdk21 build logs, this time with the BigSur one from the buildbot

Download all attachments as: .zip

Change History (25)

Changed 9 months ago by cooljeanius (Eric Gallager)

Attachment: openjdk21_main.log added

main.log for openjdk21

Changed 9 months ago by cooljeanius (Eric Gallager)

Attachment: failure-summary.log added

failure-summary.log from openjdk21's /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk21/openjdk21/work/jdk21u-jdk-21.0.2-ga/build/release/make-support directory

comment:1 Changed 9 months ago by ryandesign (Ryan Carsten Schmidt)

The log doesn't tell us much because the build uses silent rules. If it can be figured out how to disable silent rules, then the build would show the actual commands being used to compile, link, etc., which would be more helpful.

comment:2 Changed 9 months ago by breun (Nils Breunese)

https://ports.macports.org/port/openjdk21/details/ shows that openjdk21 builds are successful on macOS 10.14 and later, and fail on 10.13 and older.

It seems that openjdk17 (https://ports.macports.org/port/openjdk17/details/) and openjdk11 (https://ports.macports.org/port/openjdk11/details/) also fail to build on 10.13 and older.

comment:3 in reply to:  2 Changed 9 months ago by cooljeanius (Eric Gallager)

Replying to breun:

https://ports.macports.org/port/openjdk21/details/ shows that openjdk21 builds are successful on macOS 10.14 and later, and fail on 10.13 and older.

...so why isn't MacPorts giving me a binary from the buildbot then?

comment:4 Changed 9 months ago by breun (Nils Breunese)

I'm not 100% sure, but I think that may be because the license is set to GPL-2+, and that is not considered redistributable by MacPorts. OpenJDK is licensed under GPL 2 with classpath exception (see https://github.com/openjdk/jdk21u/blob/master/LICENSE and https://github.com/openjdk/jdk21u/blob/master/ADDITIONAL_LICENSE_INFO).

On what version of macOS do you get this build error?

comment:5 Changed 9 months ago by breun (Nils Breunese)

By the way, I also maintain portfiles for various binary distributions of OpenJDK. Here are the ones based on JDK 21: https://ports.macports.org/search/?q=openjdk21-&name=on

comment:6 Changed 9 months ago by jmroot (Joshua Root)

% ./port_binary_distributable.tcl -v openjdk21
"openjdk21" is not distributable because its dependency "openjdk21-zulu" has license "nomirror" which is not known to be distributable

comment:7 in reply to:  4 ; Changed 9 months ago by cooljeanius (Eric Gallager)

Replying to breun:

On what version of macOS do you get this build error?

I'm on Big Sur.

Replying to breun:

By the way, I also maintain portfiles for various binary distributions of OpenJDK. Here are the ones based on JDK 21: https://ports.macports.org/search/?q=openjdk21-&name=on

I just need openjdk21 as a dependency for abcl, which hardcodes the dependency on openjdk21, so I don't think any of those others would work...

comment:8 Changed 9 months ago by breun (Nils Breunese)

openjdk21-zulu is only a build dependency, should its redistributability impact redistributability of the openjdk21 build?

Another question is of course why the build succeeds on Big Sur according to https://ports.macports.org/port/openjdk21/details/ but fails on Big Sur for cooljeanius.

Last edited 9 months ago by breun (Nils Breunese) (previous) (diff)

comment:9 in reply to:  8 ; Changed 9 months ago by cooljeanius (Eric Gallager)

Replying to breun:

Another question is of course why the build succeeds on Big Sur according to https://ports.macports.org/port/openjdk21/details/ but fails on Big Sur for cooljeanius.

It's probably something messed up about my local environment, which I'd normally use trace mode to work around, but that just brings us back to #69213 again. Do we have a log from a successful build to compare my log against?

comment:10 in reply to:  8 ; Changed 9 months ago by jmroot (Joshua Root)

Replying to breun:

openjdk21-zulu is only a build dependency, should its redistributability impact redistributability of the openjdk21 build?

In the general case, build dependencies can include things like headers and static libraries that are incorporated into the dependent and so do create a derivative work, which means license compatibility is relevant and distributability is potentially affected. If that's not the case here, it can be indicated with license_noconflict openjdk21-zulu.

Changed 9 months ago by breun (Nils Breunese)

comment:11 in reply to:  9 Changed 9 months ago by breun (Nils Breunese)

Replying to cooljeanius:

Do we have a log from a successful build to compare my log against?

I've attached the log from a successful build on my local machine (macOS 14.3.1 arm64).

comment:12 in reply to:  10 Changed 9 months ago by breun (Nils Breunese)

Replying to jmroot:

If that's not the case here, it can be indicated with license_noconflict openjdk21-zulu.

I believe so, so I've created https://github.com/macports/macports-ports/pull/22916 for this.

Last edited 9 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:13 Changed 9 months ago by breun (Nils Breunese)

That PR has been merged and I now see:

❯ ./port_binary_distributable.tcl -v openjdk21
"openjdk21" is distributable

comment:14 in reply to:  9 ; Changed 9 months ago by breun (Nils Breunese)

Replying to cooljeanius:

Do we have a log from a successful build to compare my log against?

You can also find build logs via https://ports.macports.org/port/openjdk21/builds/

Changed 9 months ago by cooljeanius (Eric Gallager)

Attachment: openjdk21_main.log.diff added

diff between successful and failing openjdk21 build logs

Changed 9 months ago by cooljeanius (Eric Gallager)

Attachment: openjdk21_main1.log.diff added

diff between successful and failing openjdk21 build logs, this time with the BigSur one from the buildbot

comment:15 in reply to:  14 Changed 9 months ago by cooljeanius (Eric Gallager)

Replying to breun:

Replying to cooljeanius:

Do we have a log from a successful build to compare my log against?

I've attached the log from a successful build on my local machine (macOS 14.3.1 arm64).

OK, I uploaded a diff against it.

Replying to breun:

Replying to cooljeanius:

Do we have a log from a successful build to compare my log against?

You can also find build logs via https://ports.macports.org/port/openjdk21/builds/

...and against one from here, too.

comment:16 Changed 8 days ago by jmpalacios (Juan Manuel Palacios)

Hi everyone!

Has there been any progress made on this issue? I'm encountering the exact same build failure for both openjdk21 & openjdk23 when attempting to install on macos 15.1 Sequoia, M1 Pro chip (arm64), and though I understand what the missing symbols build error means, I know very little about the Java build machinery to fix it.

Further, forcing MacPorts to install from a binary package fails with 404 for all available mirrors, for both openjdk releases, probably meaning that at least for the time being I'm stuck with having to build locally (understanding that these two ports had been made distributable).

Thanks for any help, and please let me know if I can provide any info to help in solving this issue!

comment:17 in reply to:  7 Changed 8 days ago by breun (Nils Breunese)

Replying to cooljeanius:

I just need openjdk21 as a dependency for abcl, which hardcodes the dependency on openjdk21, so I don't think any of those others would work...

I don't know why abcl hardcodes this dependency, but maybe the port can be modified to be more flexible by using java.version / java.fallback from the Java PortGroup to also accept other Java installations that satisfy the version requirement.

comment:18 in reply to:  16 ; Changed 8 days ago by breun (Nils Breunese)

Replying to jmpalacios:

I'm encountering the exact same build failure for both openjdk21 & openjdk23 when attempting to install on macos 15.1 Sequoia, M1 Pro chip (arm64) (...)

For compilation issues on macOS 15, have you tried this fix for the Command Line Tools?

Further, forcing MacPorts to install from a binary package fails with 404 for all available mirrors, for both openjdk releases (...)

MacPorts does not provide any binary packages for macOS 15 yet at this time, so that is currently expected.

Last edited 8 days ago by breun (Nils Breunese) (previous) (diff)

comment:19 in reply to:  18 Changed 7 days ago by jmpalacios (Juan Manuel Palacios)

Replying to breun:

For compilation issues on macOS 15, have you tried this fix for the Command Line Tools?

Yes, I did perform that fix. I had some port failing to build, IIRC it was PHP, and that manual fix got it to work.

Still, a couple of weeks and a few ports installed after doing that, both openjdk21 & openjdk23 are failing with this new error.

MacPorts does not provide any binary packages for macOS 15 yet at this time, so that is currently expected.

Ah, I did not know that, so the 404 is indeed expected, then.

Please let me know if you'd like me to supply any info to aid in debugging this openjdk build failure, thank you.

comment:20 Changed 7 days ago by jmpalacios (Juan Manuel Palacios)

I just attempted to build openjdk20, openjdk19, and openjdk18, within the same context (macOS 15.1 & arm64), and they all failed with the exact same linker error, in case it's of interest to anyone who might be more familiar with the OpenJDK build system than I am.

Note: See TracTickets for help on using tickets.