Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIX builds have a dependency on libgcc_s.a for GUI apps #207

Open
sxa opened this issue Jan 18, 2018 · 9 comments
Open

AIX builds have a dependency on libgcc_s.a for GUI apps #207

sxa opened this issue Jan 18, 2018 · 9 comments
Labels
aix Issues that affect or relate to the AIX OS bug Issues that are problems in the code as reported by the community help wanted Issues that need an extra hand helping out with them

Comments

@sxa
Copy link
Member

sxa commented Jan 18, 2018

Although most operations work ok without the GNU runtime library, it would appear that libfontmanager.so is built with a dependency on libgcc_s.a. The result of this is that any GUI application will fail unless the libgcc package is installed on the box and added to the LIBPATH. This appears to affect all versions of the AdoptOpenJDK builds. IBM's AIX java does not have this dependency. I believe it's due to the libfreetype dependency. When the freetype2 package is installed through IBM's version of yum for AIX, a symlink /usr/lib/libfreetype.a is created to /opt/freeware/lib, so that is found correctly, however for the libgcc package, there is no such symlink so it is not in the default search PATH and LIBPATH has to be set to include /opt/freeware/lib64 for GUI apps to work. I'm not sure if there's any obvious way around this, but I'm opening this issue to at least have it documented for now.

AdoptOpenJDK8 (HotSpot)

$ jdk8u144-b01/bin/java -jar myguiapp.jar                            ar
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/jck/jdk8u144-b01/jre/lib/ppc64/libfontmanager.so: /home/jck/jdk8u144-b01/jre/lib/ppc64/libfontmanager.so, LIBPATH=/home/jck/jdk8u144-b01/jre/lib/ppc64/server:/home/jck/jdk8u144-b01/jre/lib/ppc64:/home/jck/jdk8u144-b01/jre/lib/ppc64/jli:/home/jck/jdk8u144-b01/jre/../lib/ppc64, LD_LIBRARY_PATH= :        0509-022 Cannot load module /usr/lib/libpng16.a(libpng16.so.16).
        0509-150   Dependent module libgcc_s.a(shr.o) could not be loaded.
        0509-022 Cannot load module libgcc_s.a(shr.o).
        0509-026 System error: A file or directory in the path name does not exist.
        0509-022 Cannot load module /home/jck/jdk8u144-b01/jre/lib/ppc64/libfontmanager.so.
        0509-150   Dependent module /usr/lib/libpng16.a(libpng16.so.16) could not be loaded.
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)

AdoptOpenJDK8 with OpenJ9

$ jdk8u152-b16/bin/java -jar myguiapp.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: fontmanager (Not found in com.ibm.oti.vm.bootstrap.library.path)
        at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1435)
        at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1400)
        at java.lang.System.loadLibrary(System.java:567)
        at sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:61)

AdoptOpenJDK9

$ jdk-9+181/bin/java -jar myguiapp.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/jck/jdk-9+181/lib/libfontmanager.so: /home/jck/jdk-9+181/lib/libfontmanager.so, LIBPATH=/home/jck/jdk-9+181/lib/server:/home/jck/jdk-9+181/lib:/home/jck/jdk-9+181/lib/jli:/home/jck/jdk-9+181/../lib, LD_LIBRARY_PATH= :      0509-022 Cannot load module /usr/lib/libpng16.a(libpng16.so.16).
        0509-150   Dependent module libgcc_s.a(shr.o) could not be loaded.
        0509-022 Cannot load module libgcc_s.a(shr.o).
        0509-026 System error: A file or directory in the path name does not exist.
        0509-022 Cannot load module /home/jck/jdk-9+181/lib/libfontmanager.so.
        0509-150   Dependent module /usr/lib/libpng16.a(libpng16.so.16) could not be loaded.
        at java.base/java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2614)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2520)
@sxa sxa added bug Issues that are problems in the code as reported by the community aix Issues that affect or relate to the AIX OS labels Jan 18, 2018
@karianna karianna added this to the 1.x.x milestone May 14, 2018
@karianna karianna modified the milestones: 2.x.x, January 2019 Jan 10, 2019
@karianna karianna modified the milestones: January 2019, February 2019 Feb 3, 2019
@karianna karianna modified the milestones: February 2019, March 2019 Mar 2, 2019
@karianna
Copy link
Contributor

