ld: fatal: symbol `__gmpz_abs' is multiply-defined:
Marc Glisse
marc.glisse at normalesup.org
Sun May 31 02:31:38 CEST 2009
On Sun, 31 May 2009, Marc Glisse wrote:
> If you remove the first block, things work better. Now I am off to try and
> understand what goes wrong with the "extern inline" version, my basic tests
> seemed to imply that it should work... Apparently, putting just "inline" also
> fails with a weird message about non-PIC code. At least "static inline"
> works...
Some more details now:
"static inline": works, fine
"inline": should work (and be even better at avoiding duplicates), works
on x86, but fails on x64 (I reported it as a bug to Sun, we'll see if they
agree)
"extern inline": should fail (and fails indeed). It produces an externally
visible definition, and several definitions are a conflict. For some
reason sunpro manages to merge several extern inline definitions (where
gcc gives an error), but it still gives an error when you link it with an
object that has a regular definition for this symbol.
So basically, when you want to avoid the static version (one instantiation
generated for each translation unit where it is used and not inlined), you
are supposed to have only an inline definition everywhere, except in one
translation unit that has either a regular definition or an extern inline
one.
For now, I guess the easiest would be to remove the paragraph about sunpro
and "extern inline" in gmp-h.in, and keep the one about sunpro and "static
inline".
--
Marc Glisse
More information about the gmp-bugs
mailing list