United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7150516 [macosx] appletviewer shouldn't link against libX11 on the Mac
JDK-7150516 : [macosx] appletviewer shouldn't link against libX11 on the Mac

Details
Type:
Bug
Submit Date:
2012-03-02
Status:
Closed
Updated Date:
2012-03-21
Project Name:
JDK
Resolved Date:
2012-03-19
Component:
client-libs
OS:
os_x
Sub-Component:
java.awt
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7u4
Fixed Versions:
7u4 (b16)

Related Reports
Backport:

Sub Tasks

Description
I noticed a problem with the jdk 7u4 build for OS X - bin/appletviewer
doesn't run. When I try to launch it, I get:

dyld: Library not loaded: /usr/X11/lib/libX11.6.dylib
Referenced from:
/Library/Java/JavaVirtualMachines/jdk1.7.0_04/demo/jfx/Java2D/../../../bin/appletviewer

Reason: Incompatible library version: appletviewer requires version
10.0.0 or later, but libX11.6.dylib provides version 9.0.0
Trace/BPT trap

bin/appletviewer worked fine in 7u4b228.

Running the appletviewer class directly ('java sun.applet.appletviewer')
does seem to work.

I saw it mentioned in MACOSX_PORT-524 that the X11 toolkit is not the
default in JDK7 on Mac. Perhaps the appletviewer executable is
requesting the X11 toolkit?

                                    

Comments
EVALUATION

The makefile that's doing it is

jdk/make/launchers/Makefile.launcher

# GUI tools
ifeq ($(GUI_TOOL),true)
  ifneq ($(PLATFORM), windows)
    # Anything with a GUI needs X11 to be linked in.
    OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11
  endif
endif

appletviewer is considered a 'GUI tool', so it is built linked against X11. policytool is also affected by this.

This is wrong -- just because we aren't building windows doesn't mean we need X11.
                                     
2012-03-02
SUGGESTED FIX

--- old/make/launchers/Makefile.launcher	2012-03-02 18:07:27.000000000 +0400
+++ new/make/launchers/Makefile.launcher	2012-03-02 18:07:26.000000000 +0400
@@ -159,8 +159,10 @@
 # GUI tools
 ifeq ($(GUI_TOOL),true)
   ifneq ($(PLATFORM), windows)
-    # Anything with a GUI needs X11 to be linked in.
-    OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11
+    ifneq ($(PLATFORM), macosx)
+      # Anything with a GUI needs X11 to be linked in.
+      OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11
+    endif
   endif
 endif
                                     
2012-03-02



Hardware and Software, Engineered to Work Together