#4 64 bit architecture support

closed
nobody
None
5
2009-09-14
2008-11-25
No

Trying to run JPen on a 64 bit architecture doesn't work, as the binaries are compiled against 32 bit.

Causes for example an error like this:
Caused by: java.lang.UnsatisfiedLinkError: /home/test/jpen-2-081117/libjpen-2.so: /home/test/jpen-2-081117/libjpen-2.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)

Maybe a solution would be to compile separate 32 and 64 bit binaries for each platform. How to get java to load the right one might be more tricky, but if nothing else, the end application developers could just create two distributions, one ofr 32 bit and one for 64 bit, and package one set of JPen binaries with one, and the other set with the other.

Discussion

  • Nicolas Carranza

    Hi zzorn!

    I attached jpen-2-081125-lib.zip, which includes the following changes:
    * New untested lib for amd64. It was built cross compiling in my x86-32... : S
    * The linux provider looks for the "sun.arch.data.model" system propery and loads the library according to its value. The code is already in svn.

    If you have an amd64 linux system around, please help me testing: run the Demo ( http://jpen.wiki.sourceforge.net/demo ) and copy/paste the result here. It would be interesting to make two tests: one using the java switch -d32 and the other using -d64.

    Cheers!
    Nicolas

     
  • Nicolas Carranza

    ups... By "results" I meant the "Status Report" results. thank you Hans.

     
  • Nobody/Anonymous

    note 1: what about ia64?? looking only the "sun.arch.data.model" value is a naive attempt.

     
  • Hans Häggström

    Thanks for the quick response!

    The issue was encountered by a person that has a 64 bit environment, so I don't have a system to test on myself.

     
  • Nobody/Anonymous

    That was me. I just tried this (debian, AMD64) and pressure works now nicely in the demo.

    ===== JPen - Status Report =====
    JPen Version: 081125
    Date: Thu Nov 27 09:47:29 GMT 2008
    Providers:
    Constructor: XInput
    Construction Exception: none
    Device: pad
    Is Digitizer: true
    Enabled: true
    Kind: null
    Device: wacom-mouse
    Is Digitizer: true
    Enabled: true
    Kind: null
    Device: eraser
    Is Digitizer: true
    Enabled: true
    Kind: (type=ERASER)
    Device: stylus
    Is Digitizer: true
    Enabled: true
    Kind: (type=STYLUS)
    Device: Generic Keyboard
    Is Digitizer: true
    Enabled: true
    Kind: null
    Constructor: System
    Construction Exception: none
    Device: mouse
    Is Digitizer: false
    Enabled: true
    Kind: (type=CURSOR)
    System Properties:
    file.encoding: UTF-8
    file.encoding.pkg: sun.io
    file.separator: /
    java.awt.graphicsenv: sun.awt.X11GraphicsEnvironment
    java.awt.printerjob: sun.print.PSPrinterJob
    java.class.path: jpen-2.jar
    java.class.version: 50.0
    java.endorsed.dirs: /home/gamer/jre1.6.0_10/lib/endorsed
    java.ext.dirs: /home/gamer/jre1.6.0_10/lib/ext:/usr/java/packages/lib/ext
    java.home: /home/gamer/jre1.6.0_10
    java.library.path: /home/gamer/jre1.6.0_10/lib/amd64/server:/home/gamer/jre1.6.0_10/lib/amd64:/home/gamer/jre1.6.0_10/../lib/amd64:.:/usr/java/packages/lib/amd64:/lib:/usr/lib
    java.runtime.name: Java(TM) SE Runtime Environment
    java.runtime.version: 1.6.0_10-b33
    java.specification.name: Java Platform API Specification
    java.specification.vendor: Sun Microsystems Inc.
    java.specification.version: 1.6
    java.vendor: Sun Microsystems Inc.
    java.vendor.url: http://java.sun.com/
    java.vendor.url.bug: http://java.sun.com/cgi-bin/bugreport.cgi
    java.version: 1.6.0_10
    java.vm.info: mixed mode
    java.vm.name: Java HotSpot(TM) 64-Bit Server VM
    java.vm.specification.name: Java Virtual Machine Specification
    java.vm.specification.vendor: Sun Microsystems Inc.
    java.vm.specification.version: 1.0
    java.vm.vendor: Sun Microsystems Inc.
    java.vm.version: 11.0-b15
    os.arch: amd64
    os.name: Linux
    os.version: 2.6.25.4
    path.separator: :
    sun.arch.data.model: 64
    sun.boot.class.path: /home/gamer/jre1.6.0_10/lib/resources.jar:/home/gamer/jre1.6.0_10/lib/rt.jar:/home/gamer/jre1.6.0_10/lib/sunrsasign.jar:/home/gamer/jre1.6.0_10/lib/jsse.jar:/home/gamer/jre1.6.0_10/lib/jce.jar:/home/gamer/jre1.6.0_10/lib/charsets.jar:/home/gamer/jre1.6.0_10/classes
    sun.boot.library.path: /home/gamer/jre1.6.0_10/lib/amd64
    sun.cpu.endian: little
    sun.cpu.isalist:
    sun.io.unicode.encoding: UnicodeLittle
    sun.java.launcher: SUN_STANDARD
    sun.jnu.encoding: UTF-8
    sun.management.compiler: HotSpot 64-Bit Server Compiler
    sun.os.patch.level: unknown
    user.country: CH
    user.language: de
    user.timezone: GMT
    ===== ===== =====

     
  • Nobody/Anonymous

    And that's what happends with -d32: (I don't need -d64 but it works if I give it)

    $ java -d32 -jar jpen-2.jar
    Running a 32-bit JVM is not supported on this platform.
    $

     
  • Nicolas Carranza

    Hi zzorn,

    A new public release is ready ( https://sourceforge.net/project/showfiles.php?group_id=209997&package_id=252096&release_id=644104 ). It supports the following Linux architectures: x86, x86_64, and ia64. The architecture is selected by looking at the sun.arch.data.model system property value and then trying the available libs until one is loaded successfully. It saves a Preferences value to speed things up the second time. There is also a System property "jpen.provider.architecture" to force a specific architecture to be loaded.

    ia64 was built crosscompiling in my x86 and is not tested, so it may be broken.

    I will close this feature request. Let me know if you find any problem. Thank you!

    Nicolas

     
  • Nicolas Carranza

    • status: open --> closed
     
  • Hans Häggström

    • status: closed --> open
     
  • Hans Häggström

    Cool, thanks!

    What about Windows (or OSX) though? Will the current native libraries work on 64 bit machines there too?

     
  • Nicolas Carranza

    Too soon to close the feature request ; )

    Mac OS X: I'm not sure if the current libjpen-2.jnilib is universal. See: https://sourceforge.net/tracker2/?func=detail&aid=2292207&group_id=209997&atid=1011964 . I think Karl (http://al.chemy.org/) will catch the problem and warn us.

    Windows 64: I can't build and test on this environment. I have to wait for somebody to do it, then I can implement a mechanism to load the 64 bit version like the Linux one.

    Cheers!

     
  • Karl DD

    Karl DD - 2008-12-04

    The Mac OSX is libjpen-2.jnilib but compiled for 32bit not 64.
    It seems to be the approach to have separate .jnilb binaries on OS X.
    For example Quaqua: http://www.randelshofer.ch/quaqua/ you might want to have a browse and see how they handle the loading issue.

    Java 1.6 only runs 64bit on mac, so I have tended to avoid it with Alchemy (as up until now other libraries have not had 64bit versions and all macs with Java 1.6 have 1.5 also installed).
    At some stage I can have a go at compiling a 64bit version and get back to you.

    Karl

     
  • Nobody/Anonymous

    Hi Karl,
    I just commited jpen.provider.NativeLibraryLoaded to svn. It takes care of loading the matching jni lib given two set of architectures (32 or 64). So now all we need is to compile libs for the supported architectures. Whenever you have a 64bit version ready, you can tell me and I will prepare a public release.
    Thank you.
    Nicolas

     
  • Karl DD

    Karl DD - 2008-12-05

    Hi Nicolas,

    I just now compiled a 64 bit version of the mac lib.
    While it compiles ok it seems that some of the code has been depreciated.
    It works on 32bit, but not on 64bit.

    This is it here 'poseAsClass', line 155 of the osx_push_provider:
    [CustomApplication poseAsClass: [NSApplication class]];

    So what this means is that JPen will not work with the 64bit Java 1.6 on Mac.
    The workaround for now is to specify JVMVersion 1.5* which everyone has anyway.

    Would love to help out more but am a bit out of my depth here...
    If anyone can figure out an alternative for 'poseAsClass' please step up!

    Karl

     
  • Nicolas Carranza

    JPen now includes bins for linux x86_64 and ia64. Closing this feature request.

     
  • Nicolas Carranza

    • status: open --> closed
     
  • Nicolas Carranza

    It includes also support for Max OSX 64 (jre6) thanks to marcello3d.

     

Log in to post a comment.