Opened 8 months ago

Closed 4 months ago

#68278 closed defect (fixed)

openjdk17: missed dependency to libiconv

Reported by: catap (Kirill A. Korinsky) Owned by: breun (Nils Breunese)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: usersxx, breun (Nils Breunese), cooljeanius (Eric Gallager)
Port: openjdk17

Description

--->  Scanning binaries for linking errors
Could not open /opt/local/lib/libiconv.2.dylib: Error opening or reading file (referenced from /opt/local/Library/Java/JavaVirtualMachines/openjdk17/Contents/Home/lib/libinstrument.dylib)
--->  Found 3 broken files, matching files to ports
--->  Found 1 broken port, determining rebuild order
You can always run 'port rev-upgrade' again to fix errors.
The following ports will be rebuilt: openjdk17 @17.0.8.1+release+server

Probably another JVMs have the same issue.

Change History (13)

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

I haven't see this issue, but I have the libiconv port installed, which is a dependency of many other ports. Can you confirm that you don't have libiconv installed when you encounter this issue? It could be that it needs to be added as a dependency.

comment:2 Changed 8 months ago by catap (Kirill A. Korinsky)

Yes, I do confirm that. And when I install it the issue had dissapear.

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

For the openjdk17 port lib instrument.dylib indeed has /opt/local/lib/libiconv.2.dylib in its list of used shared libraries:

❯ otool -L /opt/local/Library/Java/JavaVirtualMachines/openjdk17/Contents/Home/lib/libinstrument.dylib     
/opt/local/Library/Java/JavaVirtualMachines/openjdk17/Contents/Home/lib/libinstrument.dylib:
	@rpath/libinstrument.dylib (compatibility version 1.0.0, current version 1.0.0)
	@rpath/libjava.dylib (compatibility version 1.0.0, current version 1.0.0)
	@rpath/libjvm.dylib (compatibility version 1.0.0, current version 1.0.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.3.0)
	@rpath/libjli.dylib (compatibility version 1.0.0, current version 1.0.0)
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 24.0.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 61040.1.3)
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 64.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)

The pre-built JVM ports I maintain reference /usr/lib/libiconv.2.dylib instead of /opt/local/lib/libiconv.2.dylib, and no linking errors are reported when installing them on a system without the libiconv port installed, even though there is no /usr/lib/libiconv.2.dylib file on my system.

But I also see /usr/lib/libSystem.B.dylib in the list of used shared libraries for both openjdk17 and openjdk17-zulu, and I don't have that file on my system, but there are no link errors reported for that. I am not very familiar with how shared dylib files work though.

comment:4 in reply to:  3 Changed 8 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to breun:

The pre-built JVM ports I maintain reference /usr/lib/libiconv.2.dylib instead of /opt/local/lib/libiconv.2.dylib, and no linking errors are reported when installing them on a system without the libiconv port installed,

Naturally.

even though there is no /usr/lib/libiconv.2.dylib file on my system.

But I also see /usr/lib/libSystem.B.dylib in the list of used shared libraries for both openjdk17 and openjdk17-zulu, and I don't have that file on my system, but there are no link errors reported for that. I am not very familiar with how shared dylib files work though.

Apple, in their wisdom, have decided to remove libraries and the library parts of frameworks from the filesystem as of macOS 11. They are now only in the dyld cache. So you cannot tell whether a library exists by checking if a file is there. The only way to know is to try to dlopen it.

comment:5 Changed 4 months ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:6 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

This is still a problem.

https://build.macports.org/builders/ports-14_arm64-builder/builds/1088/steps/install-port/logs/stdio

Error occurred during initialization of VM
Could not find agent library instrument on the library path, with error: dlopen(libinstrument.dylib, 0x0001): Library not loaded: /opt/local/lib/libiconv.2.dylib
  Referenced from: <7ADB6182-82E1-3D50-9C7B-32D9CDBAFBBE> /opt/local/Library/Java/JavaVirtualMachines/openjdk17/Contents/Home/lib/libinstrument.dylib
  Reason: tried: '/opt/local/lib/libiconv.2.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/libiconv.2.dylib' (no such file), '/opt/local/lib/libiconv.2.dylib' (no such file)
Module java.instrument may be missing from runtime image.
Command failed:  cd "/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_ghidra/ghidra/work/ghidra-11.0" && gradle -I gradle/support/fetchDependencies.gradle init  
Exit code: 1

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

I don't maintain openjdk17, but maintainer usersxx doesn't seem to be very active anymore. Do I understand correctly that the fix would be adding depends_run port:libiconv? If that's all, I can create a merge request for that.

I guess this also applies to openjdk21 (which I do maintain) and older OpenJDK ports that are built from source?

comment:8 in reply to:  7 ; Changed 4 months ago by catap (Kirill A. Korinsky)

Replying to breun:

I don't maintain openjdk17, but maintainer usersxx doesn't seem to be very active anymore.

Maybe you may take care of old JVM as well? ;)

Do I understand correctly that the fix would be adding depends_run port:libiconv? If that's all, I can create a merge request for that.

I guess this also applies to openjdk21 (which I do maintain) and older OpenJDK ports that are built from source?

Yes, I think that adding that dependency to all OpenJDK ports which is build from sources should be enough.

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

I've created a pull request for openjdk17 here: https://github.com/macports/macports-ports/pull/22227

I'll also create them for other builds from source.

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

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

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

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

Owner: set to breun
Resolution: fixed
Status: newclosed

In 40c6b8cdd1ce1883e8658b456e5fcb0e6218c943/macports-ports (master):

openjdk17: update to 17.0.10, add libiconv as run dependency

Closes: #68278

Note: See TracTickets for help on using tickets.