[FIXED] Does lwjgl require 10.6 for OSX?

Started by scidomino, December 30, 2011, 19:52:49

Previous topic - Next topic

scidomino

I'm running osx 10.5.8 and lwjgl 2.8.2. When I try to run a simple example it gives me the following error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
/Users/tommaso/Documents/workspace/PipPop/target/PipPop-1.0/natives/liblwjgl.jnilib:  
Symbol not found: _OBJC_CLASS_$_NSOpenGLLayer   
Referenced from: /Users/tommaso/Documents/workspace/PipPop/target/PipPop-1.0/natives/liblwjgl.jnilib   
Expected in: /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 
   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
   at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1742)
   at java.lang.Runtime.loadLibrary0(Runtime.java:823)
   at java.lang.System.loadLibrary(System.java:1045)
   at org.lwjgl.Sys$1.run(Sys.java:73)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
   at org.lwjgl.Sys.loadLibrary(Sys.java:95)
   at org.lwjgl.Sys.<clinit>(Sys.java:112)
   at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
   at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)



I researched this and it looks like the issue is that NSOpenGLLayer was only introduced in 10.6 (Snow Leopard) so I don't have it.
Is this a bug or is it just that this library doesn't support any OSX before 10.6?

Akhilla

I too am having the same problem. I've contacted kappaOne on irc and we might be able to work out a fix.

scidomino

Awesome. Any help you can provide would be greatly appreciated.

Feel free to post the solution here or email it to me so I can do it. Also, if there's anything I can do to help diagnose the issue, please let me know.

kappa

The above error seems to be causing a failure on OS X 10.5 and older as there seems to be a hard link to NSOpenGLLayer (which is not available on those older platforms). It should have been weak referenced however as its part of the AppKit.framework it can't be as that framework is very important and weak referencing the whole thing can lead to other problems.

The solution seems to be to use a runtime check for NSOpenGLLayer, something like the following:

Class cls = NSClassFromString(@"NSOpenGLLayer");

if (cls != nil) {
        // then create a new instance of it
}


I'll have a go at implementing the above, hopefully NSOpenGLLayer is the only hard link. In the meantime LWJGL 2.7.1 can be used to run on OS X 10.5 or older.

princec

Er, yoinks! I wonder if this issue has anything to do with the 150 support emails burning a hole in my inbox.
Any chance of a quickie patch?

Cas :)

kappa

I've had a go at trying to fix the above problem (committed to svn), however not got access to OS X 10.5 so haven't been able to test it, if someone on OS X 10.5 could please test the latest nightly build of LWJGL and confirm whether the issue is now fixed? thanks.

Akhilla

I've tested with the nightly build and can confirm the fix worked.

Faust

Hi the Bug is not solved for me yet. I tried the nightly build of lwjgl-2.8.3 since the updated osx files should be in there too and i found out that the libs depend on some changes of the main lwjgl.jar.
So i used build #1515 from 16.01.12:
http://www.newdawnsoftware.com/jenkins/view/LWJGL/job/LWJGL/

I verfied the bug using lwjgl 2.7.1 stable build-> working
2.8.2 stable build -> UnsatisfiedLinkError
2.8.3 #1515 nightly build -> JVM crash

On the eclipse console the following is printed before the crash happens:
2012-01-16 12:18:30.361 java[216:11603] Make pbuffer: 974 x 554
2012-01-16 12:18:30.368 java[216:10b] *** NSInvocation: warning: object 0x115c0ea78 of class 'PBufferGLLayer' does not implement methodSignatureForSelector: -- trouble ahead
2012-01-16 12:18:30.368 java[216:10b] *** NSInvocation: warning: object 0x115c0ea78 of class 'PBufferGLLayer' does not implement doesNotRecognizeSelector: -- abort


System information:
Model: MacBookPro3,1, BootROM MBP31.0070.B07, 2 processors, Intel Core 2 Duo, 2.2 GHz, 2 GB
Graphics: GeForce 8600M GT, GeForce 8600M GT, spdisplays_pcie_device, 128 MB
Memory Module: global_name
AirPort: spairport_wireless_card_type_airport_extreme (0x168C, 0x87), 1.4.16.2
Bluetooth: Version 2.1.9f10, 2 service, 1 devices, 1 incoming serial ports
Network Service: Ethernet (integriert), Ethernet, en0
PCI Card: pci168c,24, sppci_othernetwork, PCI Slot 5
Serial ATA Device: FUJITSU MHY2120BH, 111,79 GB
Parallel ATA Device: HL-DT-ST DVDRW  GSA-S10N
USB Device: Built-in iSight, (null) mA
USB Device: Apple Internal Keyboard / Trackpad, (null) mA
USB Device: IR Receiver, (null) mA
USB Device: Bluetooth USB Host Controller, (null) mA


Apple error report (its 25 pages long and exceeds the maximum post length, therefore i cut it down to the stack trace of the first thread, if requested i can provide the full error report):
Process:         java [251]
Path:            /usr/bin/java
Identifier:      com.apple.javajdk16.cmd
Version:         1.0 (1.0)
Code Type:       X86-64 (Native)
Parent Process:  eclipse [115]

