Subject | Re: [Firebird-Java] Firebird embedded on Linux - success |
---|---|
Author | Nikolay Ivanchev |
Post date | 2003-11-05T07:26:09Z |
Thanks Ryan.. actually yesterday I managed to solve it :-)
I added
<linkerarg value="-lstdc++"/> and works like charm. No linking errors, all
test pass except 2 - the same that fail on pure-java alsoe
libjaybird.so must be in library path. I added them to LD_LIBRARY_PATH
before running tests.
I am posting tests as an attachment
Well, to me seems like fbembedded work under Linux again.
What else can I do to help?
Niki
I added
<linkerarg value="-lstdc++"/> and works like charm. No linking errors, all
test pass except 2 - the same that fail on pure-java alsoe
libjaybird.so must be in library path. I added them to LD_LIBRARY_PATH
before running tests.
I am posting tests as an attachment
Well, to me seems like fbembedded work under Linux again.
What else can I do to help?
Niki
> Hi Nikolay,yeld
>
> >he unresolved symbol are not matched in in c++ library but matched in
> >libfbembedded.so. I bet my right arm on this
> >Simply becouse LD_PRELOAD=libfbembedded.so ldd -r libjaybird.so doesn't
> yeld
> >any unresolved symbols. I suppose renaming libfbembedded.so to
> >libfbclient.so will be enough, but somewhy skeptical to this.
>
> I assume this is because libfbembedded.so links with the c++ runtime. Try
> adding
>
> <syslibset libs="stdc++"/>
>
> at line 229 of build_native.xml
>
> <target name="prepare_gcc" if="buildon-unix">
>
> <compiler id="jaybird.compiler" name="gcc" if="buildon-unix">
>
> <defineset>
> <define name="JAVA_GDS_EXPORTS"/>
> </defineset>
> </compiler>
>
>
> <linker id="jaybird.linker" name="gcc" if="buildon-unix">
> <linkerarg value="-ldl"/>
> <linkerarg value="-lc"/> <--- HERE
> </linker>
>
> </target>
>
> These are almost definatly c++ runtime methods.
>
> Thanks
> Ryan
>
>
>
> -----Original Message-----
> From: Nikolay Ivanchev [mailto:nivanchev@icygen.com]
> Sent: 04 November 2003 12:38
> To: Firebird-Java@yahoogroups.com
> Subject: Re: [Firebird-Java] Firebird embedded on Linux - success
>
>
> Thanks Ryan for the replay.
>
> The only change I made is to workaround _alloca call in entryoints.cpp
>
> The unresolved symbol are not matched in in c++ library but matched in
> libfbembedded.so. I bet my right arm on this
> Simply becouse LD_PRELOAD=libfbembedded.so ldd -r libjaybird.so doesn't
> any unresolved symbols. I suppose renaming libfbembedded.so toproblem.
> libfbclient.so will be enough, but somewhy skeptical to this.
> As I stated, I am not C developer so I cannot help much in linking
> My converted apps work with LD_PRELOAD just fineI
> Tonight I will correct _alloca to alloca and will run my tests on BLOB and
> will report this tommorow.it
>
> BTW which ant task is to run against embedded?
> Regards,
> Niki
>
>
>
> > Hi Nikolay,
> >
> > >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
> > was my name).(/usr/lib/libjaybird.so)
> > >I suppose _alloca is in some .h file but ....
> >
> > This is a mistake I made while implementing this method. It should read
> > 'alloca' rather then '_alloca'. alloca is then defined in platform.h
> > appropriatly. I will correct this in CVS today - but if you make that
> > replacement it should work better.
> >
> > >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)
> > >
> > >
> > >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
> > >:)
> > >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 usingpath.seprator
> > instead of ";")ensuring
> > >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.
> >
> > These symbols look like they are probarbly part of the c++ runtime
> library.
> > I dont know what the c++ runtime library is called for linux but
> > libjaybird.so is linked with the correct c++ runtime I would guessshould
> > correct this problem.microsoft
> >
> > >Since libjaybird is wrapper to libfbembedded why not link to it?
> >
> > libjaybird links with the firebird client library using what in
> > terminology is called explicit dynamic linking. This is where it loadsthe
> > dll explicitly by name and then resolves entrypoints manually(seecould
> > FBBinings). This allows it more control over which dll is loaded and
> > allow it too behave differntly depending on which entrypoints it findson
> > the dll allowing it to in theory fail gracefully for missing features instraightforward
> > older versions.
> >
> > The alternitive of linking staticly with the firebird client libraries
> > static import library would be whats refered too as implicit dynamic
> > linking - the static import library takes care of loading the dll and
> > resolving entrypoints for us - making it potentially more
> tothe
> > make use of the functionality within a dll - but taking away the
> advantages
> > described above. For example if we where too do this to make use of both
> > embedded server and type 2 mode on windows we would either need two
> > different jaybird.dll's(linked against different static import
> libraries) -
> > or force the user to rename fbembed.dll to use 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
> > app on tests machines which >does not have any additional software2
> 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
> > hours later... :(I
> >
> > Their has been some discussion regarding this in fb-support and
> > fb-development. There are some issues. Perhaps search the archives of
> these
> > forums for more details.
> >
> > >Can some one guide me a little with JUnit tetst for firebird so I can
> > rework them to run against
> > >embedded firebird.
> >
> > What problems do you get with running the target in the ant build script
> for
> > running the tests against the embedded server ?
> >
> > >What else can I do to help?
> >
> > If you could detail the changes you have made to get this running under
> > linux we make appropriate changes in CVS version so it can checkout too
> and
> > build/run on linux as easily as it does on windows/solaris(or did until
> the
> > _alloca mistake). (Yipee linux support in jaybird native !)
> >
> > I hope this is of help.
> >
> > Thanks
> > Ryan
> >
> >
> >
> > -----Original Message-----
> > From: Nikolay Ivanchev [mailto:nivanchev@icygen.com]
> > Sent: 04 November 2003 08:46
> > To: JayBird
> > Subject: [Firebird-Java] Firebird embedded on Linux - success
> >
> >
> > 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
> > 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)
> >
> >
> > 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)
> >
> > 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 usingpath.seprator
> > instead of ";")course
> > 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
> > IDE's refuse to start. I know I can use type4 drivers for development,but
> IDepends
> > 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
> > tool shows that fbembedded (fbclient) depends only on msvcrt.dll butwhen
> IBLOB's?
> > 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
> > Can some one guide me a little with JUnit tetst for firebird so I canwill
> rework
> > them to run against embedded firebird. I suppose linking to fbclient
> beprogramming,
> > required. (well I bought used copy of Java tools for extreme
> sohttp://docs.yahoo.com/info/terms/
> > in a week or so I will learn log4j, ant and JUnit).
> > What else can I do to help?
> >
> > Regards,
> > Nikolay Ivanchev
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Sponsor
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > Firebird-Java-unsubscribe@yahoogroups.com
> >
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > Firebird-Java-unsubscribe@yahoogroups.com
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> >
> >
> >
>
>
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>