* Bizarre link errors
@ 1999-04-26 0:00 Daniel Clarke
1999-04-27 0:00 ` Keith Thompson
1999-05-05 0:00 ` Tim
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Clarke @ 1999-04-26 0:00 UTC (permalink / raw)
I'm working on a project involving C and Ada, ada executables importing
functions from C libraries. When we try to build the executable we're
getting a series of bizarre link errors ( included below ). The unresolved
externals are mostly coming from one file which does have a lot of casting
going on which may explain the references to rtti in the linker output.
Beyond that the errors mean nothing to me. I think the problem is arising
from the ada linker not linking in some core C++ library but how to solve it
is another matter. I've tried removing sections of code but the symbol
references occur all over the place.
Platform is SunOs 5.6 on a sparc ultra
Thanks for any help
-Daniel
gnatbl
System_Login.ali -L../../lib -L/user/compsci1/cs_staff/postgres/install6.
3/lib -i -lCWrapperForDCLAPI -lDCLAPI -lDException -lpq -lsocket -lm -lxnet
-lstdc++
Undefined first referenced
symbol in file
__rtti_user
../../lib/libCWrapperForDCLAPI.a(IDList.o)
terminate__Fv
../../lib/libCWrapperForDCLAPI.a(IDList.o)
__cp_push_exception
../../lib/libCWrapperForDCLAPI.a(IDList.o)
__rtti_ptr
../../lib/libCWrapperForDCLAPI.a(IDList.o)
__rtti_si ../../lib/libDCLAPI.a(DDivision.o)
__cp_pop_exception
../../lib/libCWrapperForDCLAPI.a(IDList.o)
__throw_type_match_rtti ../../lib/libDCLAPI.a(DDivision.o)
__cp_exception_info
../../lib/libCWrapperForDCLAPI.a(IDList.o)
__eh_pc
../../lib/libCWrapperForDCLAPI.a(IDList.o)
__throw
../../lib/libCWrapperForDCLAPI.a(IDDivision.
o)
ld: fatal: Symbol referencing errors. No output written to System_Login
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bizarre link errors
1999-04-26 0:00 Bizarre link errors Daniel Clarke
@ 1999-04-27 0:00 ` Keith Thompson
1999-05-05 0:00 ` Tim
1 sibling, 0 replies; 3+ messages in thread
From: Keith Thompson @ 1999-04-27 0:00 UTC (permalink / raw)
"Daniel Clarke" <clarked@aston.ac.uk> writes:
> I'm working on a project involving C and Ada, ada executables importing
> functions from C libraries. When we try to build the executable we're
> getting a series of bizarre link errors ( included below ). The unresolved
> externals are mostly coming from one file which does have a lot of casting
> going on which may explain the references to rtti in the linker output.
> Beyond that the errors mean nothing to me. I think the problem is arising
> from the ada linker not linking in some core C++ library but how to solve it
> is another matter. I've tried removing sections of code but the symbol
> references occur all over the place.
>
> Platform is SunOs 5.6 on a sparc ultra
Interesting. I just ran into a linking problem yesterday that
involved some of the same symbols, though I wasn't using Ada, so it
may not be exactly the same problem.
I was trying to build a large C++ software package using g++ version
2.8.1, and g++ died with an internal error while compiling one of the
source files. I ran switched to version 2.7.2.2 and ran "make" again.
I got a linker error very similar to the one you ran into. The
problem was that I was trying to link together object files created by
two different versions of g++. Apparently some of the symbols
changed. When I deleted the objects ("make clean") and ran "make"
again, it was ok.
Your problem may be a bit different, but I suspect it's also a problem
with two different versions of gcc. The current release of GNAT is
based on a specific version of gcc (I don't remember which one). I
suspect you're using a different version of gcc, probably a newer one,
to compile your C++ code. (I presume you're using g++ and not Sun's
CC.)
Ideally, you should use the same version of gcc for both your Ada and
your C++ sources. Unfortunately, the GNAT binary distribution
includes the C front end, but not the C++ front end -- and later
versions of g++ are significantly closer to complying with the C++
standard.
Whatever version of g++ you're using to compile the C++ code, you
might try invoking it on a C++ main program with the "-v" option.
This will tell you what arguments it's passing to the linker.
Manually invoking GNAT's linker with the same arguments *might* solve
your problem -- or it might silently mask a more serious one.
You might also consider writing your main program in C++ instead of
Ada, and linking with g++ rather than with GNAT's gcc (adding calls to
adainit and adafinal as appropriate). Unlike Ada, C++ doesn't provide
a good way to allow calls from a main program in a foreign language
while guaranteeing proper initialization. (Some Unix linkers handle
this; others don't.)
If this doesn't help, the chat@gnat.com mailing list might be more
helpful than comp.lang.ada. Be sure to specify what version of GNAT
and of g++ you're using.
Finally, check the GNAT documentation (which I don't have handy) for
information about mixing Ada and C++.
--
Keith Thompson (The_Other_Keith) kst@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <http://www.sdsc.edu> <*>
Techno-geek. Mouse bigger than phone. Bites heads off virtual chickens.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bizarre link errors
1999-04-26 0:00 Bizarre link errors Daniel Clarke
1999-04-27 0:00 ` Keith Thompson
@ 1999-05-05 0:00 ` Tim
1 sibling, 0 replies; 3+ messages in thread
From: Tim @ 1999-05-05 0:00 UTC (permalink / raw)
oh really... that's good.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-05-05 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-26 0:00 Bizarre link errors Daniel Clarke
1999-04-27 0:00 ` Keith Thompson
1999-05-05 0:00 ` Tim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox