tech-pkg archive

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

gcc 4.6.1, solaris and c99



Hi guys,

I've been trying to jumpstart GCC 4.6.1 today, to start building 2011Q3, and 
I've hit an annoying issue. I first tried my own modular GCC package, then 
confirmed the same with lang/gcc46. The problem shows up with devel/ncurses, 
but really anything that defines _XOPEN_SOURCE=500 or less could be affected:

/tmp/pkgsrc/devel/ncurses/work/.wrapper/bin/libtool --tag=CXX --mode=compile 
/tmp/pkgsrc/devel/ncurses/work/.wrapper/bin/g++ -I../c++ -I../include -I. 
-DHAVE_CONFIG_H -I. -I../include   -D_XOPEN_SOURCE=500 -D_FILE_OFFSET_BITS=64  
-DNDEBUG -I/opt/local/include/ncurses -O -O2 -c ../c++/cursesf.cc -o 
../obj_lo/cursesf.lo
libtool: compile:  /tmp/pkgsrc/devel/ncurses/work/.wrapper/bin/g++ -I../c++ 
-I../include -I. -DHAVE_CONFIG_H -D_XOPEN_SOURCE=500 -D_FILE_OFFSET_BITS=64 
-DNDEBUG -I/tmp/pkgsrc/devel/ncurses/work/.buildlink/include/ncurses -O -O2 -c 
../c++/cursesf.cc  -KPIC -DPIC -o ../obj_lo/.libs/cursesf.o
<command-line>:0:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
<built-in>:0:0: note: this is the location of the previous definition
In file included from /usr/include/iso/stdlib_iso.h:48:0,
                 from /usr/include/stdlib.h:32,
                 from ../c++/internal.h:53,
                 from ../c++/cursesf.cc:34:
/opt/local/gcc46/lib/gcc/i386-pc-solaris2.11/4.6.1/include-fixed/sys/feature_tests.h:362:2:
 error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications 
   and pre-2001 POSIX applications"
*** Error code 1

The problem is that 
${GCC_PREFIX}/lib/gcc/i386-pc-solaris2.11/4.6.1/plugin/include/config/sol2.h has

        if (c_dialect_cxx ())                           \
          {                                             \
            builtin_define ("__STDC_VERSION__=199901L");\
            builtin_define ("_XOPEN_SOURCE=600");       \
            builtin_define ("_LARGEFILE_SOURCE=1");     \
            builtin_define ("_LARGEFILE64_SOURCE=1");   \
            builtin_define ("__EXTENSIONS__");          \
          }                                             \

Of course, __STDC_VERSION__=199901L is evaluated as _STDC_C99 in 
sys/feature_tests.h, and put in conflict with !defined(_XPG6), hence the error.

Before I raise a bug somewhere, I'd love if somebody can help me understand 
which side the problem is on and what's the proper way to fix this.

-F



Home | Main Index | Thread Index | Old Index