karianna commented Mar 7, 2019

@sxa555 Is this still an issue?

@sxa
Copy link
Member Author

sxa commented Mar 28, 2019

I believe @groeges has still been seeing issues with this.

@groeges
Copy link
Contributor

groeges commented Mar 29, 2019

@sxa555 Is this still an issue?

Not sure whether this is still a problem on the Adopt machines but I have been seeing issues on my local machine with running some of the JTReg tests. Setting LIBPATH and/or LD_LIBRARY_PATH didn't seem to resolve the issue, as the JTReg tests didn't see to pickup these environment variables. I had to either add -e:LIBPATH=/opt/freeware/lib64 to the JTReg command or add a symbolic link to the library ln -s /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/6.3.0/libgcc_s.a /usr/lib/libgcc_s.a in order to get the tests to work.

@groeges
Copy link
Contributor

groeges commented Mar 29, 2019

Having checked with the AIX guys in SAP, it seems that on the systems I was using we've installed the wrong libraries. We shouldn't use dependencies which are compiled with GCC and therefore rely on libgcc. Mixing xlc-compiled libraries with gcc-compiled ones is usually not a good idea.

A change, for the special "libfontmanager" case, we could simply build with "--with-freetype=bundled" which will use a freetype version which is bundled with OpenJDK. "--with-freetype=bundled" was introduced in OpenJDK 11.

Having changed to use this option the tests that were failing are now working correctly, without the need to update JTreg command or to add a symbolic link.

@karianna
Copy link
Contributor

@sxa555 Are you happy to close this in that case?

@sxa
Copy link
Member Author

sxa commented Mar 29, 2019

I'll need to do further verification, plus what @groeges is saying above seems to be a JDK11+ specific solution

@karianna karianna modified the milestones: March 2019, April 2019 Apr 1, 2019
@incyg
Copy link

incyg commented Apr 16, 2019

At @sxa555: Thank you for documenting this error 😄👍

I'd like to ask whether this problem is or will be fixed in an upcoming AdoptOpenJDK Java 11 LTS AIX release? Or maybe is it already fixed in a nightly build?

My motivation for asking is the unfortunate fact that two of my company's customers running a web application on their AIX system reported that one of its features stopped working using

openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.2+9)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.12.1, JRE 11 AIX ppc64-64-Bit Compressed References 20190204_121 (JIT enabled, AOT enabled)
OpenJ9   - 90dd8cb
OMR      - d2f4534
JCL      - 289c70b based on jdk-11.0.2+9)

reporting this error

java.lang.UnsatisfiedLinkError: fontmanager (Not found in com.ibm.oti.vm.bootstrap.library.path)
        at java.base/java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1678)
        at java.base/java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1643)
        at java.base/java.lang.System.loadLibrary(System.java:559)
        at java.desktop/sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:57)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:647)
        at java.desktop/sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:32)
        at java.desktop/sun.font.SunFontManager$1.run(SunFontManager.java:270)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:647)
        at java.desktop/sun.font.SunFontManager.<clinit>(SunFontManager.java:266)
        at java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:265)
        at java.desktop/sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:864)

Although I pointed them to this issue and asked them to setup the mentioned dependencies and environment variables this seems cumbersome (and may also prove "too difficult" for them to do 😑).

So having an AdoptOpenJDK build which works "out-of-the-box" on an AIX system would definitely be desirable.

@karianna karianna modified the milestones: April 2019, May 2019 May 1, 2019
@karianna karianna modified the milestones: May 2019, June 2019 Jun 3, 2019
@karianna karianna modified the milestones: June 2019, July 2019 Jul 5, 2019
@M-Davies
Copy link
Contributor

@sxa Just to follow up on this, I see that we are setting the LIBPATH here and we also set FREETYPE to bundled here. Is there anything else that needs to be done for this issue?

@sxa
Copy link
Member Author

sxa commented May 18, 2020

It would need to be tested first to ensure the problem no longer occurs.

@karianna karianna added the help wanted Issues that need an extra hand helping out with them label May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aix Issues that affect or relate to the AIX OS bug Issues that are problems in the code as reported by the community help wanted Issues that need an extra hand helping out with them
Projects
Status: Todo
Development

No branches or pull requests

5 participants