help-octave
[Top][All Lists]
Advanced

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

Fwd: Status of MacOS X Porting?


From: Per Persson
Subject: Fwd: Status of MacOS X Porting?
Date: Thu, 17 May 2001 12:17:14 +0200

Hi,
unfortunately I dont't have the time to work actively on this at the moment, but I'll be happy to help out as much as I can. (I'm not a C++ programmer, so my suggestions may be those of fool;-)

Anyways, from what I know of Apples current compiler, this construct is evil (the 'static T foo;' part):

From Liboctave/Array.cc:
------------------------
template <class T>
T&
Array<T>::range_error (const char *fcn, int n)
{
  (*current_liboctave_error_handler) ("%s (%d): range error", fcn, n);
  static T foo;
  return foo;
}

cf. this comment from the OpenOffice porting project:
As the Mac OS X C++ compiler behaves somewhat differently from GCC compilers for other platforms, the static datat members in template classes, if not explicitly initialized, will cause undefined symbols at link time. For example:


template <abc>
class ImplHelper: public ImplHelperBase<abc>
{
    static ClassData s_aCD;
    ...
}


Each instantiation of s_aCD needs to be explicitly initialized once and only once somewhere. Note that it can only be instantiated once or you will get duplicate symbol errors that will crash an executable at runtime.

A quick scan of the sources reveals
[localhost:~/source/octave] ppe% grep -r 'static T' *
liboctave/Array.cc:  static T foo;
liboctave/Array2.cc:  static T foo;
liboctave/Array3.h:       static T foo;
liboctave/ArrayN.cc:  static T foo;
liboctave/DiagArray2.cc:  static T foo (0);
liboctave/DiagArray2.cc:  static T foo (0);
liboctave/DiagArray2.cc:  static T foo (0);
liboctave/DiagArray2.cc:  static T foo (0);
liboctave/DiagArray2.h:     static T foo (0);

These occurrances coincide fairly well with the undefined symbols that you get.

OK, just my 2 cents....

/Per


From: "Matt Pfenninger" <address@hidden>
Date: tor maj 17, 2001  01:34:32  Europe/Paris
To: <address@hidden>
Cc: "Per Persson" <address@hidden>, "Mumit Khan" <address@hidden>
Subject: RE: Status of MacOS X Porting?

Hmmm...

From Per Persson's suggestion, I tried all four permutations
of -fno-implicit-templates and -fno-coalesce with varying amounts of no luck
(contact me if you want to look at the makefile logs).  So much for the
simple fixes.

The demangled version of the appropriate section of the make log is as
follows:

c++ -I. -I.. -I../liboctave -I../src -I../libcruft/misc -I../glob -I../glo
b -DHAVE_CONFIG_H -fno-implicit-templates -g -O2 -Wall  \
-L..   -fPIC -g -o octave \
octave.o builtins.o ops.o ../libcruft/blas-xtra/xerbla.o  balance.o
besselj.o betainc.o chol.o colloc.o dassl.o det.o eig.o expm.o fft.o
fft2.o  filter.o  find.o  fsolve.o  gammainc.o  getgrent.o  getpwent.o
getrusage.o  givens.o  hess.o  ifft.o  ifft2.o  inv.o  log.o  lpsolve.o
lsode.o lu.o minmax.o pinv.o qr.o quad.o qz.o rand.o schur.o sort.o
svd.o  syl.o  time.o \
-L../liboctave -L../libcruft -L../src  \
../src/liboctinterp.a ../liboctave/liboctave.a  ../libcruft/libcruft.a
../kpathsea/libkpathsea.a ../glob/glob.o ../glob/fnmatch.o  \
 -lf77blas -lcblas -latlas  -lreadline  -lncurses -lm  -lf2c

/usr/bin/ld: Undefined symbols:
Array<octave_value>::~Array(void)
Array<double>::~Array(void)
Array<basic_string<char, string_char_traits<char>,
__default_alloc_template<false, 0> > >::~Array(void)
Array<complex<double> >::~Array(void)
Array<double>::operator=(Array<double> const &)
Array<complex<double> >::operator=(Array<complex<double> > const &)
Array<octave_value>::Array(int, octave_value const &)
Array<double>::fortran_vec(void)
Array<complex<double> >::fortran_vec(void)
Array2<double>::get_size(int, int) const
Array2<double>::transpose(void) const
Array<int>::~Array(void)
Array<octave_value>::operator=(Array<octave_value> const &)
Array<octave_value>::resize(int)
Array<double>::Array(int, double const &)
Array2<double>::resize(int, int, double const &)
Array2<complex<double> >::resize(int, int, complex<double> const &)
MArray<double> operator/<double>(MArray<double> const &, double const &)
MArray<complex<double> > operator/<complex<double> >(MArray<complex<double>
const &, complex<double> const &)
MArray<double> operator*<double>(double const &, MArray<double> const &)
MArray<complex<double> > operator*<complex<double> >(complex<double> const
&, MArray<complex<double> > const &)
Array<complex<double> >::Array(int, complex<double> const &)
Array<double>::resize(int, double const &)
Array<complex<double> >::resize(int, complex<double> const &)
Array2<complex<double> >::get_size(int, int) const
Array<int>::fortran_vec(void)
Array<octave_value>::resize(int, octave_value const &)
___as__t5Array1Zt12basic_string3ZcZt18string_char_traits1ZcZt24__default_all
oc_template2b0i0RCB0
Array<bool>::~Array(void)
Array<char>::~Array(void)
Array<double>::resize(int)
Array<complex<double> >::resize(int)
Array<basic_string<char, string_char_traits<char>,
__default_alloc_template<false, 0> > >::Array(int, basic_string<char,
string_char_traits<char>, __default_alloc_template<false, 0> > const &)
Array<basic_string<char, string_char_traits<char>,
__default_alloc_template<false, 0> > >::resize(int, basic_string<char,
string_char_traits<char>, __default_alloc_template<false, 0> > const &)
Array<basic_string<char, string_char_traits<char>,
__default_alloc_template<false, 0> > >::resize(int)
Array<octave_value>::index(idx_vector &) const
Array<octave_child>::resize(int)
Array2<octave_value>::get_size(int, int) const
Array<symbol_record *>::~Array(void)
Array<symbol_record *>::operator=(Array<symbol_record *> const &)
Array2<char>::get_size(int, int) const
Array2<char>::resize(int, int, char const &)
Array2<double>::resize(int, int)
Array2<complex<double> >::resize(int, int)
Array2<complex<double> >::transpose(void) const
Array<int>::Array(int, int const &)
Array2<int>::get_size(int, int) const
Array2<int>::range_error(char const *, int, int)
Array2<int>::resize(int, int, int const &)
Array<symbol_record *>::resize(int)
Array2<bool>::transpose(void) const
MArray2<complex<double> > & operator-=<complex<double>
(MArray2<complex<double> > &, complex<double> const &)
MArray2<complex<double> > & operator+=<complex<double>
(MArray2<complex<double> > &, complex<double> const &)
MArray2<complex<double> > operator-<complex<double>
(MArray2<complex<double> > const &)
MArray2<complex<double> > operator-<complex<double>
(MArray2<complex<double> > const &, MArray2<complex<double> > const &)
MArray2<complex<double> > operator+<complex<double>
(MArray2<complex<double> > const &, MArray2<complex<double> > const &)
MArray2<complex<double> > product<complex<double> >(MArray2<complex<double>
const &, MArray2<complex<double> > const &)
MArray2<complex<double> > quotient<complex<double> >(MArray2<complex<double>
const &, MArray2<complex<double> > const &)
MArray2<complex<double> > operator/<complex<double>
(MArray2<complex<double> > const &, complex<double> const &)
MArray2<complex<double> > operator-<complex<double>
(MArray2<complex<double> > const &, complex<double> const &)
MArray2<complex<double> > operator*<complex<double>
(MArray2<complex<double> > const &, complex<double> const &)
MArray2<complex<double> > operator+<complex<double>
(MArray2<complex<double> > const &, complex<double> const &)
MArray2<complex<double> > operator-<complex<double> >(complex<double> const
&, MArray2<complex<double> > const &)
MArray2<complex<double> > operator*<complex<double> >(complex<double> const
&, MArray2<complex<double> > const &)
MArray2<complex<double> > operator+<complex<double> >(complex<double> const
&, MArray2<complex<double> > const &)
MArray2<double> & operator-=<double>(MArray2<double> &, double const &)
MArray2<double> & operator+=<double>(MArray2<double> &, double const &)
MArray2<double> operator-<double>(MArray2<double> const &)
MArray2<double> operator-<double>(MArray2<double> const &, MArray2<double>
const &)
MArray2<double> operator+<double>(MArray2<double> const &, MArray2<double>
const &)
MArray2<double> product<double>(MArray2<double> const &, MArray2<double>
const &)
MArray2<double> quotient<double>(MArray2<double> const &, MArray2<double>
const &)
MArray2<double> operator/<double>(MArray2<double> const &, double const &) MArray2<double> operator-<double>(MArray2<double> const &, double const &) MArray2<double> operator*<double>(MArray2<double> const &, double const &) MArray2<double> operator+<double>(MArray2<double> const &, double const &) MArray2<double> operator-<double>(double const &, MArray2<double> const &) MArray2<double> operator*<double>(double const &, MArray2<double> const &) MArray2<double> operator+<double>(double const &, MArray2<double> const &)
Array2<bool>::get_size(int, int) const
Array2<char>::transpose(void) const
Array<bool>::Array(int, bool const &)
int assign<double, double>(Array2<double> &, Array2<double> const &)
Array2<double>::index(idx_vector &) const
Array2<double>::index(idx_vector &, idx_vector &) const
Array<double>::set_index(idx_vector const &)
int assign<bool, bool>(Array2<bool> &, Array2<bool> const &)
Array2<bool>::index(idx_vector &) const
Array2<bool>::index(idx_vector &, idx_vector &) const
Array<bool>::set_index(idx_vector const &)
Array2<char>::index(idx_vector &) const
Array2<char>::index(idx_vector &, idx_vector &) const
int assign<complex<double>, complex<double> >(Array2<complex<double> > &,
Array2<complex<double> > const &)
int assign<complex<double>, double>(Array2<complex<double> > &,
Array2<double> const &)
Array2<complex<double> >::index(idx_vector &) const
Array2<complex<double> >::index(idx_vector &, idx_vector &) const
Array<complex<double> >::set_index(idx_vector const &)
int assign<char, char>(Array2<char> &, Array2<char> const &)
Array2<char>::resize(int, int)
Array<char>::set_index(idx_vector const &)
Array<scanf_format_elt *>::~Array(void)
Array<printf_format_elt *>::~Array(void)
Array<octave_stream>::resize(int)
Array<scanf_format_elt *>::resize(int)
Array<printf_format_elt *>::resize(int)
Array2<octave_value>::index(idx_vector &) const
Array2<octave_value>::index(idx_vector &, idx_vector &) const
MArray2<complex<double> > & operator-=<complex<double>
(MArray2<complex<double> > &, MArray2<complex<double> > const &)
MArray2<complex<double> > & operator+=<complex<double>
(MArray2<complex<double> > &, MArray2<complex<double> > const &)
Array<bool>::operator=(Array<bool> const &)
MArray2<complex<double> > operator/<complex<double> >(complex<double> const
&, MArray2<complex<double> > const &)
MArray2<complex<double> > operator+<complex<double>
(MArray2<complex<double> > const &)
DiagArray2<double>::elem(int, int) const
DiagArray2<complex<double> >::elem(int, int) const
Array2<complex<double> >::insert(Array2<complex<double> > const &, int, int)
Array<int>::resize(int)
Array2<bool>::resize(int, int)
Array2<int>::resize(int, int)
MArray2<double> & operator-=<double>(MArray2<double> &, MArray2<double>
const &)
MArray2<double> & operator+=<double>(MArray2<double> &, MArray2<double>
const &)
MArray2<double> operator/<double>(double const &, MArray2<double> const &)
MArray2<double> operator+<double>(MArray2<double> const &)
Array2<double>::insert(Array2<double> const &, int, int)
MArray<double> & operator-=<double>(MArray<double> &, MArray<double> const
&)
MArray<double> & operator-=<double>(MArray<double> &, double const &)
MArray<double> & operator+=<double>(MArray<double> &, MArray<double> const
&)
MArray<double> & operator+=<double>(MArray<double> &, double const &)
MArray<double> operator/<double>(double const &, MArray<double> const &)
MArray<double> operator-<double>(double const &, MArray<double> const &)
MArray<double> operator-<double>(MArray<double> const &, double const &)
MArray<double> operator-<double>(MArray<double> const &)
MArray<double> operator-<double>(MArray<double> const &, MArray<double>
const &)
MArray<double> operator*<double>(MArray<double> const &, double const &)
MArray<double> operator+<double>(double const &, MArray<double> const &)
MArray<double> operator+<double>(MArray<double> const &, double const &)
MArray<double> operator+<double>(MArray<double> const &)
MArray<double> operator+<double>(MArray<double> const &, MArray<double>
const &)
MArray<double> product<double>(MArray<double> const &, MArray<double> const
&)
MArray<double> quotient<double>(MArray<double> const &, MArray<double> const
&)
MArray<complex<double> > & operator-=<complex<double>
(MArray<complex<double> > &, MArray<complex<double> > const &)
MArray<complex<double> > & operator-=<complex<double>
(MArray<complex<double> > &, complex<double> const &)
MArray<complex<double> > & operator+=<complex<double>
(MArray<complex<double> > &, MArray<complex<double> > const &)
MArray<complex<double> > & operator+=<complex<double>
(MArray<complex<double> > &, complex<double> const &)
MArray<complex<double> > operator/<complex<double> >(complex<double> const
&, MArray<complex<double> > const &)
MArray<complex<double> > operator-<complex<double> >(complex<double> const
&, MArray<complex<double> > const &)
MArray<complex<double> > operator-<complex<double> >(MArray<complex<double>
const &, complex<double> const &)
MArray<complex<double> > operator-<complex<double> >(MArray<complex<double>
const &)
MArray<complex<double> > operator-<complex<double> >(MArray<complex<double>
const &, MArray<complex<double> > const &)
MArray<complex<double> > operator*<complex<double> >(MArray<complex<double>
const &, complex<double> const &)
MArray<complex<double> > operator+<complex<double> >(complex<double> const
&, MArray<complex<double> > const &)
MArray<complex<double> > operator+<complex<double> >(MArray<complex<double>
const &, complex<double> const &)
MArray<complex<double> > operator+<complex<double> >(MArray<complex<double>
const &)
MArray<complex<double> > operator+<complex<double> >(MArray<complex<double>
const &, MArray<complex<double> > const &)
MArray<complex<double> > product<complex<double> >(MArray<complex<double> >
const &, MArray<complex<double> > const &)
MArray<complex<double> > quotient<complex<double> >(MArray<complex<double> >
const &, MArray<complex<double> > const &)
MArray<int> & operator-=<int>(MArray<int> &, int const &)
Array<int>::operator=(Array<int> const &)
MDiagArray2<double> & operator-=<double>(MDiagArray2<double> &,
MDiagArray2<double> const &)
MDiagArray2<double> & operator+=<double>(MDiagArray2<double> &,
MDiagArray2<double> const &)
MDiagArray2<double> operator/<double>(MDiagArray2<double> const &, double
const &)
MDiagArray2<double> operator-<double>(MDiagArray2<double> const &)
MDiagArray2<double> operator-<double>(MDiagArray2<double> const &,
MDiagArray2<double> const &)
MDiagArray2<double> operator*<double>(double const &, MDiagArray2<double>
const &)
MDiagArray2<double> operator*<double>(MDiagArray2<double> const &, double
const &)
MDiagArray2<double> operator+<double>(MDiagArray2<double> const &)
MDiagArray2<double> operator+<double>(MDiagArray2<double> const &,
MDiagArray2<double> const &)
MDiagArray2<double> product<double>(MDiagArray2<double> const &,
MDiagArray2<double> const &)
DiagArray2<double>::resize(int, int)
Array<char>::operator=(Array<char> const &)
Array<char>::Array(int, char const &)
Array2<char>::insert(Array2<char> const &, int, int)
Array2<bool>::insert(Array2<bool> const &, int, int)
make[2]: *** [octave] Error 1
make[1]: *** [src] Error 2
make: *** [all] Error 2


It looks like every function missing from the link is an Array* template
function. A quick otool check of liboctave.a confirms that these functions are getting omitted from the library. Shouldn't these functions get created from the templates the first time each specialization is instantiated (in
Array-*.cc)?  How can I check the .o files for imports & exports?

When I've worked with templates before (infrequently, mind you, and on a
different platform), I've always placed them in header files which were
included in each file which specialized/used the template. Any other ideas
before I start down that slippery path?

- Matt




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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