>>>>> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:

Lars> What happens if you make a small test file with the crc_stuff...
Lars> does that work? or do you still get the linker error?

Lars> If we can create a valid test case for this one, we can also
Lars> bring the boost people into the loop.

OK, with latest boost, consider the following minimal testcase

#include "boost/crc.hpp"

int main() {
        boost::crc_32_type crc;

Compiler is gcc 2.95.2, but it seems that the situation is the same
with gcc 3.2 (can somebody confirm?)

On tru64 unix 4.0f, with native linker:

fantomas: g++ -I. -c linkbug.C ; g++ -o linkbug linkbug.o
boost::detail::crc_table_t<32, 79764919, true>::table_
collect2: ld returned 1 exit status
fantomas: nm linkbug.o | c++filt|grep '::table_'
boost::detail::crc_table_t<32, 79764919, true>::table_ | 0000000000000000 | U | 

On redhat linux 7.1 (still gcc 2.95.2 as compiler!)

schuss: g++ -I. -c linkbug.C ; g++ -o linkbug linkbug.o
schuss: nm linkbug.o | c++filt|grep '::table_'
00000000 V boost::detail::crc_table_t<32, 79764919, true>::table_

So on linux I have a weak symbol, whereas on tru64 all I have is an
external symbol, and link fails. It seems the problem is that weak
symbols are not supported on some non-GNU object formats, and gcc has
a problem with that. The following thread may give some hints:
(although I am not sure this is the same problem)

We have solved this very same problem in other parts of LyX by moving
code from .C files to headers, so that I suspect this is related to
playing with #pragma interface/implementation (but I have not been
successful with that sofar).

Now if I change the test program to

#include "boost/crc.hpp"

template class boost::detail::crc_table_t<32, 79764919, true>;

int main() {
        boost::crc_32_type crc;

then everything is alright:

fantomas: g++ -I. -c linktest.C ; g++ -o linktest linktest.o
fantomas: nm linktest.o | c++filt|grep '::table_'
boost::detail::crc_table_t<32, 79764919, true>::table_ | 0000000000001528 | D | 

Reply via email to