public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* undefined symbol
@ 1998-10-21 22:10 Ulrich Czekalla
  1998-10-26  2:13 ` Alexandre Oliva
  0 siblings, 1 reply; 6+ messages in thread
From: Ulrich Czekalla @ 1998-10-21 22:10 UTC (permalink / raw)
  To: egcs

I have created a shared library which contains a function called
_mallocdb. I wrote a small test program which makes a call to it and it
compiled and linked correctly. When I try to run it I get the error;

./test: error in loading shared libraries
/home/lcl/liblcld.so: undefined symbol: _mallocdb__FUiiPc

I tried checking the symbols of the library;

> nm liblcld.so | grep _mallocdb

00002a0c T _mallocdb__FUiiPCc
	 U _mallocdb__FUiiPc

Anyone have any ideas? Is there something I have to do to explicitly
export certain function? Is there a document which explains this stuff
in painful detail?

Thanks,

-Ulrich
-- 
/*****************************************************
 * Ulrich Czekalla                                   *
 * University of Toronto                             *
 * Software Engineering       Bachelor of Commerce   *
 * g5ulczek@cdf.utoronto.ca                          *
 *****************************************************/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined symbol
  1998-10-21 22:10 undefined symbol Ulrich Czekalla
@ 1998-10-26  2:13 ` Alexandre Oliva
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Oliva @ 1998-10-26  2:13 UTC (permalink / raw)
  To: Ulrich Czekalla; +Cc: egcs

Ulrich Czekalla <linux@western.wave.ca> writes:

> ./test: error in loading shared libraries
> /home/lcl/liblcld.so: undefined symbol: _mallocdb__FUiiPc

Declare it as extern "C" in the header-file you #include in the C++
sources. 

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined symbol
  2003-08-06 18:53 ` Janis Johnson
@ 2003-08-06 19:11   ` sami ozen
  0 siblings, 0 replies; 6+ messages in thread
From: sami ozen @ 2003-08-06 19:11 UTC (permalink / raw)
  To: Janis Johnson; +Cc: gcc

Hi Janis,

Yes i realised the difference name manglings for different compilers.
i installed same compiler (SUN FORTE) that libraries are compiled , and
after i succeeded in compiling my applications.

Than you very much,
Sami

----- Original Message -----
From: "Janis Johnson" <janis187@us.ibm.com>
To: "sami ozen" <sami@provus.ro>
Cc: <gcc@gcc.gnu.org>
Sent: Wednesday, August 06, 2003 7:58 PM
Subject: Re: undefined symbol


> On Wed, Aug 06, 2003 at 10:22:31AM +0300, sami ozen wrote:
> >
> >  I am using some 3rd party libraries, and while using these libs i got a
> > linker error.
>
> It's likely that the name mangling used by the C++ compiler that built
> that library is different from the name mangling used by the version of
> G++ you're using, so the function names that the linker sees are
> different.  Name mangling is just one of many differences between
> the object code generated by different C++ compilers.  You can't link
> together C++ object files (including libraries) unless they were built
> by the same compiler or by compilers that follow the same application
> binary interface (ABI) for C++.
>
> See http://gcc.gnu.org/onlinedocs/gcc/Compatibility.html#Compatibility
> for some general information about issues that affect interoperability
> of C++ compilers.
>
> Janis
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined symbol
  2003-08-06  7:53 sami ozen
@ 2003-08-06 18:53 ` Janis Johnson
  2003-08-06 19:11   ` sami ozen
  0 siblings, 1 reply; 6+ messages in thread
From: Janis Johnson @ 2003-08-06 18:53 UTC (permalink / raw)
  To: sami ozen; +Cc: gcc

On Wed, Aug 06, 2003 at 10:22:31AM +0300, sami ozen wrote:
> 
>  I am using some 3rd party libraries, and while using these libs i got a
> linker error.

It's likely that the name mangling used by the C++ compiler that built
that library is different from the name mangling used by the version of
G++ you're using, so the function names that the linker sees are
different.  Name mangling is just one of many differences between
the object code generated by different C++ compilers.  You can't link
together C++ object files (including libraries) unless they were built
by the same compiler or by compilers that follow the same application
binary interface (ABI) for C++.

See http://gcc.gnu.org/onlinedocs/gcc/Compatibility.html#Compatibility
for some general information about issues that affect interoperability
of C++ compilers.

