我正在做我的碩士論文,我在配置交叉編譯器時遇到問題。我讀過很多文章,常見問題解答,教程等,但我仍然認爲我錯過了一些東西,可能非常愚蠢和基礎,但沒有這些,我不能清楚地看到一切,而且我也不會使所有工作...所以請隨時解釋我的一切。讓我們來解決這個問題。安裝mips交叉編譯器的問題
我正在使用SoClib設計具有許多MIPS和許多RAM的NoC,並且我想在每個RAM中加載不同的應用程序,以使每個MIPS只從一個RAM讀取。我設法用非常簡單的應用程序來做到這一點(比如hello word with interrupts ...),所以現在我試圖實現一個JPEG解碼器,以更強烈的方式使用MIPS。問題是我使用的交叉編譯器找不到基本的stdio函數,所以無法編譯mips的應用程序。所以基本上我沒有設法安裝一個完整的交叉編譯器。
1)Let's開始與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。唯一的區別是我用作目標「米勒精靈」。如果我理解正確,這種方法需要3階段交叉編譯器,因爲eglibc不能用第一階段交叉編譯器完全編譯。現在的問題是,我無法用第一階段交叉編譯器安裝eglibc(它在第122頁失敗)。我附上了日誌。我認爲問題開始於它說:「mipsel-elf-gcc:錯誤:無法識別的選項'-V'」和「mipsel-elf-gcc:致命錯誤:沒有輸入文件編譯終止」。似乎我有一些編譯器的問題,並完成一個不支持的平臺......但它應該工作,因爲我已經複製eglibc/ports目錄像指南所說...
3)我試過另一個指南,使用newlib而不是eglibc: http://www(dot)cygwin(dot)com/ml/crossgcc/2005-08/msg00114/l-cross-ltr.pdf 本指南僅創建2階段交叉編譯器。我認爲這是因爲newlib可以用第一階段編譯器完全編譯......我是對的嗎?無論如何,我遇到同樣的問題。我無法編譯newlib,並且出現類似的錯誤(附加日誌)。
所以這是我的問題,在這裏我提出了一些疑問,我試圖解決它。
4)問題可能是目標= mipsel-elf嗎?我從gnu文檔中知道,配置gnu的名字應該是:cpu-manufacturer-os(或者cpu-manufacturer-kernel-os),但我讀過mipsel-elf被接受。小精靈應該是因爲我不想在我的NoC平臺上加載操作系統,這裏有第二個疑問......
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