Multiple definitions in Array-f.cc and Array-d.cc
Ben Abbott
bpabbott at mac.com
Mon Feb 9 16:25:23 CST 2009
On Feb 9, 2009, at 3:51 PM, Jaroslav Hajek <highegg at gmail.com> wrote:
> On Mon, Feb 9, 2009 at 7:11 PM, Thomas Treichl
> <Thomas.Treichl at gmx.net> wrote:
>> Hi,
>>
>> a recent change to Array-f.cc and Array-d.cc causes linking
>> problems on Mac.
>> The problem seems to be similar to what we had last year February:
>>
>> http://www-old.cae.wisc.edu/pipermail/octave-maintainers/2008-February/006061.html
>>
>> Here is the error output:
>>
>> ld: multiple definitions of symbol __ZN11octave_sortIdE10merge_initEv
>> pic/Array-d.o definition of __ZN11octave_sortIdE10merge_initEv in
>> section
>> (__TEXT,__text)
>> pic/Array-f.o definition of __ZN11octave_sortIdE10merge_initEv in
>> section
>> (__TEXT,__text)
>> ld: multiple definitions of symbol
>> __ZN11octave_sortIdE10merge_initEv.eh
>> pic/Array-d.o definition of absolute
>> __ZN11octave_sortIdE10merge_initEv.eh
>> (value 0x0)
>> pic/Array-f.o definition of absolute
>> __ZN11octave_sortIdE10merge_initEv.eh
>> (value 0x0)
>> ld: multiple definitions of symbol
>> __ZN11octave_sortIdE11set_compareEPFbddE
>> pic/Array-d.o definition of
>> __ZN11octave_sortIdE11set_compareEPFbddE in
>> section (__TEXT,__text)
>> <SNIP>
>>
>> If I recall in short what happened there: The preprocessor
>> generates exactly
>> the same code for two files, the compiler too and linker then
>> fails. I don't
>> know which file should be changed now (Array-f.cc or Array-d.cc)
>> but one
>> line of
>>
>> INSTANTIATE_ARRAY_SORT (double);
>>
>> should be eliminated, eg.
>>
>> $ hg diff liboctave/Array-d.cc
>> diff -r 314be237cd5b liboctave/Array-d.cc
>> --- a/liboctave/Array-d.cc Mon Feb 09 13:05:35 2009 +0100
>> +++ b/liboctave/Array-d.cc Mon Feb 09 19:10:28 2009 +0100
>> @@ -42,7 +42,7 @@
>> return lo_ieee_isnan (x);
>> }
>>
>> -INSTANTIATE_ARRAY_SORT (double);
>> +// INSTANTIATE_ARRAY_SORT (double);
>>
>> INSTANTIATE_ARRAY_AND_ASSIGN (double, OCTAVE_API);
>>
>> Then compilation on Macs work again. Can you please make such a
>> change,
>> thanks,
>>
>> Thomas
>>
>
> I think the explicit instantiations are OK; however, by mistake
> Array-f.cc was again instantiating double. Fixed.
>
> thanks,
>
Thanks. I can confirm liboctave builds.
Ben
More information about the Bug-octave
mailing list