Wed 22 May 2013 09:54:55 AM UTC, comment #5:
Some additional notes for replicating the problem on Debian sid (unstable).
You need to install package g++-4.8. Then the example given by Clemens has to be compiled with:
I get a compilation failure with Octave 3.6.4 (did not try with devel branch). If I do not set CXX=g++-4.8, then it uses GCC 4.7 (current default on Debian sid), and the program compiles.
|
Tue 21 May 2013 09:36:40 PM UTC, comment #4:
Below is a simple testcase with revision 16692:c19cc8c158b3 (this Saturday).
I get the same output with this:
I am attaching mex_empty.ii and mex_empty.s from that command. I am also attaching /usr/include/c++/4.8.0/cstdlib.
GCC Sources:
_snapshot=4.8-20130502
source=(ftp://gcc.gnu.org/pub/gcc/snapshots/${_snapshot}/gcc-${_snapshot}.tar.bz2)
On my system GCC is built without patches, with the following flags:
CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
# using -pipe causes spurious test-suite failures
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
CFLAGS=${CFLAGS/-pipe/}
CXXFLAGS=${CXXFLAGS/-pipe/}
${srcdir}/${_basedir}/configure --prefix=/usr \
--libdir=/usr/lib --libexecdir=/usr/lib \
--mandir=/usr/share/man --infodir=/usr/share/info \
--with-bugurl=https://bugs.archlinux.org/ \
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ \
--enable-shared --enable-threads=posix \
--with-system-zlib --enable-__cxa_atexit \
--disable-libunwind-exceptions --enable-clocale=gnu \
--disable-libstdcxx-pch \
--enable-gnu-unique-object --enable-linker-build-id \
--enable-cloog-backend=isl --disable-cloog-version-check \
--enable-lto --enable-gold --enable-ld=default \
--enable-plugin --with-plugin-ld=ld.gold \
--with-linker-hash-style=gnu --disable-install-libiberty \
--disable-multilib --disable-libssp --disable-werror \
--enable-checking=release
make
(file #28132, file #28133, file #28134)
|
Sat 04 May 2013 04:32:01 PM UTC, comment #1:
The patch below fixes the issue for me. Instead of disallowing mexproto.h to be included from extern "C" context, I think it is more appropriate instead not to include C++ header files such as cstdlib in a header file which declares only C functions. I am not sure what the motivation was for doing so, but for the record, there are two more files with similar constructs of the form #ifdef __cpluslus #include <cheader> extern "C" { #else <header.h> #include #endif:
libinterp/interp-core/cutils.h
liboctave/cruft/misc/quit.h
I did not touch those to keep the change minimal.
---
diff -r a1f613e5066d libinterp/interp-core/mexproto.h
--- a/libinterp/interp-core/mexproto.h Sat May 04 09:37:28 2013 +0200
+++ b/libinterp/interp-core/mexproto.h Sat May 04 16:37:00 2013 +0200
@@ -49,11 +49,10 @@
#define MEXPROTO_H
#if defined (__cplusplus)
-#include <cstdlib>
extern "C" {
-#else
+#endif
+
#include <stdlib.h>
-#endif
/* The definition of OCTINTERP_API is normally provided by Octave's
config.h file. This is provided for the case of mex.h included by
|
Mon 15 Apr 2013 03:45:37 PM UTC, original submission:
This is Debian bug #705485 (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705485)
When including mex.h from a C++ source file, and compiling with G++ 4.8, the compilation crashes.
The root of the problem is that mex.h includes mexproto.h within an extern "C" block. In turn, mexproto.h includes cstdlib.
Apparently, including cstdlib within an extern "C" block was working with G++ 4.7, but this is no longer the case.
The fix is to include mexproto.h outside of the extern "C" block.
|