我正在做我的硕士论文,我在配置交叉编译器时遇到了问题。我已经阅读了很多文章、常见问题解答、教程等,但我仍然认为我遗漏了一些东西,可能非常愚蠢和基础,但没有这些,我就无法对所有事情有清晰的认识,我也不能让一切正常……所以请随时向我解释一切。让我们来解决问题。
我正在使用 SoClib 设计具有许多 MIPS 和许多 RAM 的 NoC,并且我想在每个 RAM 中加载不同的应用程序,以使每个 MIPS 仅从一个 RAM 读取。我设法使用非常简单的应用程序来做到这一点(比如带中断的 hello word……),所以现在我试图实现一个 JPEG 解码器,以便以更强烈的方式使用 MIPS。问题是我使用的交叉编译器找不到基本的 stdio 函数,因此无法为 mips 编译应用程序。所以基本上我没有设法安装一个工作完整的交叉编译器。
1)让我们从安装 SoClib 的交叉编译器开始:这里有我安装它的指南:http: //www.soclib.fr/trac/dev/wiki/CrossCompiler 现在从我已经阅读这不是一个完整的交叉编译器。我只安装了第一阶段 gcc,它可以为 mips 生成 elf 代码,但不能使用任何 C 函数。有了那个,我应该编译一个 C 库来创建一个新的交叉编译器。所以它不工作是正常的,尽管这并不能回答这个问题:为什么“Hello world”在使用 printf 并包含 stdio.h 的情况下工作?答案应该是我已经看到 SoClib 的头文件 stdio.h 实现了很少的功能(printf 在那里),所以我不能在那个编译器中使用标准 C 库。
2)因此,我决定安装一个完整的交叉编译器,并且我已经阅读了很多指南,因此我只会发布我在实践中使用过的两个: http ://www.cse.iitb.ac.in /grc/gcc-workshop-11/downloads/slides/gccw11-config-build.pdf 从第 108 页开始(在解释交叉编译的问题之前)它使用 EGLIBC。唯一的区别是我使用了“mipsel-elf”作为目标。如果我理解正确的话,这个方法需要一个 3 阶段的交叉编译器,因为 eglibc 不能用第一阶段的交叉编译器完全编译。现在的问题是我无法使用第一阶段交叉编译器成功安装 eglibc(它在第 122 页失败)。我附上了日志。我认为问题开始于它说:“mipsel-elf-gcc:错误:无法识别的选项'-V'”和“mipsel-elf-gcc:致命错误:没有输入文件编译终止”。似乎我的编译器有一些问题,并且所有都使用不受支持的平台完成......但它应该可以工作,因为我已经复制了 eglibc/ports 目录,就像指南所说的......</p>
3) 我尝试了另一个使用 newlib 而不是 eglibc 的指南: http://www(dot)cygwin(dot)com/ml/crossgcc/2005-08/msg00114/l-cross-ltr.pdf 本指南仅创建一个两阶段的交叉编译器。我认为这是因为 newlib 可以用第一阶段编译器完全编译……我说的对吗?无论如何,我遇到了同样的问题。我无法编译 newlib 并且收到类似的错误(附加日志)。
所以这是我的问题,在这里我提出了一些疑问,我试图解决它。
4) 问题可能出在目标 = mipsel-elf 上吗?我从 gnu 文档中知道配置 gnu 的名称应该是:cpu-manufacturer-os(或 cpu-manufacturer-kernel-os),但我读过 mipsel-elf 被接受。精灵应该是因为我不想在我的 NoC 平台上加载操作系统,这是第二个疑问……</p>
5)问题可能出在操作系统上吗?指南使用 linux 内核头文件……也许带有 mipsel-elf 目标我不应该配置 binutils –with-sysroot?但听起来我很奇怪......应该改变什么?
6) 还有一个可能很愚蠢的问题。stdio 和通常的 C 函数,不需要操作系统,对吗?因为所有这些问题都让我对基础产生怀疑……所以我应该能够使用 mipsel-elf 交叉编译器运行 JPEG 解码 C 应用程序,对吧?
我们将不胜感激每一个考虑、建议和帮助。如果您有关于这些论点的一些文件,请告诉我,我想学习并在这个领域变得更有信心。谢谢
eglibc 日志:
configure:2426: $? = 0
configure:2433: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -v >&5
Using built-in specs.
COLLECT_GCC=/home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc
COLLECT_LTO_WRAPPER=/home/bertone/programmazione/crosscompiler/mips/install/libexec/gcc/mipsel-elf/4.6.2/lto-wrapper
Target: mipsel-elf
Configured with: ../../../../../Scaricati/src/gcc-4.6.2/configure --target=mipsel-elf --prefix=/home/bertone/programmazione/crosscompiler/mips/install --without-headers --with-newlib --disable-shared --disable-threads --disable-libssp --disable-libgomp --disable-libmudflap --enable-languages=c --disable-werror
Thread model: single
gcc version 4.6.2 (GCC)
configure:2437: $? = 0
configure:2444: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -V >&5
mipsel-elf-gcc: error: unrecognized option '-V'
mipsel-elf-gcc: fatal error: no input files
compilation terminated.
configure:2448: $? = 1
configure:2452: checking for suffix of object files
configure:2478: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -c conftest.c >&5
configure:2482: $? = 0
configure:2507: result: o
configure:2511: checking whether we are using the GNU C compiler
configure:2540: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -c conftest.c >&5
configure:2547: $? = 0
configure:2564: result: yes
configure:2573: checking whether /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc accepts -g
configure:2603: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -c -g conftest.c >&5
configure:2610: $? = 0
configure:2711: result: yes
configure:2728: checking for /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc option to accept ISO C89
configure:2802: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -c -g -O2 conftest.c >&5
conftest.c:9:19: fatal error: stdio.h: No such file or directory
compilation terminated.
configure:2809: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME "GNU C Library"
| #define PACKAGE_TARNAME "glibc"
| #define PACKAGE_VERSION "(see version.h)"
| #define PACKAGE_STRING "GNU C Library (see version.h)"
| #define PACKAGE_BUGREPORT "http://sourceware.org/bugzilla/"
| /* end confdefs.h. */
| #include <stdarg.h>
| #include <stdio.h>
| #include <sys/types.h>
| #include <sys/stat.h>
| /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
| struct buf { int x; };
| FILE * (*rcsopen) (struct buf *, struct stat *, int);
| static char *e (p, i)
| char **p;
| int i;
| {
| return p[i];
| }
| static char *f (char * (*g) (char **, int), char **p, ...)
| {
| char *s;
| va_list v;
| va_start (v,p);
| s = g (p, va_arg (v,int));
| va_end (v);
| return s;
| }
|
| /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
| function prototypes and stuff, but not '\xHH' hex character constants.
| These don't provoke an error unfortunately, instead are silently treated
| as 'x'. The following induces an error, until -std is added to get
| proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
| array size at least. It's necessary to write '\x00'==0 to get something
| that's true only with -std. */
| int osf4_cc_array ['\x00' == 0 ? 1 : -1];
|
| /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
| inside strings and character constants. */
| #define FOO(x) 'x'
| int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
|
| int test (int i, double x);
| struct s1 {int (*f) (int a);};
| struct s2 {int (*f) (double a);};
| int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
| int argc;
| char **argv;
| int
| main ()
| {
| return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
| ;
| return 0;
| }
configure:2802: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -qlanglvl=extc89 -c -g -O2 conftest.c >&5
mipsel-elf-gcc: error: unrecognized
选项“-qlanglvl=extc89”配置:2809:$?= 1
NEWLIB日志
configure:4049: $? = 0
configure:4038: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -v >&5
Using built-in specs.
COLLECT_GCC=/home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc
COLLECT_LTO_WRAPPER=/home/bertone/programmazione/crosscompiler/mips/install/libexec/gcc/mipsel-elf/4.6.2/lto-wrapper
Target: mipsel-elf
Configured with: ../../../../../Scaricati/src/gcc-4.6.2/configure --target=mipsel-elf --prefix=/home/bertone/programmazione/crosscompiler/mips/install --without-headers --with-newlib --disable-shared --disable-threads --disable-libssp --disable-libgomp --disable-libmudflap --enable-languages=c --disable-werror
Thread model: single
gcc version 4.6.2 (GCC)
configure:4049: $? = 0
configure:4038: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -V >&5
mipsel-elf-gcc: error: unrecognized option '-V'
mipsel-elf-gcc: fatal error: no input files
compilation terminated.
configure:4049: $? = 1
configure:4038: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc -qversion >&5
mipsel-elf-gcc: error: unrecognized option '-qversion'
mipsel-elf-gcc: fatal error: no input files
compilation terminated.
configure:4049: $? = 1
configure:4069: checking for C compiler default output file name
configure:4091: /home/bertone/programmazione/crosscompiler/mips/install/bin/mipsel-elf-gcc conftest.c >&5
/home/bertone/programmazione/crosscompiler/mips/install/lib/gcc/mipsel-elf/4.6.2/../../../../mipsel-elf/bin/ld: cannot find crti.o: No such file or directory
/home/bertone/programmazione/crosscompiler/mips/install/lib/gcc/mipsel-elf/4.6.2/../../../../mipsel-elf/bin/ld: cannot find crtbegin.o: No such file or directory
/home/bertone/programmazione/crosscompiler/mips/install/lib/gcc/mipsel-elf/4.6.2/../../../../mipsel-elf/bin/ld: cannot find -lgcc
/home/bertone/programmazione/crosscompiler/mips/install/lib/gcc/mipsel-elf/4.6.2/../../../../mipsel-elf/bin/ld: cannot find -lgcc
/home/bertone/programmazione/crosscompiler/mips/install/lib/gcc/mipsel-elf/4.6.2/../../../../mipsel-elf/bin/ld: cannot find crtend.o: No such file or directory
/home/bertone/programmazione/crosscompiler/mips/install/lib/gcc/mipsel-elf/4.6.2/../../../../mipsel-elf/bin/ld: cannot find crtn.o: No such file or directory
collect2: ld returned 1 exit status
configure:4095: $? = 1
configure:4132: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:4138: error: in `/home/bertone/programmazione/crosscompiler/mips/build/newlib':
configure:4142: error: C compiler cannot create executables