Subject | Firebird embedded on Linux - success |
---|---|
Author | Nikolay Ivanchev |
Post date | 2003-11-04T08:45:36Z |
Early this morning I managed to run it
finaly.
Here are the problems which I
encounter
1. Compiling entrypoints.cpp -
method JNIEXPORT jbyteArray JNICALL
Java_org_firebirdsql_ngds_GDS_1Impl_native_1isc_1blob_1info
There is a bug in line 937 -> char* resultBuffer
= (char*)_alloca(jBufferLength); <-
There is no such method. Since you can blame me in
everything, except being C (C++)developer I simply changed this line to make the
char* to some string (with my ego it was my name).
I suppose _alloca is in some .h file but
....
2. After compiling libjaybird.so is not linked to
libfbembedded so when I tried to run sample app it returned to me:
root@localhost firebird2]# Exception in thread
"main" java.lang.UnsatisfiedLinkError: /opt//jdk1.4/jre/lib/i386/libjaybird.so:
/opt/jdk1.4/jre/lib/i386/libjaybird.so: undefined symbol:
_ZTVN10__cxxabiv117__class_type_infoE
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1389)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at org.firebirdsql.ngds.GDS_Impl.<init>(GDS_Impl.java:53)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1389)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at org.firebirdsql.ngds.GDS_Impl.<init>(GDS_Impl.java:53)
When i ldd-ed the libjaybird.so I saw
this
[root@localhost libr]# ldd -r
/usr/lib/libjaybird.so
libdl.so.2 => /lib/libdl.so.2 (0x40037000)
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE (/usr/lib/libjaybird.so)
undefined symbol: __gxx_personality_v0 (/usr/lib/libjaybird.so)
undefined symbol: _ZTISt9bad_alloc (/usr/lib/libjaybird.so)
undefined symbol: _Znaj (/usr/lib/libjaybird.so)
undefined symbol: _ZdlPv (/usr/lib/libjaybird.so)
undefined symbol: __cxa_end_catch (/usr/lib/libjaybird.so)
undefined symbol: _Unwind_Resume (/usr/lib/libjaybird.so)
undefined symbol: __cxa_throw (/usr/lib/libjaybird.so)
undefined symbol: _ZdaPv (/usr/lib/libjaybird.so)
undefined symbol: __cxa_begin_catch (/usr/lib/libjaybird.so)
undefined symbol: __cxa_allocate_exception (/usr/lib/libjaybird.so)
libdl.so.2 => /lib/libdl.so.2 (0x40037000)
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE (/usr/lib/libjaybird.so)
undefined symbol: __gxx_personality_v0 (/usr/lib/libjaybird.so)
undefined symbol: _ZTISt9bad_alloc (/usr/lib/libjaybird.so)
undefined symbol: _Znaj (/usr/lib/libjaybird.so)
undefined symbol: _ZdlPv (/usr/lib/libjaybird.so)
undefined symbol: __cxa_end_catch (/usr/lib/libjaybird.so)
undefined symbol: _Unwind_Resume (/usr/lib/libjaybird.so)
undefined symbol: __cxa_throw (/usr/lib/libjaybird.so)
undefined symbol: _ZdaPv (/usr/lib/libjaybird.so)
undefined symbol: __cxa_begin_catch (/usr/lib/libjaybird.so)
undefined symbol: __cxa_allocate_exception (/usr/lib/libjaybird.so)
I searched for those symbols and I found them in
libfbembedded.so
At this point the final solution was simple (coping
libfbembedded.so to libfbclient.so)
LD_PRELOAD libfbcliend.so java -cp
<my_classes> <main_method>
Everything wokrs just fine on my apps and tests
excpet BLOBLS ofcourse :)
Actually i modified java.library.path (well this
time using path.seprator instead of ";")
The problem is that I played with LD_LIBRARY_PATH
and java.library.path but it was 5am in the morning, so I am not 100% sure which
solutuon works, however I am 95% sure that java.library.path is the right
one.
So I have several questions now:
LD_PRELOAD is not suitable for running embedded
firebird with java course IDE's refuse to start. I know I can use type4 drivers
for development, but I really like to develop in enviroment much closer to real
situation.
Since libjaybird is wrapper to libfbembedded why
not link to it?
Yesterday I had a nasty problem with fbembedded on
Windows. MSVC60 Depends tool shows that fbembedded (fbclient) depends only on
msvcrt.dll but when I deployed the app on tests machines which does not have any
additional software installed I saw that msvcp60.dll is required also (which was
a difficult to trace problem, my first instalation was on win9x machine, which
threw an exception, win2k machine pop-uped a screen which informed me about
missed dll but 2 hours later... :(
I added /D_STATIC_CPPLIB as a compiler directive but didn't helped. How can work
out this situatuon?
Can some one fix the bug in entrypoints.cpp so I
can test against BLOB's?
Can some one guide me a little with JUnit tetst for
firebird so I can rework them to run against embedded firebird. I suppose
linking to fbclient will be required. (well I bought used copy of Java tools for
extreme programming, so in a week or so I will learn log4j, ant and
JUnit).
What else can I do to help?
Regards,
Nikolay Ivanchev