Bug 246591 - Freshly compiled java program crashes with "Incorrect library ABI version detected."
Summary: Freshly compiled java program crashes with "Incorrect library ABI version det...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 7
Hardware: x86_64
OS: Linux
low
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 230282
TreeView+ depends on / blocked
 
Reported: 2007-07-03 09:43 UTC by Matěj Cepl
Modified: 2018-04-11 14:36 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-07-03 13:02:16 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
testing src.rpm (430.46 KB, application/x-rpm)
2007-07-03 09:43 UTC, Matěj Cepl
no flags Details
stdout/stderr of the rpmbuild process (113.14 KB, text/plain)
2007-07-03 11:02 UTC, Matěj Cepl
no flags Details

Description Matěj Cepl 2007-07-03 09:43:26 UTC
Description of problem:
Trying to compile trang (http://www.thaiopensource.com/relaxng/trang.html;
src.rpm attached) and although rpmbuild runs successfully (with myriad warnings
about deprecated methods, but no error) resulting binary doesn't work:

[matej@hubmaier rpm]$ sudo rpm -Uvh RPMS/x86_64/trang-*Password:
Preparing...                ########################################### [100%]
   1:trang                  ########################################### [ 50%]
   2:trang-debuginfo        ########################################### [100%]
[matej@hubmaier rpm]$ trang
libgcj failure: gcj linkage error.
Incorrect library ABI version detected.  Aborting.

Neúspěšně ukončen (SIGABRT)
[matej@hubmaier rpm]$ ldd /usr/bin/trang 
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000033d9e00000)
        libgcj.so.8rh => /usr/lib64/libgcj.so.8rh (0x00000036f6200000)
        libm.so.6 => /lib64/libm.so.6 (0x00000033cc800000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00000033cd400000)
        librt.so.1 => /lib64/librt.so.1 (0x0000003334e00000)
        libz.so.1 => /lib64/libz.so.1 (0x00000033cd000000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00000033ccc00000)
        libc.so.6 => /lib64/libc.so.6 (0x00000033cc400000)
        /lib64/ld-linux-x86-64.so.2 (0x00000033cb400000)
[matej@hubmaier rpm]$

When running .jar file from the upstream site with both IcedTea and gij
everything works fine:

[matej@hubmaier rpm]$ java -version
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-matej_18_jun_2007_12_11-b00)
OpenJDK 64-Bit Server VM (build 1.7.0-internal-matej_18_jun_2007_12_11-b00,
mixed mode)
[matej@hubmaier rpm]$ java -jar ~/.java/classes/trang.jar 
fatal: at least two arguments are required
Trang version 20030619
usage: java com.thaiopensource.relaxng.translate.Driver [-I rng|rnc|dtd|xml] [-O
rng|rnc|dtd|xsd] [-i input-param] [-o output-param] inputFileOrUri ... outputFile
[matej@hubmaier rpm]$ gij -jar ~/.java/classes/trang.jar 
fatal: at least two arguments are required
Trang version 20030619
usage: java com.thaiopensource.relaxng.translate.Driver [-I rng|rnc|dtd|xml] [-O
rng|rnc|dtd|xsd] [-i input-param] [-o output-param] inputFileOrUri ... outputFile
[matej@hubmaier rpm]$ gij -version
java version "1.5.0"
gij (GNU libgcj) version 4.1.2 20070502 (Red Hat 4.1.2-12)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[matej@hubmaier rpm]$ 

Version-Release number of selected component (if applicable):
libgcj-4.1.2-12
gcc-java-4.1.2-12

How reproducible:
100%

Steps to Reproduce:
1. run rpmbuild -ba over the attached src.rpm and install it
2. run trang
3.
  
Actual results:
error as shown ebove

Expected results:
help because arguments are missing (as with results from running .jar file)

Comment 1 Matěj Cepl 2007-07-03 09:43:27 UTC
Created attachment 158415 [details]
testing src.rpm

Comment 2 Matěj Cepl 2007-07-03 11:02:57 UTC
Created attachment 158422 [details]
stdout/stderr of the rpmbuild process

Comment 3 Jakub Jelinek 2007-07-03 12:48:25 UTC
First of all, this is built without -findirect-dispatch, plus it redefines
some classes defined libgcj.so.8rh (e.g. org.relaxng.datatype.*).  I believe
redefinition of system classes is only possible with BC-ABI.
The above error is because next_or_version field is shared for version
value (before the class is registered) and for a chain pointer after it is
registered.  But as the binary redefines say
_ZN3org7relaxng8datatype7helpers21DatatypeLibraryLoader6class$E
the same class is referenced in .jcr section of libgcj.so.8rh and in .jcr section
of the binary (why aren't .jcr relocations always to hidden aliases and therefore
always bind to the same shared library?).  That means the same class is
initialized twice.

Comment 4 Andrew Haley 2007-07-03 13:00:01 UTC
The "old" ABI (i.e. compiling without -findirect-dispatch) requires symbols to
be unique in the context of an executable.  Redefining classes in an application
is a bug in the application.  This is not a crash: libgcj detected a problem
with the application and shut down.

Comment 5 Jakub Jelinek 2007-07-03 13:02:16 UTC
Thanks.
I'd suggest then to build this with -findirect-dispatch and additionally
nuke classes that are already in libgcj, unless the overriding is intentional
(I guess it is just because the codebase is extremely old).


Note You need to log in before you can comment on or make changes to this bug.