link error - _Unwind_RaiseException lazarus / 16-Databases ---------------------------------------------------------------------- anthony · 2008-09-05 08:10 Hello, I try to run the demo application from /usr/share/fpcsrc/packages/base/ibase I read the read.me file carefully. compiling ibase60.pp  ==>  OK running script mkdb  ==>  OK compiling testib60.pp gives following errors: [root@ex5 ibase]# ppc386 testib60.pp Free Pascal Compiler version 2.2.0 [2007/08/31] for i386 Copyright (c) 1993-2007 by Florian Klaempfl Target OS: Linux for i386 Compiling testib60.pp testib60.pp(19,7) Note: Local variable "dbinfo" not used Linking testib60 /usr/lib/libgds.so: undefined reference to `_Unwind_RaiseException' /usr/lib/libgds.so: undefined reference to `_Unwind_GetLanguageSpecificData' /usr/lib/libgds.so: undefined reference to `_Unwind_Resume' /usr/lib/libgds.so: undefined reference to `_Unwind_DeleteException' /usr/lib/libgds.so: undefined reference to `_Unwind_GetTextRelBase' /usr/lib/libgds.so: undefined reference to `_Unwind_SetIP' /usr/lib/libgds.so: undefined reference to `_Unwind_GetDataRelBase' /usr/lib/libgds.so: undefined reference to `_Unwind_GetRegionStart' /usr/lib/libgds.so: undefined reference to `_Unwind_SetGR' /usr/lib/libgds.so: undefined reference to `_Unwind_GetIP' testib60.pp(147,1) Error: Error while linking testib60.pp(147,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted [/list] Can you tell me how to solve this? Thanks! ---------------------------------------------------------------------- fbdioan · 2008-09-05 08:38 Do you use Interbase or Firebird ? Which version ? ---------------------------------------------------------------------- anthony · 2008-09-05 08:46 Dear fbdioan, I use FirebirdSS version 2.1.1 and /usr/lib/libgds.so --> /opt/firebird/lib/libfbclient.so.2.1.1 ---------------------------------------------------------------------- fbdioan · 2008-09-05 09:09 Quote from: "anthony" ... and /usr/lib/libgds.so --> /opt/firebird/lib/libfbclient.so.2.1.1 i'll take a look in an hour or two, but in the mean time can you try fpc 2.2.2 or is not possible ? PS: What distro ? ---------------------------------------------------------------------- anthony · 2008-09-05 09:40 Dear fbdioan. My results in fpc 2.2.2 are similar' [root@ex5 ibase]# /opt/fpc_2.2.2/bin/ppc386 -Fu/opt/fpc_2.2.2/lib/fpc/2.2.2/units/i386-linux/rtl/ testib60.pp Free Pascal Compiler version 2.2.2rc2 [2008/07/10] for i386 Copyright (c) 1993-2008 by Florian Klaempfl Target OS: Linux for i386 Compiling testib60.pp Compiling ibase60.pp testib60.pp(19,7) Note: Local variable "dbinfo" not used Linking testib60 /usr/lib/libgds.so: undefined reference to `_Unwind_RaiseException' /usr/lib/libgds.so: undefined reference to `_Unwind_GetLanguageSpecificData' /usr/lib/libgds.so: undefined reference to `_Unwind_Resume' /usr/lib/libgds.so: undefined reference to `_Unwind_DeleteException' /usr/lib/libgds.so: undefined reference to `_Unwind_GetTextRelBase' /usr/lib/libgds.so: undefined reference to `_Unwind_SetIP' /usr/lib/libgds.so: undefined reference to `_Unwind_GetDataRelBase' /usr/lib/libgds.so: undefined reference to `_Unwind_GetRegionStart' /usr/lib/libgds.so: undefined reference to `_Unwind_SetGR' /usr/lib/libgds.so: undefined reference to `_Unwind_GetIP' testib60.pp(147,1) Error: Error while linking testib60.pp(147,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted [/list] The distribution I use is Mandriva 2008.1 (Spring) Powerpack I installed Firebird from FirebirdSS-2.1.1.17910-0.nptl.i686.tar.gz Is this relevant? http:// http://www.nabble.com/-FB-Tracker--Created:-(CORE-2033)-Unresolved- symbol-_Unwind_GetIP-in-client-library-td18828257.html It says : Quote People, please. Use dynamic linking. If kinterbasdb needs the _Unwind_GetIP symbol (i.e. the symbol is present in kinterbasdb shared object as an unresolved one), then kinterbasdb must dyna-link to the library in question. If fbclient needs the symbol, then it has to link to the library in question, dynamicly. the program testib60 uses static linking. I do not understand the remark as the file kinterbasdb is not available on my system. In which library are the references declared? How to change to dynamic linking? I hope we can sort this problem out. Thanks in advance. ---------------------------------------------------------------------- fbdioan · 2008-09-05 10:54 Try to define NEEDGCCLIB in command line.  ( i.e. ppc386 -dNEEDGCCLIB testib60.pp) Unfortunately in FB 2.1 the situation is like this : " ... It's more then easy to use dynamic linking for it. But I prefer to keep it static for the following reason. Two different version libstdc++ libraries can't co-exist in the same process. This becomes a big problem when one needs to use 2 libraries, using different versions of libstdc++, inside same process (like php). Therefore it was decided a few years ago to use static libstdc++ linkage in fbclient. Another library, libgcc, was not mentioned, cause it never used to change it's so version. And noone (me being first) noticed, that there is one unresolved external, which is resolved by libgcc. Therefore current fix is nothing more except fix for a bug, not noticed a few years ago. ... " ---------------------------------------------------------------------- anthony · 2008-09-05 11:30 unfortunately the result is the same [root@ex5 ibase]# /opt/fpc_2.2.2/bin/ppc386 -Fu/opt/fpc_2.2.2/lib/fpc/2.2.2/units/i386-linux/rtl/ -dNEEDGCCLIB testib60.pp Free Pascal Compiler version 2.2.2rc2 [2008/07/10] for i386 Copyright (c) 1993-2008 by Florian Klaempfl Target OS: Linux for i386 Compiling testib60.pp Compiling ibase60.pp testib60.pp(19,7) Note: Local variable "dbinfo" not used Linking testib60 /usr/lib/libgds.so: undefined reference to `_Unwind_RaiseException' /usr/lib/libgds.so: undefined reference to `_Unwind_GetLanguageSpecificData' /usr/lib/libgds.so: undefined reference to `_Unwind_Resume' /usr/lib/libgds.so: undefined reference to `_Unwind_DeleteException' /usr/lib/libgds.so: undefined reference to `_Unwind_GetTextRelBase' /usr/lib/libgds.so: undefined reference to `_Unwind_SetIP' /usr/lib/libgds.so: undefined reference to `_Unwind_GetDataRelBase' /usr/lib/libgds.so: undefined reference to `_Unwind_GetRegionStart' /usr/lib/libgds.so: undefined reference to `_Unwind_SetGR' /usr/lib/libgds.so: undefined reference to `_Unwind_GetIP' testib60.pp(147,1) Error: Error while linking testib60.pp(147,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted [/list] Remark: Informatie about the ABI can be seen at: http:// http://www.codesourcery.com/public/cxx-abi/abi-eh.html ---------------------------------------------------------------------- anthony · 2008-09-05 20:39 I found a work around by using FirebirsSS-2.0.4 The remaining question is: Why can I not compile ibase60.pp against FirebirdSS-2.1.1? 1. Is it my fault by not linking the correct library? 2. Is it a Firebird problem by providing an incorrect compiled libfbclient? 3. Is it a free pascal bug? thanks ---------------------------------------------------------------------- luiscardozo · 2010-08-31 23:15 Hello, this is my 1st post! First of all, sorry for revamping this post (the last response was 2 years ago!) I am linking a Lazarus program with a external library (in Linux, .so), and I got the same error: undefined reference to `_Unwind_RaiseException' After a lot of searching I found that: 1) _Unwind_RaiseException is defined in libgcc_s ( see http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core- generic/libgcc-s-ddefs.html ) with, in Ubuntu 10.04 is in /lib/libgcc_s.so.1 2) As it is needed to declare each external function (in external libraries) and I found that Lazarus links "automagically", al that I did for it to work is declaring: function Nothing(): Pointer cdecl; external 'gcc_s'; As I don't know the exact declaration of the functions in gcc_s (or because I am lazy), I saw that declaring a function that does not exists (in this case "Nothing()"), Lazarus automagically links the library (in this case libgcc_s) to the program, without complaining. Again, sorry for revamping this post, but this solution worked for me.