Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnsatisfiedLinkError occurs in libjaybird22_x64.so undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE [JDBC259] #306

Closed
firebird-automations opened this issue Jul 19, 2012 · 26 comments

Comments

@firebird-automations
Copy link

Submitted by: Martin Mayerhofer (mmayerhofer)

Attachments:
libjaybird22_x64.so
libjaybird22.so

Votes: 1

libjaybird22_x64.so (ver. 2.2.0-release) / http://libfbembed.so (ver. 2.5.1) is present in the java.library.path and an exception gets thrown when trying to create a database connection to an embedded database

Exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/rgba/IdeaProjects/TimeAttendant/libjaybird22_x64.so: /home/rgba/IdeaProjects/TimeAttendant/libjaybird22_x64.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at org.firebirdsql.gds.impl.jni.JniGDSImpl.initJNIBridge(JniGDSImpl.java:63)
at org.firebirdsql.gds.impl.jni.JniGDSImpl.<clinit>(JniGDSImpl.java:24)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin.getGDS(EmbeddedGDSFactoryPlugin.java:40)
at org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:220)
at org.firebirdsql.jca.FBManagedConnectionFactory.getGDS(FBManagedConnectionFactory.java:114)
at org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:124)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at FBConnect.main(FBConnect.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Java Code:

import org.firebirdsql.jdbc.FBResultSet;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class FBConnect {

public static void main(String[] args) {

try \{
  Class\.forName\("org\.firebirdsql\.jdbc\.FBDriver"\)\.newInstance\(\);
\} catch \(ClassNotFoundException ex\) \{
  ex\.printStackTrace\(\);
\} catch \(IllegalAccessException ex\) \{
  ex\.printStackTrace\(\);
\} catch \(InstantiationException ex\) \{
  ex\.printStackTrace\(\);
\}

try \{
  Connection bd = DriverManager
          \.getConnection\(
                  "jdbc:firebirdsql:embedded:/home/rgba/IdeaProjects/TimeAttendant/TADATA\.FDB",
                  "sysdba", "masterkey"\);
  Statement st = bd\.createStatement\(\);
  FBResultSet rs = \(FBResultSet\)st\.executeQuery\("select \* from TABLE1"\);
  while \(rs\.next\(\)\) \{
    System\.out\.print\(rs\.getString\(1\)\);
  \}
\} catch \(Exception e\) \{
  e\.printStackTrace\(\);
\}

}
}

Java VM Version:

java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)

OS:

Ubuntu 12.04

Commits: c6e191d 39f5dc0

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

The problem is most likely caused by a missing libstdc++.so.6 on your machine.
Check if you have libstdc++.so.6 on your machine using
find /usr/ -name libstdc++.so.6

If not, then you should be able to install it using:
apt-get install libstdc++6

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

BTW: As far as I can tell Jaybird itself does not depend on libstdc++6 (according to the ldd output), so it might be a dependency of Java.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

