is it possible to call 32 bit shared libraries on 64bit os platforms?

Discussion in 'Java' started by junyoung, Apr 22, 2010.

  1. junyoung

    junyoung Guest

    I have a 64bit jvm now,

    $> file /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
    /usr/lib/jvm/java-1.5.0-sun/jre/bin/java: ELF 64-bit LSB executable,
    x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked
    (uses shared libs), stripped

    and, my java applications are using 32bit shared libraries to be run
    normally.

    $ file libadscli.so
    libadscli.so: ELF 32-bit LSB shared object, Intel 80386, version 1
    (SYSV), not stripped

    but, whenever my applications are failed because of the following
    errors.

    java.lang.UnsatisfiedLinkError: /home/jykim/work/trunk/ads/ads_home/
    lib/libadscli.so: /home/jykim/work/trunk/ads/ads_home/lib/
    libadscli.so: wrong ELF class: ELFCLASS32 (Possible cause:
    architecture word width mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1753)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1678)
    at java.lang.Runtime.loadLibrary0(Runtime.java:822)
    at java.lang.System.loadLibrary(System.java:993)
    at com.altibase.ads.jdbc.ADSCLI.<init>(ADSCLI.java:33)
    at com.altibase.ads.jdbc.ADSDriver.initialize(ADSDriver.java:117)
    at com.altibase.ads.jdbc.ADSDriver.connect(ADSDriver.java:217)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at ads.jdbc.test.common.TestUtil.openConnect(TestUtil.java:99)
    at ads.jdbc.test.common.TestUtil.openConnect(TestUtil.java:88)
    at ads.jdbc.test.ConnectionTest.setUp(ConnectionTest.java:25)

    Is there any way to use 32bit shared libraries on 64 bit platforms
    without installing proper jvm version ( in case of, 32bit jvm ).

    any helps would be much appreciated. thanks.
     
    junyoung, Apr 22, 2010
    #1
    1. Advertising

  2. junyoung

    Nigel Wade Guest

    Re: is it possible to call 32 bit shared libraries on 64bit osplatforms?

    On Thu, 22 Apr 2010 01:10:39 -0700, junyoung wrote:

    > I have a 64bit jvm now,
    >
    > $> file /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
    > /usr/lib/jvm/java-1.5.0-sun/jre/bin/java: ELF 64-bit LSB executable,
    > x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses
    > shared libs), stripped
    >
    > and, my java applications are using 32bit shared libraries to be run
    > normally.
    >
    > $ file libadscli.so
    > libadscli.so: ELF 32-bit LSB shared object, Intel 80386, version 1
    > (SYSV), not stripped
    >
    > but, whenever my applications are failed because of the following
    > errors.
    >
    > java.lang.UnsatisfiedLinkError: /home/jykim/work/trunk/ads/ads_home/
    > lib/libadscli.so: /home/jykim/work/trunk/ads/ads_home/lib/ libadscli.so:
    > wrong ELF class: ELFCLASS32 (Possible cause: architecture word width
    > mismatch)
    > at java.lang.ClassLoader$NativeLibrary.load(Native Method) at
    > java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1753) at
    > java.lang.ClassLoader.loadLibrary(ClassLoader.java:1678) at
    > java.lang.Runtime.loadLibrary0(Runtime.java:822) at
    > java.lang.System.loadLibrary(System.java:993) at
    > com.altibase.ads.jdbc.ADSCLI.<init>(ADSCLI.java:33) at
    > com.altibase.ads.jdbc.ADSDriver.initialize(ADSDriver.java:117) at
    > com.altibase.ads.jdbc.ADSDriver.connect(ADSDriver.java:217) at
    > java.sql.DriverManager.getConnection(DriverManager.java:525) at
    > java.sql.DriverManager.getConnection(DriverManager.java:193) at
    > ads.jdbc.test.common.TestUtil.openConnect(TestUtil.java:99) at
    > ads.jdbc.test.common.TestUtil.openConnect(TestUtil.java:88) at
    > ads.jdbc.test.ConnectionTest.setUp(ConnectionTest.java:25)
    >
    > Is there any way to use 32bit shared libraries on 64 bit platforms
    > without installing proper jvm version ( in case of, 32bit jvm ).


    Not that I am aware of.

    You will need to install a 32bit JVM and ensure that you run the correct
    one (it's perfectly possible to have multiple versions, and
    architectures, of the JVM co-exist quite happily on Linux). Normally all
    you need to do is run the correct java executable. Download the latest
    JRE from Sun/Oracle. Get the non-RPM version which allows you to extract
    it anywhere you like. The RPM version will use the package manager to
    install it, and will probably replace your existing version.

    --
    Nigel Wade
     
    Nigel Wade, Apr 22, 2010
    #2
    1. Advertising

  3. junyoung

    EJP Guest

    On 22/04/2010 6:10 PM, junyoung wrote:
    > libadscli.so: wrong ELF class: ELFCLASS32 (Possible cause:
    > architecture word width mismatch)


    Bit of a giveaway, don't you think?
     
    EJP, Apr 22, 2010
    #3
  4. junyoung

    cr88192 Guest

    "EJP" <> wrote in message
    news:bLVzn.20720$...
    > On 22/04/2010 6:10 PM, junyoung wrote:
    >> libadscli.so: wrong ELF class: ELFCLASS32 (Possible cause:
    >> architecture word width mismatch)

    >
    > Bit of a giveaway, don't you think?


    yeah, it is not likely possible apart from using some kind of emulator (say,
    an x86 emulator with JNI support).

    easier would be, if possible, to compile/request/... 64-bit libraries (as
    well as libs for whatever other arch it may need to run on), and use these
    in addition to the 32-bit libs.

    for example:
    libfoo.i386.so
    libfoo.x86-64.so
    libfoo.ppc64.so
    ....

    and then load the version appropriate for the correct arch.


    sadly, with Java, one is almost better off just rewriting whatever library
    functionality in Java, and then possibly sidestepping the issue.

    or such...
     
    cr88192, Apr 22, 2010
    #4
  5. On 22/04/2010 09:10, junyoung wrote:
    > I have a 64bit jvm now, [... for GNU/Linux 2.4.0]

    ....
    > and, my java applications are using 32bit shared libraries to be run
    > normally.

    ....
    > Is there any way to use 32bit shared libraries on 64 bit platforms
    > without installing proper jvm version ( in case of, 32bit jvm ).


    "It is not currently possible in Linux for a 64-bit program to
    dynamically load a 32-bit library."
    - http://www.redhat.com/magazine/009jul05/features/multilib/

    --
    RGB
     
    RedGrittyBrick, Apr 22, 2010
    #5
  6. On 04/22/2010 11:01 AM, cr88192 wrote:
    > "EJP"<> wrote in message
    > news:bLVzn.20720$...
    >> On 22/04/2010 6:10 PM, junyoung wrote:
    >>> libadscli.so: wrong ELF class: ELFCLASS32 (Possible cause:
    >>> architecture word width mismatch)

    >>
    >> Bit of a giveaway, don't you think?

    >
    > yeah, it is not likely possible apart from using some kind of emulator (say,
    > an x86 emulator with JNI support).


    It could be possible, I think, if you really specialized the library
    loading feature to do stub libraries and a lot of appropriate trampolining.

    Far easier would be spawning a 32-bit process that can load the library
    and then RPC'ing stuff between the two. Still not fun, though.

    > easier would be, if possible, to compile/request/... 64-bit libraries (as
    > well as libs for whatever other arch it may need to run on), and use these
    > in addition to the 32-bit libs.


    Or use multilib stuff (ugh)!

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
     
    Joshua Cranmer, Apr 22, 2010
    #6
  7. junyoung

    junyoung Guest

    Re: is it possible to call 32 bit shared libraries on 64bit osplatforms?

    On 4¿ù23ÀÏ, ¿ÀÀü2½Ã52ºÐ, Joshua Cranmer <> wrote:
    > On 04/22/2010 11:01 AM, cr88192 wrote:
    >
    > > "EJP"<> wrote in message
    > >news:bLVzn.20720$...
    > >> On 22/04/2010 6:10 PM, junyoung wrote:
    > >>> libadscli.so: wrong ELF class: ELFCLASS32 (Possible cause:
    > >>> architecture word width mismatch)

    >
    > >> Bit of a giveaway, don't you think?

    >
    > > yeah, it is not likely possible apart from using some kind of emulator (say,
    > > an x86 emulator with JNI support).

    >
    > It could be possible, I think, if you really specialized the library
    > loading feature to do stub libraries and a lot of appropriate trampolining.
    >
    > Far easier would be spawning a 32-bit process that can load the library
    > and then RPC'ing stuff between the two. Still not fun, though.
    >
    > > easier would be, if possible, to compile/request/... 64-bit libraries (as
    > > well as libs for whatever other arch it may need to run on), and use these
    > > in addition to the 32-bit libs.

    >
    > Or use multilib stuff (ugh)!
    >
    > --
    > Beware of bugs in the above code; I have only proved it correct, not
    > tried it. -- Donald E. Knuth


    how do you think do use the option -D ( about data.model )

    there are two options I can use the first one is -D32 for 32bit data
    model. the other one is -D64 for 64bit data model.

    I guess this way has to solve this problems.

    how do u think?

    thanks u always.
     
    junyoung, Apr 23, 2010
    #7
  8. junyoung

    junyoung Guest

    Re: is it possible to call 32 bit shared libraries on 64bit osplatforms?

    On 4¿ù23ÀÏ, ¿ÀÈÄ2½Ã01ºÐ, junyoung <> wrote:
    > On 4¿ù23ÀÏ, ¿ÀÀü2½Ã52ºÐ, Joshua Cranmer <> wrote:
    >
    >
    >
    >
    >
    > > On 04/22/2010 11:01 AM, cr88192 wrote:

    >
    > > > "EJP"<> wrote in message
    > > >news:bLVzn.20720$...
    > > >> On 22/04/2010 6:10 PM, junyoung wrote:
    > > >>> libadscli.so: wrong ELF class: ELFCLASS32 (Possible cause:
    > > >>> architecture word width mismatch)

    >
    > > >> Bit of a giveaway, don't you think?

    >
    > > > yeah, it is not likely possible apart from using some kind of emulator (say,
    > > > an x86 emulator with JNI support).

    >
    > > It could be possible, I think, if you really specialized the library
    > > loading feature to do stub libraries and a lot of appropriate trampolining.

    >
    > > Far easier would be spawning a 32-bit process that can load the library
    > > and then RPC'ing stuff between the two. Still not fun, though.

    >
    > > > easier would be, if possible, to compile/request/... 64-bit libraries (as
    > > > well as libs for whatever other arch it may need to run on), and use these
    > > > in addition to the 32-bit libs.

    >
    > > Or use multilib stuff (ugh)!

    >
    > > --
    > > Beware of bugs in the above code; I have only proved it correct, not
    > > tried it. -- Donald E. Knuth

    >
    > how do you think do use the option -D ( about data.model )
    >
    > there are two options I can use the first one is -D32 for 32bit data
    > model. the other one is -D64 for 64bit data model.
    >
    > I guess this way has to solve this problems.
    >
    > how do u think?
    >
    > thanks u always.


    oh, god ;(

    $ java -d32
    Running a 32-bit JVM is not supported on this platform.
     
    junyoung, Apr 23, 2010
    #8
  9. junyoung

    Roedy Green Guest

    On Thu, 22 Apr 2010 01:10:39 -0700 (PDT), junyoung
    <> wrote, quoted or indirectly quoted someone who
    said :

    >I have a 64bit jvm now,


    It is possible for a C/C++ 64 bit program to call into a 32 bit DLL?

    If so, you could write some JNI glue to do the transition.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    It’s amazing how much structure natural languages have when you consider who speaks them and how they evolved.
     
    Roedy Green, Apr 27, 2010
    #9
  10. junyoung

    Arne Vajhøj Guest

    On 27-04-2010 10:59, Roedy Green wrote:
    > On Thu, 22 Apr 2010 01:10:39 -0700 (PDT), junyoung
    > <> wrote, quoted or indirectly quoted someone who
    > said :
    >> I have a 64bit jvm now,

    >
    > It is possible for a C/C++ 64 bit program to call into a 32 bit DLL?
    >
    > If so, you could write some JNI glue to do the transition.


    Why should his own DLL be better than the DLL's of the JVM?

    Arne
     
    Arne Vajhøj, Apr 28, 2010
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    385
    Bob Hairgrove
    Aug 10, 2005
  2. Replies:
    5
    Views:
    350
  3. Alan
    Replies:
    0
    Views:
    84
  4. Iros
    Replies:
    1
    Views:
    126
    -Lost
    Jun 7, 2007
  5. Iros
    Replies:
    1
    Views:
    124
    -Lost
    Jun 7, 2007
Loading...

Share This Page