This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Use the same compile command ,but include different header file,why?
- From: 张晶 <iam dot chilli at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 19 May 2010 22:27:52 +0800
- Subject: Use the same compile command ,but include different header file,why?
Hi all ,
I am using cygwin to cross compile a? program? for vxworks. As Vxworks
workbench has supplied gnu cross compile toolchain like
c++pentium,cpentium ,aspentium etc, first I set enviroment variables
like CC,CPP to the cross compile tool . After launching? ./configure
--host=i586-wrs-vxworks in the cygwin ,it stopped in the "C++ compiler
and preprocessor"->"checking alignment of bool"section .
According to the config.log ,I found the error "error storage size of
'test_array' isn't constant."? I copy the failed source file in the
workbench ,ide for vxworks application development :
#include ........
..................
typedef struct { char x; char y; } ompi__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * (((long int) offsetof
(ompi__type_alignof_, y)) <= 0)];
test_array [0] = 0
? ;
? return 0;
}
From the ide console ,I found workbench used
c++pentium -g -mtune=i486 -march=i486 -ansi -mrtp -Wall?? -MD -MP
-ID:/WindRiver-GPPVE-3.6-IA-Eval/vxworks-6.6/target/usr/h
-ID:/WindRiver-GPPVE-3.6-IA-Eval/vxworks-6.6/target/usr/h/wrn/coreip
-D_VX_CPU=_VX_SIMPENTIUM -D_VX_TOOL_FAMILY=gnu -D_VX_TOOL=gnu??? -o
a.out -c a.c
to compile a.c ,and produce a.out which is ok to run.
However, in the cygwin shell ,I used the same command the workbench
used to compile the file .it implies :error storage size of
'test_array' isn't constant.
Looking into the problem and the difference between the files
genenrated by ccpentium -E , I found that
In the WORKBENCH
it include the file located in
"d:\\windriver-gppve-3.6-ia-eval\\gnu\\4.1.2-vxworks-6.6\\x86-win32\\bin\\../../lib/gcc/i586-wrs-vxworks/4.1.2/include/stddef.h"
and the offset macro is replaced as "__builtin_offsetof
(ompi__type_alignof_, y) "
In the cygwin shell
it include the file located in
"D:/WindRiver-GPPVE-3.6-IA-Eval/vxworks-6.6/target/usr/h/stddef.h"
and the offset macro is replace as ((:: size_t)&(((ompi__type_alignof_
*)0)->y)))
It seems the problem is the variable array , which is not supported by
c++ .I am confused why use the same compile command ,but include
different header file.
--
Jing Zhang