This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problems compiling using GCC in execvp
- From: Marcus Clyne <maccaday at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 01 Jul 2009 19:16:36 +0300
- Subject: Problems compiling using GCC in execvp
Hi,
I'm having some issues when trying to compile some files when using
execvp to launch GCC.
I'm basically forking, then calling
execvp (bin, argv);
Where bin is a char* to "gcc" and argv is a pointer to the array of
char* below:
-fPIC
-o
/tmp/simpl-so/objs/783b8f28.o
-I
/simpl/dev/src
-I
/simpl/dev/src/core
-I
/simpl/dev/src/include
-c
/t/bufout.c
I am getting the following output from the compiler:
--------------------------------------------
In file included from /usr/include/semaphore.h:23,
from /simpl/dev/src/include/simpl_system.h:3,
from /simpl/dev/src/simpl.h:13,
from /t/bufout.c:1:
/usr/include/sys/types.h:147:20: error: stddef.h: No such file or directory
In file included from /usr/include/sched.h:35,
from /usr/include/pthread.h:25,
from /simpl/dev/src/include/simpl_system.h:5,
from /simpl/dev/src/simpl.h:13,
from /t/bufout.c:1:
/usr/include/bits/sched.h:193: error: expected ')' before '__setsize'
/usr/include/bits/sched.h:195: error: expected ')' before '__count'
In file included from /usr/include/pthread.h:26,
from /simpl/dev/src/include/simpl_system.h:5,
from /simpl/dev/src/simpl.h:13,
from /t/bufout.c:1:
/usr/include/time.h:200: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'strftime'
In file included from /simpl/dev/src/include/simpl_system.h:5,
from /simpl/dev/src/simpl.h:13,
from /t/bufout.c:1:
/usr/include/pthread.h:297: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/pthread.h:298: error: nonnull argument with out-of-range
operand number (argument 1, operand 2)
/usr/include/pthread.h:302: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/pthread.h:361: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/pthread.h:362: error: nonnull argument with out-of-range
operand number (argument 1, operand 2)
/usr/include/pthread.h:368: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/pthread.h:375: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/pthread.h:376: error: nonnull argument with out-of-range
operand number (argument 1, operand 3)
/usr/include/pthread.h:382: error: expected declaration specifiers or
'...' before 'size_t'
In file included from /simpl/dev/src/simpl.h:13,
from /t/bufout.c:1:
/simpl/dev/src/include/simpl_system.h:6:23: error: stdarg.h: No such
file or directory
In file included from /simpl/dev/src/simpl.h:15,
from /t/bufout.c:1:
/simpl/dev/src/include/simpl_types.h:26: error: expected
specifier-qualifier-list before 'size_t'
/simpl/dev/src/include/simpl_types.h:36: error: expected
specifier-qualifier-list before 'size_t'
In file included from /simpl/dev/src/simpl.h:17,
from /t/bufout.c:1:
/simpl/dev/src/include/simpl_memory.h:65: error: expected declaration
specifiers or '...' before 'size_t'
In file included from /simpl/dev/src/simpl.h:18,
from /t/bufout.c:1:
/simpl/dev/src/include/simpl_print.h:11: error: expected declaration
specifiers or '...' before 'size_t'
In file included from /simpl/dev/src/simpl.h:19,
from /t/bufout.c:1:
/simpl/dev/src/include/simpl_arrays.h:15: error: expected
specifier-qualifier-list before 'size_t'
/simpl/dev/src/include/simpl_arrays.h:21: error: expected declaration
specifiers or '...' before 'size_t'
/simpl/dev/src/include/simpl_arrays.h:22: error: expected declaration
specifiers or '...' before 'size_t'
In file included from /simpl/dev/src/simpl.h:28,
from /t/bufout.c:1:
/simpl/dev/src/include/simpl_strings.h:7: error: expected declaration
specifiers or '...' before 'size_t'
In file included from /simpl/dev/src/core/simpl_inc.h:5,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/dirent.h:325: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/dirent.h:327: error: nonnull argument with out-of-range
operand number (argument 1, operand 4)
In file included from /usr/include/stdio.h:75,
from /simpl/dev/src/core/simpl_inc.h:8,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/libio.h:332: error: expected specifier-qualifier-list
before 'size_t'
/usr/include/libio.h:364: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/libio.h:373: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/libio.h:489: error: expected declaration specifiers or
'...' before '__gnuc_va_list'
/usr/include/libio.h:491: error: expected declaration specifiers or
'...' before '__gnuc_va_list'
/usr/include/libio.h:493: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '_IO_sgetn'
In file included from /simpl/dev/src/core/simpl_inc.h:8,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/stdio.h:312: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdio.h:319: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdio.h:347: error: expected declaration specifiers or
'...' before '__gnuc_va_list'
/usr/include/stdio.h:352: error: expected declaration specifiers or
'...' before '__gnuc_va_list'
/usr/include/stdio.h:355: error: expected declaration specifiers or
'...' before '__gnuc_va_list'
/usr/include/stdio.h:361: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdio.h:363: error: format string argument not a string type
/usr/include/stdio.h:365: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdio.h:366: error: expected declaration specifiers or
'...' before '__gnuc_va_list'
/usr/include/stdio.h:367: error: format string argument not a string type
/usr/include/stdio.h:678: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'fread'
/usr/include/stdio.h:684: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'fwrite'
/usr/include/stdio.h:706: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'fread_unlocked'
/usr/include/stdio.h:708: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'fwrite_unlocked'
In file included from /simpl/dev/src/core/simpl_inc.h:9,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/stdlib.h:140: error: expected '=', ',', ';', 'asm' or
'__attribute__' before '__ctype_get_mb_cur_max'
/usr/include/stdlib.h:337: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:367: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:369: error: nonnull argument with out-of-range
operand number (argument 1, operand 4)
/usr/include/stdlib.h:471: error: expected ')' before '__size'
/usr/include/stdlib.h:473: error: expected ')' before '__nmemb'
/usr/include/stdlib.h:485: error: expected declaration specifiers or
'...' before 'size_t'
In file included from /usr/include/stdlib.h:497,
from /simpl/dev/src/core/simpl_inc.h:9,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/alloca.h:33: error: expected ')' before '__size'
In file included from /simpl/dev/src/core/simpl_inc.h:9,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/stdlib.h:502: error: expected ')' before '__size'
/usr/include/stdlib.h:507: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:507: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:684: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:684: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:685: error: nonnull argument with out-of-range
operand number (argument 1, operand 5)
/usr/include/stdlib.h:689: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:689: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:690: error: nonnull argument with out-of-range
operand number (argument 1, operand 4)
/usr/include/stdlib.h:767: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:770: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:774: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:778: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:787: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/stdlib.h:790: error: expected ')' before '*' token
/usr/include/stdlib.h:794: error: expected declaration specifiers or
'...' before 'wchar_t'
/usr/include/stdlib.h:798: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'mbstowcs'
/usr/include/stdlib.h:801: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'wcstombs'
In file included from /simpl/dev/src/core/simpl_inc.h:10,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/string.h:39: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:43: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:52: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:59: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:62: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:66: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:88: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:96: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:102: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:109: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'strxfrm'
/usr/include/string.h:184: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'strcspn'
/usr/include/string.h:188: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'strspn'
/usr/include/string.h:242: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'strlen'
/usr/include/string.h:270: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:294: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:298: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:302: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:305: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/string.h:335: error: expected declaration specifiers or
'...' before 'size_t'
In file included from /simpl/dev/src/core/simpl_inc.h:11,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/sys/sem.h:59: error: expected declaration specifiers or
'...' before 'size_t'
In file included from /usr/include/signal.h:350,
from /usr/include/sys/wait.h:31,
from /simpl/dev/src/core/simpl_inc.h:14,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/bits/sigstack.h:54: error: expected
specifier-qualifier-list before 'size_t'
In file included from /simpl/dev/src/core/simpl_inc.h:16,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/unistd.h:327: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/unistd.h:333: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/unistd.h:477: error: expected declaration specifiers or
'...' before 'size_t'
In file included from /simpl/dev/src/core/simpl_inc.h:16,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/unistd.h:580: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'confstr'
/usr/include/unistd.h:752: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/unistd.h:788: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/unistd.h:835: error: expected declaration specifiers or
'...' before 'size_t'
In file included from /simpl/dev/src/core/simpl_inc.h:16,
from /simpl/dev/src/core/simpl_devel.h:5,
from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/usr/include/unistd.h:857: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/unistd.h:864: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/unistd.h:875: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/unistd.h:877: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/unistd.h:895: error: expected declaration specifiers or
'...' before 'size_t'
/usr/include/unistd.h:896: error: expected declaration specifiers or
'...' before 'size_t'
In file included from /simpl/dev/src/simpl.h:82,
from /t/bufout.c:1:
/simpl/dev/src/core/simpl_devel.h: In function 'simpl_dev_printi':
/simpl/dev/src/core/simpl_devel.h:30: warning: incompatible implicit
declaration of built-in function 'malloc'
/simpl/dev/src/core/simpl_devel.h: In function 'simpl_dev_cat':
/simpl/dev/src/core/simpl_devel.h:44: warning: incompatible implicit
declaration of built-in function 'strlen'
/simpl/dev/src/core/simpl_devel.h:45: warning: incompatible implicit
declaration of built-in function 'malloc'
/simpl/dev/src/core/simpl_devel.h:47: error: too many arguments to
function 'memcpy'
/simpl/dev/src/core/simpl_devel.h:48: error: too many arguments to
function 'memcpy'
/simpl/dev/src/core/simpl_devel.h: In function 'simpl_dev_cat4':
/simpl/dev/src/core/simpl_devel.h:58: warning: incompatible implicit
declaration of built-in function 'strlen'
/simpl/dev/src/core/simpl_devel.h:59: warning: incompatible implicit
declaration of built-in function 'malloc'
/simpl/dev/src/core/simpl_devel.h:62: error: too many arguments to
function 'memcpy'
/simpl/dev/src/core/simpl_devel.h:63: error: too many arguments to
function 'memcpy'
/simpl/dev/src/core/simpl_devel.h:64: error: too many arguments to
function 'memcpy'
/simpl/dev/src/core/simpl_devel.h:65: error: too many arguments to
function 'memcpy'
/simpl/dev/src/core/simpl_devel.h: In function 'simpl_dev_pid':
/simpl/dev/src/core/simpl_devel.h:76: warning: incompatible implicit
declaration of built-in function 'malloc'
cc1: error: ../lib/gcc/x86_64-linux-gnu/4.3.3/include: Permission denied
cc1: error: ../lib/gcc/x86_64-linux-gnu/4.3.3/include-fixed: Permission
denied
cc1: error:
../lib/gcc/x86_64-linux-gnu/4.3.3/../../../../x86_64-linux-gnu/include:
Permission denied
cc1: error: ../lib/gcc/x86_64-linux-gnu/4.3.3/include: Permission denied
cc1: error: ../lib/gcc/x86_64-linux-gnu/4.3.3/include-fixed: Permission
denied
cc1: error: ../x86_64-linux-gnu/include: Permission denied
-------------------------------------------------
There are a few issues here, the most important for me to fix is the
definition of size_t. AFAIK this is normally done in stddef.h, however
on my system, there's no /usr/include/stddef.h and the one under
/usr/include/linux/stddef.h only defines NULL, and I'm not quite sure
where else it might be defined.
Also, when I run GCC from the shell, everything compiles without
errors. I'm wondering what other information I need to add to my
options to prevent the errors. I've tried adding /usr/include/linux as
an include path, but that only solves the initial problem of finding a
stddef.h file, and then causes other errors to appear.
Note, this problem only seems to be on my 64-bit Ubuntu version 9.04.
The 32-bit version worked on my old computer before I transfered the
data to my new one, but I can no-longer test it on the 32-bit machine.
I'd be grateful for any pointers that might help me sort this one out.
Thanks,
Marcus.