我想使用newlib而不是glibc来编译小的静态二进制文件 . (我不打算交叉编译,因为二进制文件将由同一台计算机使用 . )我相信我需要为此编译一个单独的gcc?
我编译了gcc:
./configure --prefix=/home/myuser/Desktop/gcc-4.4.5 --libexecdir=/home/myuser/Desktop/gcc-4.4.5 --libdir=/home/myuser/Desktop/gcc-4.4.5 --with-gxx-include-dir=/home/myuser/Desktop/gcc-4.4.5 --enable-languages=c --enable-libmudflap --disable-multilib --disable-libssp --disable-nls --with-newlib --with-gnu-as --with-gnu-ld --with-system-zlib
make
它编译没有错误,但现在我尝试编译一个简单的Hello World!程序它想要使用来自/ usr的头文件而不是我上面指定的路径 . 这些是一些错误:
In file included from /home/myprogram/Desktop/myprogram.c:1:
/usr/include/stdio.h:34:21: error: stddef.h: No such file or directory
In file included from /usr/include/stdio.h:75,
from /home/myprogram/Desktop/myprogram.c:1:
/usr/include/libio.h:53:21: error: stdarg.h: No such file or directory
In file included from /usr/include/stdio.h:75,
from /home/myprogram/Desktop/myprogram.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'
我究竟做错了什么 ?编译一个新的gcc是必要的还是我可以使用我现有的gcc并使用newlib而不是glibc ???