assignee: Roman Rokytskyy [ rrokytskyy ] => Mark Rotteveel [ avalanche1979 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

After some further investigating, it seems that the problem is with libjaybird. ldd -r shows that this symbol (and some others) are undefined:

mark@ubuntu-x64:~/development/jaybird/client-java/native$ ldd -r libjaybird22_x64.so
linux-vdso.so.1 => (0x00007fffa9a00000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb4f6548000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb4f6330000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb4f6b20000)
undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE (./libjaybird22_x64.so)
undefined symbol: __gxx_personality_v0 (./libjaybird22_x64.so)
undefined symbol: _ZTISt9bad_alloc (./libjaybird22_x64.so)
undefined symbol: dlopen (./libjaybird22_x64.so)
undefined symbol: _ZdlPv (./libjaybird22_x64.so)
undefined symbol: _Znam (./libjaybird22_x64.so)
undefined symbol: __cxa_end_catch (./libjaybird22_x64.so)
undefined symbol: __cxa_allocate_exception (./libjaybird22_x64.so)
undefined symbol: dlclose (./libjaybird22_x64.so)
undefined symbol: _ZdaPv (./libjaybird22_x64.so)
undefined symbol: __cxa_begin_catch (./libjaybird22_x64.so)
undefined symbol: __cxa_throw (./libjaybird22_x64.so)
undefined symbol: dlsym (./libjaybird22_x64.so)
undefined symbol: _Znwm (./libjaybird22_x64.so)
undefined symbol: __cxa_free_exception (./libjaybird22_x64.so)

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Could you check if the attached version of the library solves the problem for you?

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Attachment: libjaybird22_x64.so [ 12177 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Attached libjaybird22_x64.so was compiled by including <syslibset libs="stdc++,dl"/> into the gcc linker definition in build_native.xml (apparently the already included <linkerarg value="-ldl"/> and <linkerarg value="-lstdc++"/> are ignored).

The ldd output is now good:
mark@ubuntu-x64:~/development/jaybird/client-java$ ldd -r ./output/native/libjaybird22_x64.so
linux-vdso.so.1 => (0x00007fff92b90000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcba09e8000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fcba06e0000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fcba04d8000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fcba02c0000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcba0fc0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcba0038000)

@firebird-automations
Copy link
Author

Commented by: Martin Mayerhofer (mmayerhofer)

I tried the attached library and the UnsatisfiedLinkError is gone, nevertheless there is another error popping up which also ends in the native library, I have both http://libfbembed.so + http://libfbclient.so (both ver. 2.5.1) in my library path.

Exception:

org.firebirdsql.gds.impl.jni.InternalError: FirebirdApiBinding::Initialize - Could not find or load the firebird client library.
at org.firebirdsql.gds.impl.jni.JniGDSImpl.nativeInitilize(Native Method)
at org.firebirdsql.gds.impl.jni.JniGDSImpl.attemptToLoadAClientLibraryFromList(JniGDSImpl.java:92)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:31)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:21)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin.getGDS(EmbeddedGDSFactoryPlugin.java:40)
at org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:220)
at org.firebirdsql.jca.FBManagedConnectionFactory.getGDS(FBManagedConnectionFactory.java:114)
at org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:124)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at FBConnect.main(FBConnect.java:23)
org.firebirdsql.gds.impl.jni.InternalError: FirebirdApiBinding::Initialize - Could not find or load the firebird client library.
at org.firebirdsql.gds.impl.jni.JniGDSImpl.nativeInitilize(Native Method)
at org.firebirdsql.gds.impl.jni.JniGDSImpl.attemptToLoadAClientLibraryFromList(JniGDSImpl.java:92)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:31)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:21)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin.getGDS(EmbeddedGDSFactoryPlugin.java:40)
at org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:220)
at org.firebirdsql.jca.FBManagedConnectionFactory.getGDS(FBManagedConnectionFactory.java:114)
at org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:124)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at FBConnect.main(FBConnect.java:23)
java.lang.RuntimeException: Failed to initialize Jaybird native library. This is most likely due to a failure to load the firebird client library.
at org.firebirdsql.gds.impl.jni.JniGDSImpl.attemptToLoadAClientLibraryFromList(JniGDSImpl.java:105)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:31)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:21)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin.getGDS(EmbeddedGDSFactoryPlugin.java:40)
at org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:220)
at org.firebirdsql.jca.FBManagedConnectionFactory.getGDS(FBManagedConnectionFactory.java:114)
at org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:124)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at FBConnect.main(FBConnect.java:23)

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Typical debugging problem :( Solve one problem and another pops up. I will investigate further.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

I tried this under Ubuntu 12.04 As far as I can see under Ubuntu 12.04, the libfbembed2.5 package does not create a /usr/lib/libfbembed.so or /usr/lib/x86_64-linux-gnu/libfbembed.so symlink to /usr/lib/x86_64-linux-gnu/libfbembed.so.2.5.1. After adding this symlink manually the library is found.

BTW: I didn't get the original undefined symbol error with the original libjaybird22_x64.so under Ubuntu 12.04. Which Java version do you have installed? I installed openjdk-6-jdk; maybe the errors depend on the exact java version.

@firebird-automations
Copy link
Author

Commented by: Martin Mayerhofer (mmayerhofer)

I have following java version installed:

Java VM Version:

java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)

Just to add some more information, I used following libraries:

http://sourceforge.net/projects/firebird/files/firebird-linux-amd64/2.5.1-Release/FirebirdCS-2.5.1.26351-0.amd64.tar.gz/download

edit: corrected libary link

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

That download is for the Windows 64 Firebird Embedded, which is not going to work under Ubuntu ;)

Could you please check which http://libfbembed.so files are available on your computer. Most likely you are missing the http://libfbembed.so symlink itself (that was the problem on my ubuntu 12.04 VM).

I would also like to know which Ubuntu package you installed for Java, as your version info differs from the openjdk-6-jdk I installed using apt-get and that package reports:
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.3) (6b24-1.11.3-1ubuntu0.12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

@firebird-automations
Copy link
Author

Commented by: Martin Mayerhofer (mmayerhofer)

sorry pasted the wrong link, of course the windows version will not work under ubuntu ;)

here is the correct link: http://sourceforge.net/projects/firebird/files/firebird-linux-amd64/2.5.1-Release/FirebirdCS-2.5.1.26351-0.amd64.tar.gz/download

as for the java installation, I downloaded it from oracle: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u30-oth-JPR

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

