Hello all,

After the release version 0.43 we met severe problems on Solaris, but it 
is potentially possible to see them on some other platforms too.

Steve Rowe (many thanks for it, Steve) found out, that this problem is 
related to used linker tool.

*** Libtool documentation gives more explanation:

Writing libraries for C++ Creating libraries of C++ code should be a 
fairly straightforward process, because its object files differ from C 
ones in only three ways:

1. Because of name mangling, C++ libraries are only usable by the C++ 
compiler that created them. This decision was made by the designers of 
C++ in order to protect users from conflicting implementations of 
features such as constructors, exception handling, and RTTI.

2. On some systems, the C++ compiler must take special actions for the 
dynamic linker to run dynamic (i.e., run-time) initializers. This means 
that we should not call ld directly to link such libraries, and we 
should use the C++ compiler instead.

3. C++ compilers will link some Standard C++ library in by default, but 
libtool does not know which are these libraries, so it cannot even run 
the inter-library dependence analyzer to check how to link it in. 
Therefore, running ld to link a C++ program or library is deemed to 
fail. However, running the C++ compiler directly may lead to problems 
related with inter-library dependencies.

The conclusion is that libtool is not ready for general use for C++ 
libraries. You should avoid any global or static variable 
initializations that would cause an "initializer element is not 
constant" error if you compiled them with a standard C compiler.

There are other ways of working around this problem, but they are beyond 
the scope of this manual.

Furthermore, you'd better find out, at configure time, what are the C++ 
Standard libraries that the C++ compiler will link in by default, and 
explicitly list them in the link command line. Hopefully, in the future, 
libtool will be able to do this job by itself.

*** end

Hmm... it looks exactly as our problem.

Here is an excerpt from the libtool's todo list:

***

Implement full multi-language support. Currently, this is only for C++, 
but there are beginnings of this in the manual (Other Languages). This 
includes writing libtool not to be so dependent on the compiler used to 
configure it.
We especially need this for C++ linking, for which libtool currently 
does not handle static constructors properly, even on operating systems 
that support them. ``Don't use static constructors'' is no longer a 
satisfactory answer.

*** end

So far the recommendation ``Don't use static constructors'' is the only 
possible choice (at least the simple one).

We'll try to fix this problem as soon as possible, unfortunately not in 
the upcoming release.

So, please, be patient, and if you'd meet problems of this kind (the 
main symptom is, that sabcmd crashes immediately :), hack 
Sablot/engine/Makefile, and force the use of c++ as the default linker 
instead of the  'ld' command.

Regards

Pavel Hlavnicka

-- 
Pavel Hlavnicka
Ginger Alliance Ltd.
Prague; Czech Republic


Reply via email to