octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CVS build error with new sort


From: John W. Eaton
Subject: Re: CVS build error with new sort
Date: Tue, 12 Feb 2008 15:45:52 -0500

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


# HG changeset patch
# User John W. Eaton <address@hidden>
# Date 1202849082 18000
# Node ID ada435261879e0ce135e2468ade51f3aca8e1270
# Parent  360b4f7684fdc62ab6647aec762235755f962e43
eliminate unnecessary explicit template instantiations

diff -r 360b4f7684fd -r ada435261879 liboctave/ChangeLog
--- a/liboctave/ChangeLog       Tue Feb 12 03:15:49 2008 -0500
+++ b/liboctave/ChangeLog       Tue Feb 12 15:44:42 2008 -0500
@@ -1,4 +1,12 @@ 2008-02-12  John W. Eaton  <address@hidden
 2008-02-12  John W. Eaton  <address@hidden>
+
+       * sparse-sort.cc: Don't explicitly instantiate
+       class octave_sort<octave_idx_vector_sort *>,
+       class octave_sort<octave_idx_type>, or
+       class octave_sort<octave_sparse_sort_idxl *>.
+
+       * Sparse.h (INSTANTIATE_SPARSE_SORT): Delete macro.
+       * Sparse-C.cc, Sparse-b.cc, Sparse-d.cc: Don't use it.
 
        * Range.cc (Range::sort_internal): Avoid shadow warning from gcc.
 
diff -r 360b4f7684fd -r ada435261879 liboctave/Sparse-C.cc
--- a/liboctave/Sparse-C.cc     Tue Feb 12 03:15:49 2008 -0500
+++ b/liboctave/Sparse-C.cc     Tue Feb 12 15:44:42 2008 -0500
@@ -91,8 +91,6 @@ sparse_descending_compare (vec_index<Com
              && (arg (a->vec) > arg (b->vec))));
 }
 
-INSTANTIATE_SPARSE_SORT (Complex);
-
 INSTANTIATE_SPARSE_AND_ASSIGN (Complex, OCTAVE_API);
 
 INSTANTIATE_SPARSE_ASSIGN (Complex, double, OCTAVE_API);
diff -r 360b4f7684fd -r ada435261879 liboctave/Sparse-b.cc
--- a/liboctave/Sparse-b.cc     Tue Feb 12 03:15:49 2008 -0500
+++ b/liboctave/Sparse-b.cc     Tue Feb 12 15:44:42 2008 -0500
@@ -31,8 +31,6 @@ along with Octave; see the file COPYING.
 #include "Sparse.cc"
 #include "oct-sort.cc"
 
-INSTANTIATE_SPARSE_SORT (bool);
-
 INSTANTIATE_SPARSE_AND_ASSIGN (bool, OCTAVE_API);
 
 #if 0
diff -r 360b4f7684fd -r ada435261879 liboctave/Sparse-d.cc
--- a/liboctave/Sparse-d.cc     Tue Feb 12 03:15:49 2008 -0500
+++ b/liboctave/Sparse-d.cc     Tue Feb 12 15:44:42 2008 -0500
@@ -60,8 +60,6 @@ sparse_descending_compare (vec_index<dou
   return (xisnan (b->vec) || (a->vec > b->vec));
 }
 
-INSTANTIATE_SPARSE_SORT (double);
-
 INSTANTIATE_SPARSE_AND_ASSIGN (double, OCTAVE_API);
 
 #if 0
diff -r 360b4f7684fd -r ada435261879 liboctave/Sparse.h
--- a/liboctave/Sparse.h        Tue Feb 12 03:15:49 2008 -0500
+++ b/liboctave/Sparse.h        Tue Feb 12 15:44:42 2008 -0500
@@ -546,11 +546,6 @@ assign1 (Sparse<LT>& lhs, const Sparse<R
   INSTANTIATE_SPARSE (T, API); \
   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> *>;
-
 #endif
 
 /*
diff -r 360b4f7684fd -r ada435261879 liboctave/sparse-sort.cc
--- a/liboctave/sparse-sort.cc  Tue Feb 12 03:15:49 2008 -0500
+++ b/liboctave/sparse-sort.cc  Tue Feb 12 15:44:42 2008 -0500
@@ -49,9 +49,6 @@ octave_sparse_sidxl_comp (octave_sparse_
   return  (i->r < j->r);
 }
 
-// Instantiate the sparse sorting class
-template class octave_sort<octave_sparse_sort_idxl *>;
-
 // Need to know the original order of the sorted indexes in
 // sparse assignments, and this class does that
 bool
@@ -61,12 +58,6 @@ octave_idx_vector_comp (octave_idx_vecto
   return (i->i < j->i);
 }
 
-// Instantiate the sparse index sorting class
-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>;
-
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***

reply via email to

[Prev in Thread] Current Thread [Next in Thread]