修士論文を執筆中ですが、クロス コンパイラの設定に問題があります。多くの記事、よくある質問、チュートリアルなどを読みましたが、何かが欠けていると思います。おそらく非常に愚かで基本的なものかもしれませんが、それがなければ、すべての明確なビジョンを持つことはできず、できません。すべてがうまくいくように…なので、お気軽にすべてを説明してください。問題に行きましょう。
私は SoClib を使用して、多くの MIPS と多くの RAM を備えた NoC を設計しています。すべての MIPS を 1 つの RAM から読み取るように、すべての RAM に異なるアプリケーションをロードしたいと考えています。非常に単純なアプリケーション (割り込み付きのハロー ワードなど) を使用してそれを行うことができたので、MIPS をより強力な方法で使用する JPEG デコーダーを実現しようとしていました。問題は、私が使用しているクロス コンパイラが基本的な stdio 関数を見つけることができないため、mips 用のアプリケーションをコンパイルできないことです。したがって、基本的に、動作する完全なクロス コンパイラをインストールすることができませんでした。
1) SoClib と一緒にインストールされたクロスコンパイラから始めましょう: インストールするために私が従ったガイドがあります : http://www.soclib.fr/trac/dev/wiki/CrossCompilerこれは完全なクロスコンパイラではありません。mips 用の elf コードを生成できるが、C 関数を使用できない第 1 段階の gcc のみをインストールしました。これで、C ライブラリをコンパイルして、新しいクロス コンパイラを作成する必要があります。したがって、それが機能しないのは正常ですが、それは質問への答えにはなりません: printf を使用し、stdio.h をインクルードしているのに、なぜ「Hello world」が機能していたのでしょうか? 答えは、SoClib にはヘッダー stdio.h があり、関数がほとんど実現されていない (printf がある) ため、そのコンパイラで標準 C ライブラリを使用できないことがわかりました。
2) そのため、私は完全なクロス コンパイラをインストールすることに決め、非常に多くのガイドを読んだので、実際に使用した 2 つだけを投稿します: http://www.cse.iitb.ac.in /grc/gcc-workshop-11/downloads/slides/gccw11-config-build.pdf 108ページから(クロスコンパイルの問題点を説明する前) EGLIBCを使用しています。唯一の違いは、ターゲットとして「mipsel-elf」を使用したことです。私の理解が正しければ、eglibc は最初の段階のクロス コンパイラでは完全にコンパイルできないため、この方法には 3 段階のクロス コンパイラが必要です。問題は、第 1 段階のクロス コンパイラで eglibc をインストールできないことです (122 ページで失敗します)。ログを添付しました。「mipsel-elf-gcc: エラー: 認識されないオプション '-V'」および「mipsel-elf-gcc: 致命的なエラー: 入力ファイルのコンパイルが終了しませんでした」というメッセージが表示されると、問題が発生すると思います。コンパイラに問題があり、サポートされていないプラットフォームですべて終了しているようですが、ガイドにあるように eglibc/ports ディレクトリをコピーしたため、動作するはずです...</p>
3) eglibc の代わりに newlib を使用する別のガイドを試してみました: http://www(dot)cygwin(dot)com/ml/crossgcc/2005-08/msg00114/l-cross- ltr.pdf 2 段階のクロス コンパイラ。それは、newlib が最初の段階のコンパイラで完全にコンパイルできるからだと思います...そうですか? とにかく私は同じ問題を抱えています。newlib をコンパイルできず、同様のエラーが発生します (ログが添付されています)。
それが私の問題であり、ここで私はそれを解決しようとしてきたいくつかの疑問を提起します.
4) 問題は target=mipsel-elf でしょうか? gnu のドキュメントから、gnu を構成する名前は cpu-manufacturer-os (または cpu-manufacturer-kernel-os) にする必要があることを知っていますが、mipsel-elf が受け入れられることを読みました。エルフは、NoC プラットフォームに OS をロードしたくないためである必要があり、ここで 2 番目の疑いがあります…</p>
5) 問題は OS の問題でしょうか? ガイドでは Linux カーネル ヘッダーが使用されています...おそらく mipsel-elf ターゲットでは、sysroot を使用して binutils を構成するべきではありませんか? しかし、私には奇妙に聞こえます...何を変更する必要がありますか?
6) さらに別のおそらくばかげた質問です。stdio と一般的に C 関数は、OS を必要としませんよね? これらの問題のすべてが基本に疑問を抱かせているからです...それで、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' configure: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