Interval Since Last Report:          396 sec
Crashes Since Last Report:           1
Per-App Interval Since Last Report:  4 sec
Per-App Crashes Since Last Report:   1

Date/Time:       2012-01-16 12:25:07.059 +0100
OS Version:      Mac OS X 10.5.8 (9L31a)
Report Version:  6
Anonymous UUID:  2EAEEF4E-486A-4BDE-8A18-359D3F198B3D

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread:  0

Thread 0 Crashed:
0   com.apple.CoreFoundation      	0x00007fff801aca75 ___forwarding___ + 645
1   com.apple.CoreFoundation      	0x00007fff801acc38 _CF_forwarding_prep_0 + 232
2   libobjc.A.dylib               	0x00007fff8026ea74 _class_initialize + 348
3   libobjc.A.dylib               	0x00007fff8026d4a0 _class_lookupMethodAndLoadCache + 89
4   libobjc.A.dylib               	0x00007fff8027bb77 objc_msgSend + 199
5   com.apple.Foundation          	0x00007fff8405d6d4 __NSThreadPerformPerform + 148
6   com.apple.CoreFoundation      	0x00007fff80132e68 CFRunLoopRunSpecific + 2808
7   com.apple.HIToolbox           	0x00007fff81898d0e RunCurrentEventLoopInMode + 278
8   com.apple.HIToolbox           	0x00007fff81898b44 ReceiveNextEventCommon + 322
9   com.apple.HIToolbox           	0x00007fff818989ef BlockUntilNextEventMatchingListInMode + 79
10  com.apple.AppKit              	0x00007fff8046ae70 _DPSNextEvent + 603
11  com.apple.AppKit              	0x00007fff8046a7b1 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 136
12  libawt.jnilib                 	0x00000001091e9309 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 146
13  com.apple.AppKit              	0x00007fff80464523 -[NSApplication run] + 434
14  libawt.jnilib                 	0x00000001091903a6 +[AWTStarter startAWT:] + 1522
15  libawt.jnilib                 	0x000000010918fce2 -[CPerformer perform] + 112
16  com.apple.Foundation          	0x00007fff8405d6d4 __NSThreadPerformPerform + 148
17  com.apple.CoreFoundation      	0x00007fff80132e68 CFRunLoopRunSpecific + 2808
18  java                          	0x0000000100003cc4 0x100000000 + 15556
19  java                          	0x00000001000036e4 0x100000000 + 14052
20  java                          	0x00000001000010e4 0x100000000 + 4324

Thread 1:
0   libSystem.B.dylib             	0x00007fff811bec56 mach_msg_trap + 10
1   libSystem.B.dylib             	0x00007fff811c6293 mach_msg + 59
2   libclient64.dylib             	0x000000010100ce1c jio_snprintf + 34336
3   libclient64.dylib             	0x000000010100cce1 jio_snprintf + 34021
4   libclient64.dylib             	0x00000001013c8bc0 JVM_RaiseSignal + 515022
5   libclient64.dylib             	0x000000010100c89d jio_snprintf + 32929
6   libclient64.dylib             	0x000000010100c6da jio_snprintf + 32478
7   libclient64.dylib             	0x00000001010b0002 JVM_Write + 1420
8   libclient64.dylib             	0x00000001010afce2 JVM_Write + 620
9   java                          	0x0000000100001cb5 0x100000000 + 7349
10  libSystem.B.dylib             	0x00007fff811ecd0f _pthread_start + 316
11  libSystem.B.dylib             	0x00007fff811ecbd1 thread_start + 13


Regards.

kappa

Quote from: Faust on January 16, 2012, 12:08:37
Hi the Bug is not solved for me yet. I tried the nightly build of lwjgl-2.8.3 since the updated osx files should be in there too and i found out that the libs depend on some changes of the main lwjgl.jar.
So i used build #1515 from 16.01.12:
Odd error, are you using Display.setParent() or AWTGLCanvas? or does it just happen on a normal LWJGL application?

Faust

I started it as an applet and you are right, commenting the Display.setParent(myCanvas) fixes the error but creates a separate frame.
Since when is using Display.setParent() a problem and how should the correct code look like? The basic applet example uses the function Display.setParent() too...
http://www.lwjgl.org/wiki/index.php?title=Basic_LWJGL_Applet

kappa

hmm, it seems that LWJGL is trying to use the plugin2 stuff on OS X 10.5 when its not available there. Odd since there are suppose to be checks inside LWJGL to prevent this, will have a look to see why its doing that, should be relatively simple to fix now that the binary compatibility issue is fixed.

kappa

@Faust do try the next latest nightly build to check whether the above issue is now fixed for you.

Thanks

Faust

Hi,

currently there is no new lwjgl build, therefore i just replaced the macosx native file with build #1612.
First i was a little bit confused and re-builded some intermediate jars of our project, but now i am pretty sure, that unfortunately the wrong version number made it into the files.

I get an LingkageError: Version mismatch: jar version is '22', native library version is '23'

Regards.

princec

You have to use the same version jar as natives, so replace the lwjgl.jar as well.

Cas :)