I expected that you would have used the packages from the Ubuntu 12.04 repository itself. I am not sure if I have time to dive deeper into it this week, and I am on holiday from next Saturday. For the embedded library loading be sure to check that the library (or its symlink) is called http://libfbembed.so, and that it is in the actual library path (either specified in java.library.path, or ld.so.conf or in LD_LIBRARY_PATH).

With the Firebird embedded library from the Ubuntu repository I had the same(?) problem as it did not have a http://libfbembed.so library (just a so.2.5 and so.2.5.1).

@firebird-automations
Copy link
Author

Commented by: Paolo (pcucchi)

I've the same problem in 32 bit system: http://libjaybird22.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE
ldd -r shows that this symbol (and some others) are undefined.

Is there a build that fixes this problem also for 32 bit system?

uts@uts-desktop:/usr/lib/i686$ ldd -r /home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so
undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: __gxx_personality_v0 (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: _ZTISt9bad_alloc (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: dlopen (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: _ZdlPv (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: __cxa_end_catch (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: __cxa_allocate_exception (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: dlclose (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: _Znwj (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: _ZdaPv (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: _Znaj (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: __cxa_begin_catch (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: __cxa_throw (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: dlsym (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
undefined symbol: __cxa_free_exception (/home/uts/NetBeansProjects/ladon/lib/win/32/libjaybird22.so)
linux-gate.so.1 => (0xb8047000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7ebb000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7eac000)
/lib/ld-linux.so.2 (0xb8048000)

My system is:
Ubuntu 8.10 kernel 2.6.27-11-generic
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

@firebird-automations
Copy link
Author

Commented by: Martin Mayerhofer (mmayerhofer)

Currently the only solution would be that you compile the natives on your own, including the fix to the build_native.xml which Mark mentioned earlier ...

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

I will upload a new version of the 32 bit library later today.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Attachment: http://libjaybird22.so [ 12180 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Attached correctly linked 32 bit http://libjaybird22.so

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

This issue needs to be linked to Version Jaybird 2.2.1 when it is created

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 2.3 [ 10440 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Committed fixed build file to trunk and Branch_2_2

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 2.2.1 [ 10474 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Commented by: Paolo (pcucchi)

I've set library path to FirebirdCS-2.5.1.26351-0.amd64/buildroot/opt/firebird/lib/libfbclient.so or /opt/firebird/lib (after installing it) or /usr/lib64 but I always have "Could not find or load the firebird client library"

If I statically load library through System.loadlibrary() I've no error.
System.loadLibrary("icudata");
System.loadLibrary("icuuc");
System.loadLibrary("icui18n");
System.loadLibrary("ib_util");
System.loadLibrary("fbembed");
System.loadLibrary("fbclient");

What could be wrong?

My system properties:
Jaybird 2.2
Java 1.7.0_06 64 bit
OS: Ubuntu 12.04 64 bit

Runtime error:

org.firebirdsql.gds.impl.jni.InternalError: FirebirdApiBinding::Initialize - Could not find or load the firebird client library.
at org.firebirdsql.gds.impl.jni.JniGDSImpl.nativeInitilize(Native Method)
at org.firebirdsql.gds.impl.jni.JniGDSImpl.attemptToLoadAClientLibraryFromList(JniGDSImpl.java:92)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:31)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSImpl.<init>(EmbeddedGDSImpl.java:21)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin.getGDS(EmbeddedGDSFactoryPlugin.java:40)
at org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:220)
at org.firebirdsql.jdbc.FBConnectionProperties.getGds(FBConnectionProperties.java:502)
at org.firebirdsql.jdbc.FBConnectionProperties.getDatabaseParameterBuffer(FBConnectionProperties.java:393)
at org.firebirdsql.jca.FBManagedConnectionFactory.getDatabaseParameterBuffer(FBManagedConnectionFactory.java:205)
at org.firebirdsql.jca.FBManagedConnectionFactory.getDefaultConnectionRequestInfo(FBManagedConnectionFactory.java:407)
at org.firebirdsql.pool.AbstractFBConnectionPoolDataSource.allocateConnection(AbstractFBConnectionPoolDataSource.java:265)
at org.firebirdsql.pool.PooledConnectionQueue.addConnection(PooledConnectionQueue.java:491)
at org.firebirdsql.pool.PooledConnectionQueue.start(PooledConnectionQueue.java:155)
at org.firebirdsql.pool.AbstractConnectionPool.getQueue(AbstractConnectionPool.java:205)
at org.firebirdsql.pool.AbstractFBConnectionPoolDataSource.getPooledConnection(AbstractFBConnectionPoolDataSource.java:372)
at org.firebirdsql.pool.FBWrappingDataSource.getConnection(FBWrappingDataSource.java:219)
at com.tecnosens.ladon.dbInterface.DbConnection.connectEmbeddedDS(DbConnection.java:213)

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment