CVS build error with new sort

John W. Eaton jwe at bevo.che.wisc.edu
Tue Feb 12 14:45:52 CST 2008


On 12-Feb-2008, Thomas Treichl wrote:

| This was a message that I sent, John's Mac and my Mac are different in the way 
| of ia32/ia64 architecture, 10.4/10.5 OSX version, different compilers etc. but 
| the 'ld: multiple definitions...' problem is there on both systems. I have 
| downloaded a new snapshot of the latest hg archive, did no modification to it 
| and started compilation. Here is my output
| 
| nm pic/Array-b.o | grep octave_sort

OK, since INSTANTIATE_ARRAY_SORT and INSTANTIATE_SPARSE_SORT appear to
do the same thing, I don't see why we need both.  It appears to me
that the three uses of INSTANTIATE_SPARSE_SORT can be removed.  That's
essentially what you did when you commented out the body of the macro
as you described in an earlier message:

| Another test I did was that I made the INSTANTIATE_SPARSE_SORT(T) macro empty, 
| ie. instead of
| 
|    #define INSTANTIATE_SPARSE_SORT(T) \
|      template class octave_sort<T>; \
|      template class vec_index<T>; \
|      template class octave_sort<vec_index<T> *>;
| 
| I did
| 
|    #define INSTANTIATE_SPARSE_SORT(T) \
|      /*empty*/
| 
| which solves some of the conflicts (but not all). To solve all of the conflicts 
| I had to comment out more lines (cf. attached sparse-problem.diff). Now the most 
| latest snapshot at least compiles (but I think commenting out these lines is not 
| the solution, or is it?) without the '-Xlinker -m' option but produces an Octave 

You also wrote that you needed:

| diff -r 85be2610d6e3 liboctave/Array-so.cc
| --- a/liboctave/Array-so.cc	Tue Feb 12 03:09:44 2008 -0500
| +++ b/liboctave/Array-so.cc	Tue Feb 12 10:56:19 2008 +0100
| @@ -29,7 +29,7 @@ along with Octave; see the file COPYING.
|  #include "Array.h"
|  #include "Array.cc"
|  
| -INSTANTIATE_ARRAY_AND_ASSIGN (std::streamoff, OCTAVE_API);
| +// INSTANTIATE_ARRAY_AND_ASSIGN (std::streamoff, OCTAVE_API);
|  
|  #include "Array2.h"
|  
| diff -r 85be2610d6e3 liboctave/Sparse.h
| --- a/liboctave/Sparse.h	Tue Feb 12 03:09:44 2008 -0500
| +++ b/liboctave/Sparse.h	Tue Feb 12 10:56:19 2008 +0100
| @@ -547,9 +547,7 @@ assign1 (Sparse<LT>& lhs, const Sparse<R
|    INSTANTIATE_SPARSE_ASSIGN (T, T, API)
|  
|  #define INSTANTIATE_SPARSE_SORT(T) \
| -  template class octave_sort<T>; \
| -  template class vec_index<T>; \
| -  template class octave_sort<vec_index<T> *>;
| +  /* empty */
|  
|  #endif
|  
| diff -r 85be2610d6e3 liboctave/sparse-sort.cc
| --- a/liboctave/sparse-sort.cc	Tue Feb 12 03:09:44 2008 -0500
| +++ b/liboctave/sparse-sort.cc	Tue Feb 12 10:56:19 2008 +0100
| @@ -62,10 +62,10 @@ octave_idx_vector_comp (octave_idx_vecto
|  }
|  
|  // Instantiate the sparse index sorting class
| -template class octave_sort<octave_idx_vector_sort *>;
| +//template class octave_sort<octave_idx_vector_sort *>;
|  
|  // Instantiate the sorting class of octave_idx_type, need in MUL macro
| -template class octave_sort<octave_idx_type>;
| +//template class octave_sort<octave_idx_type>;
|  
|  /*
|  ;;; Local Variables: ***

Hmm.  I don't think the explicit instantiations in this file should
actually be needed.  I committed the following change.  If you update,
does it work now, or do you still see multiple definitions for some
symbols?

Thanks,

jwe


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080212/0699b82e/attachment.ksh 


More information about the Octave-maintainers mailing list