Janis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* undefined symbol
@ 2003-08-06  7:53 sami ozen
  2003-08-06 18:53 ` Janis Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: sami ozen @ 2003-08-06  7:53 UTC (permalink / raw)
  To: gcc


 I am using some 3rd party libraries, and while using these libs i got a
linker error.

When i compiled istauth.cxx these following 3 functions cant be linked, what
can be the solution?

(All i can see is , when functions (functions that are implemented in
libraries) are not defined in

#ifdef __cplusplus
extern "C" {
#endif
            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#ifdef __cplusplus
}
#endif

i cant use that function, all other functions defined in extern decalration
are linked without any problem)

/prooasis/oasis74/sami/istauth/src>ls
Makefile        aclocal.m4      config.status   depcomp         install-sh
missing
Makefile.am     autom4te.cache  configure       dummy.cxx       istauth.cxx
mkinstalldirs
Makefile.in     config.log      configure.in    dummy.o         istauth.o
/prooasis/oasis74/sami/istauth/src>


g++  -g -O2   -o istauth  istauth.o
dummy.o -locurrency-1 -loshc-2 -loauth-0 -lombox-0 -loistdbm-3 -lotrace-0 -l
osyslg-0 -locatsig-0 -loargv0-0
Undefined                       first referenced
 symbol                             in file
ccyGetDescription(int, char*, char*, char*, char*,
char*)/prooasis/oasis74/lib/liboauth-0.so
shc_locate_bin(shcpkg**, char*)     /prooasis/oasis74/lib/liboauth-0.so
ccyGetDecimalPosition(int, int)     /prooasis/oasis74/lib/liboauth-0.so
ld: fatal: Symbol referencing errors. No output written to istauth
collect2: ld returned 1 exit status
make: *** [istauth] Error 1
/prooasis/oasis74/sami/istauth/src>

/prooasis/oasis74/lib>elfdump libocurrency-1.0.3.so|grep ccyGetDe*
      [30]  0x00003460 0x0000019c  FUNC GLOB  D    0 .text       int
ccyGetDecimalPosition(int,int)
      [63]  0x000038b8 0x00000120  FUNC GLOB  D    0 .text       int
ccyGetDescription(int,char*,char*,char*,char*,char*)
      [66]  0x000033f0 0x0000005c  FUNC GLOB  D    0 .text       int
ccyGetDecimalPosition(int,char*,int)
      [96]  0x00003460 0x0000019c  FUNC GLOB  D    0 .text       int
ccyGetDecimalPosition(int,int)
     [129]  0x000038b8 0x00000120  FUNC GLOB  D    0 .text       int
ccyGetDescription(int,char*,char*,char*,char*,char*)
     [132]  0x000033f0 0x0000005c  FUNC GLOB  D    0 .text       int
ccyGetDecimalPosition(int,char*,int)
            [30]        int ccyGetDecimalPosition(int,int)
            [63]        int
ccyGetDescription(int,char*,char*,char*,char*,char*)
       152  [66]        int ccyGetDecimalPosition(int,char*,int)
        R_SPARC_JMP_SLOT             0x15360          0  .rela.plt      int
ccyGetDecimalPosition(int,int)
/prooasis/oasis74/lib>


/prooasis/oasis74/lib>elfdump liboshc-2.0.45.so|grep shc_locate_bin
    [1737]  0x0007dfb0 0x00000284  FUNC GLOB  D    0 .text       int
shc_locate_bin(shcpkg**,char*)
    [2248]  0x0007e248 0x000001f4  FUNC GLOB  D    0 .text       int
shc_locate_bin(shcpkg**,char*,char*)
    [5389]  0x0007dfb0 0x00000284  FUNC GLOB  D    0 .text       int
shc_locate_bin(shcpkg**,char*)
    [5900]  0x0007e248 0x000001f4  FUNC GLOB  D    0 .text       int
shc_locate_bin(shcpkg**,char*,char*)
      1008  [2248]      int shc_locate_bin(shcpkg**,char*,char*)
            [1737]      int shc_locate_bin(shcpkg**,char*)
        R_SPARC_JMP_SLOT             0xb7cac          0  .rela.plt      int
shc_locate_bin(shcpkg**,char*)
        R_SPARC_JMP_SLOT             0xb7d90          0  .rela.plt      int
shc_locate_bin(shcpkg**,char*,char*)
/prooasis/oasis74/lib>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* undefined symbol
@ 2003-08-06  7:42 sami ozen
  0 siblings, 0 replies; 6+ messages in thread
From: sami ozen @ 2003-08-06  7:42 UTC (permalink / raw)
  To: gcc



When i compiled istauth.cxx these following 3 functions cant be linked, what
is the reason?

(For temporary solution i made alternative functions that can be used
instead of these, but i want to use original sources, so it better to solve
this problem.
All i can see is functions are not defined in

#ifdef __cplusplus
extern "C" {
#endif
            xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#ifdef __cplusplus
}
#endif

then i cant use that function, but i couldnt find away to get rid off this
error, all other functions defined in extern decalration are linked without
any problem)

/prooasis/oasis74/sami/istauth/src>ls
Makefile        aclocal.m4      config.status   depcomp         install-sh
missing
Makefile.am     autom4te.cache  configure       dummy.cxx       istauth.cxx
mkinstalldirs
Makefile.in     config.log      configure.in    dummy.o         istauth.o
/prooasis/oasis74/sami/istauth/src>


g++  -g -O2   -o istauth  istauth.o
dummy.o -locurrency-1 -loshc-2 -loauth-0 -lombox-0 -loistdbm-3 -lotrace-0 -l
osyslg-0 -locatsig-0 -loargv0-0
Undefined                       first referenced
 symbol                             in file
ccyGetDescription(int, char*, char*, char*, char*,
char*)/prooasis/oasis74/lib/liboauth-0.so
shc_locate_bin(shcpkg**, char*)     /prooasis/oasis74/lib/liboauth-0.so
ccyGetDecimalPosition(int, int)     /prooasis/oasis74/lib/liboauth-0.so
ld: fatal: Symbol referencing errors. No output written to istauth
collect2: ld returned 1 exit status
make: *** [istauth] Error 1
/prooasis/oasis74/sami/istauth/src>

/prooasis/oasis74/lib>elfdump libocurrency-1.0.3.so|grep ccyGetDe*
      [30]  0x00003460 0x0000019c  FUNC GLOB  D    0 .text       int
ccyGetDecimalPosition(int,int)
      [63]  0x000038b8 0x00000120  FUNC GLOB  D    0 .text       int
ccyGetDescription(int,char*,char*,char*,char*,char*)
      [66]  0x000033f0 0x0000005c  FUNC GLOB  D    0 .text       int
ccyGetDecimalPosition(int,char*,int)
      [96]  0x00003460 0x0000019c  FUNC GLOB  D    0 .text       int
ccyGetDecimalPosition(int,int)
     [129]  0x000038b8 0x00000120  FUNC GLOB  D    0 .text       int
ccyGetDescription(int,char*,char*,char*,char*,char*)
     [132]  0x000033f0 0x0000005c  FUNC GLOB  D    0 .text       int
ccyGetDecimalPosition(int,char*,int)
            [30]        int ccyGetDecimalPosition(int,int)
            [63]        int
ccyGetDescription(int,char*,char*,char*,char*,char*)
       152  [66]        int ccyGetDecimalPosition(int,char*,int)
        R_SPARC_JMP_SLOT             0x15360          0  .rela.plt      int
ccyGetDecimalPosition(int,int)
/prooasis/oasis74/lib>


/prooasis/oasis74/lib>elfdump liboshc-2.0.45.so|grep shc_locate_bin
    [1737]  0x0007dfb0 0x00000284  FUNC GLOB  D    0 .text       int
shc_locate_bin(shcpkg**,char*)
    [2248]  0x0007e248 0x000001f4  FUNC GLOB  D    0 .text       int
shc_locate_bin(shcpkg**,char*,char*)
    [5389]  0x0007dfb0 0x00000284  FUNC GLOB  D    0 .text       int
shc_locate_bin(shcpkg**,char*)
    [5900]  0x0007e248 0x000001f4  FUNC GLOB  D    0 .text       int
shc_locate_bin(shcpkg**,char*,char*)
      1008  [2248]      int shc_locate_bin(shcpkg**,char*,char*)
            [1737]      int shc_locate_bin(shcpkg**,char*)
        R_SPARC_JMP_SLOT             0xb7cac          0  .rela.plt      int
shc_locate_bin(shcpkg**,char*)
        R_SPARC_JMP_SLOT             0xb7d90          0  .rela.plt      int
shc_locate_bin(shcpkg**,char*,char*)
/prooasis/oasis74/lib>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-08-06 18:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-21 22:10 undefined symbol Ulrich Czekalla
1998-10-26  2:13 ` Alexandre Oliva
2003-08-06  7:42 sami ozen
2003-08-06  7:53 sami ozen
2003-08-06 18:53 ` Janis Johnson
2003-08-06 19:11   ` sami ozen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).