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: Thomas Treichl
Subject: Re: CVS build error with new sort
Date: Wed, 02 Apr 2008 18:53:16 +0200
User-agent: Thunderbird 2.0.0.12 (Macintosh/20080213)

John W. Eaton schrieb:
On 12-Feb-2008, John Swensen wrote:
| On Feb 12, 2008, at 3:45 PM, John W. Eaton wrote:
| > 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
| | That fixed some of them. I don't get the same error now, but I still | get a linker error when linking liboctave.dylib | | ld: duplicate symbol Array<long long>::ArrayRep::length() constin pic/ | Array-so.o and pic/Array-i.o | | I didn't include the nm output, grepping for ArrayRep, because it is | very, very long. | | Let me know if seeing it will help you figure out where this one is | doubly-defined.

My guess is that this happens because on your system, std::streamoff
is a typedef for "long long int".  You can probably avoid the problem
by commenting out the line

  INSTANTIATE_ARRAY_AND_ASSIGN (std::streamoff, OCTAVE_API);

in liboctave/Array-so.cc.

If it is a typedef problem, then how can we detect automatically at
configure time so we can avoid the bug?

BTW, I think this doesn't happen on my system because template
instantiations produce "weak" symbols.  If there are multiple weak
symbols with the same name, the linker then uses only one and doesn't
issue the error message you see.

Some time has been passed on this thread but the problem still follows me on MacOSX. You have been right with std::streamoff==long long int. I also tried to use several variations of -weak options for the linker but has not been successful.

So I gave it a try to write a configure test for it. Can somebody please have a look at it and tell me if this would be the right way to do it (can the AC_CHECK_TYPES for std::streamoff be neglected)? If so then I can prepare a changeset for the current sources the following days. My idea was then to change

  liboctave/Array-i.cc:#if defined (HAVE_LONG_LONG_INT)

into

  liboctave/Array-i.cc:#if defined (HAVE_LONG_LONG_INT) &&
    !defined (HAVE_LONG_LONG_INT_STREAMOFF)

Thomas
dnl 
dnl Check to see if 'std::streamoff' has the same size than 
dnl 'long long int'
dnl
AC_DEFUN([OCTAVE_CHECK_STREAMOFF],[
AC_LANG_PUSH([C++])
AC_CHECK_TYPES([std::streamoff],[
  AC_MSG_CHECKING([whether streamoff is long long int])
  AC_CACHE_VAL([octave_cv_streamoff],[
    AC_TRY_RUN([
      // This small program checks if streamoff has the same size than
      // "long long int".  If true then return 0 (success), otherwise
      // return failure number 1.
      #include <iosfwd>
      int main (int argc, char *argv[])
      {
        if (sizeof (std::streamoff) == sizeof (long long int))
          return (0);
        else
          return (1);
      }
      
],[octave_cv_streamoff=yes],[octave_cv_streamoff=no],[octave_cv_streamoff=no]
    ) # AC_TRY_RUN
  ]) # AC_CACHE_VAL
  AC_MSG_RESULT([$octave_cv_streamoff])
  if test x$octave_cv_streamoff = xyes
  then
    AC_DEFINE(HAVE_LONG_LONG_INT_STREAMOFF, 1,
      [Define to 1 if streamoff is long long int.])
  fi
],[],[#include <iosfwd>]) # AC_CHECK_TYPES
]) # end of AC_DEFUN OCTAVE_CHECK_STREAMOFF
all:
        aclocal && autoheader && autoconf && ./configure

clean:
        rm -rf *~ autom4te.cache config.h.in config.log config.status configure
AC_INIT([STREAMOFF], [1.0], [])
AC_CONFIG_HEADER(config.h)
OCTAVE_CHECK_STREAMOFF
AC_OUTPUT

reply via email to

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