help-octave
[Top][All Lists]
Advanced

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

install problems - RH 8, octave-2.1.36, gcc 3.2


From: John W. Eaton
Subject: install problems - RH 8, octave-2.1.36, gcc 3.2
Date: Thu, 17 Oct 2002 23:09:23 -0500

On 17-Oct-2002, Richard Morey <address@hidden> wrote:

| I am trying to install octave 2.1.36 on a redhat 8.0 system with gcc
| 3.2. It configures fine, but when I run make it exits with the following
| error:
| 
| g++ -c  -I. -I.. -I../liboctave -I../src -I../libcruft/misc  -I../glob
| -I../glob -DHAVE_CONFIG_H -mieee-fp -g -O2 -Wall c-file-ptr-stream.cc -o
| c-file-ptr-stream.o
| In file included from c-file-ptr-stream.cc:31:
| c-file-ptr-stream.h: In constructor
| `c_file_ptr_buf::c_file_ptr_buf(FILE*, int
|    (*)(FILE*))':
| c-file-ptr-stream.h:56: no matching function for call to `
|    std::basic_filebuf<char, std::char_traits<char>
| >::basic_filebuf(FILE*&,
|    std::_Ios_Openmode)'
| /usr/include/c++/3.2/iosfwd:83: candidates are: std::basic_filebuf<char,
|    std::char_traits<char> >::basic_filebuf(const
| std::basic_filebuf<char,
|    std::char_traits<char> >&)
| /usr/include/c++/3.2/fstream:99:                
| std::basic_filebuf<_CharT,
|    _Traits>::basic_filebuf() [with _CharT = char, _Traits =
|    std::char_traits<char>]
| make[2]: *** [c-file-ptr-stream.o] Error 1
| make[2]: Leaving directory `/home/morey/octave-2.1.36/src'
| make[1]: *** [src] Error 2
| make[1]: Leaving directory `/home/morey/octave-2.1.36'
| make: *** [all] Error 2
| 
| 
| I saw this error in a previous post,
| http://www.octave.org/mailing-lists/help-octave/2002/609
| but the solution, editing config.h, was unnecessary because the config.h
| was already in the state which the poster suggested.

Try the patch below, or use the CVS version.

| Also, I tried getting the CVS version, but there was no configure script
| with it! Is that normal? I am new to the CVS thing.

Yes.  Since the configure script is generated automatically, there is
no reason to have it in the CVS archive.  You need to run the
autogen.sh script first, then run configure and make.  You'll need
autoconf 2.5x.  You'll also need gperf, flex, and bison to complete
the build.

jwe


--- c-file-ptr-stream.h 2001-11-01 23:12:00.000000000 -0600
+++ ../../src/octave/src/c-file-ptr-stream.h    2002-09-27 13:00:01.000000000 
-0500
@@ -31,25 +31,50 @@
 #include <fstream>
 #include <cstdio>
 
+// The c_file_ptr_buf requires a std::filebuf that accepts an open
+// file descriptor. This feature, while not part of the ISO C++
+// standard, is supported by a variety of C++ compiler runtimes,
+// albeit in slightly different ways.
+//
+// The C++ runtime libraries shipped with GCC versions < 3.0, Sun Pro,
+// Sun Workshop/Forte 5/6, Compaq C++ all support a non-standard filebuf
+// constructor that takes an open file descriptor. The almost ISO compliant
+// GNU C++ runtime shipped with GCC 3.0.x supports a different non-standard
+// filebuf constructor that takes a FILE* instead; starting from GCC 3.1,
+// the GNU C++ runtime removes all non-standard std::filebuf constructors
+// and provides an extension template class __gnu_cxx::stdio_filebuf
+// that supports the the 3.0.x behavior.
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) && ! (defined 
(__APPLE__) && defined (__MACH__))
+# include <ext/stdio_filebuf.h>
+# define OCTAVE_STD_FILEBUF __gnu_cxx::stdio_filebuf<char>
+#else
+# define OCTAVE_STD_FILEBUF std::filebuf
+#endif
+
 class
-c_file_ptr_buf : public std::filebuf
+c_file_ptr_buf : public OCTAVE_STD_FILEBUF
 {
 public:
 
 #if !defined (CXX_ISO_COMPLIANT_LIBRARY)
   typedef int int_type;
+#else
+  typedef std::filebuf::int_type int_type;
 #endif
 
   typedef int (*close_fcn) (FILE *);
 
   FILE* stdiofile (void) const { return f; }
 
-  c_file_ptr_buf (FILE *f_arg, close_fcn cf_arg = ::fclose)
+  c_file_ptr_buf (FILE *f_arg, close_fcn cf_arg = fclose)
     : 
 #if defined __GNUC__ && __GNUC__ >= 3
-    std::filebuf (f_arg, std::ios::in | std::ios::out),
+    OCTAVE_STD_FILEBUF (f_arg, std::ios::in | std::ios::out),
+#elif defined __INTEL_COMPILER
+    OCTAVE_STD_FILEBUF (f_arg),
 #else
-    std::filebuf (f_arg ? fileno (f_arg) : -1),
+    OCTAVE_STD_FILEBUF (f_arg ? fileno (f_arg) : -1),
 #endif
     f (f_arg), cf (cf_arg),
     fd (f_arg ? fileno (f_arg) : -1)
@@ -83,6 +108,8 @@
 
   int file_number () const { return fd; }
 
+  static int fclose (FILE *f) { return ::fclose (f); }
+
 protected:
 
   FILE *f;
@@ -94,12 +121,15 @@
   int fd;
 };
 
+#undef OCTAVE_STD_FILEBUF
+
 class
 i_c_file_ptr_stream : public std::istream
 {
 public:
 
-  i_c_file_ptr_stream (FILE* f, c_file_ptr_buf::close_fcn cf = ::fclose)
+  i_c_file_ptr_stream (FILE* f,
+                      c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::fclose)
     : std::istream (0), buf (new c_file_ptr_buf (f, cf)) { init (buf); }
 
   ~i_c_file_ptr_stream (void) { delete buf; buf = 0; }
@@ -118,7 +148,8 @@
 {
 public:
 
-  o_c_file_ptr_stream (FILE* f, c_file_ptr_buf::close_fcn cf = ::fclose)
+  o_c_file_ptr_stream (FILE* f,
+                      c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::fclose)
     : std::ostream (0), buf (new c_file_ptr_buf (f, cf)) { init (buf); }
 
   ~o_c_file_ptr_stream (void) { delete buf; buf = 0; }



-------------------------------------------------------------
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]