質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
C

C言語は、1972年にAT&Tベル研究所の、デニス・リッチーが主体となって作成したプログラミング言語です。 B言語の後継言語として開発されたことからC言語と命名。そのため、表記法などはB言語やALGOLに近いとされています。 Cの拡張版であるC++言語とともに、現在世界中でもっとも普及されているプログラミング言語です。

GCC

GCCはGNU Compiler Collectionの略です。LinuxのC言語コンパイラのデファクトスタンダードであり、数多くの他言語やプラットフォームサポートもします。

Q&A

解決済

3回答

3233閲覧

クロスコンパイラ用のgccをインストールができません。

john010

総合スコア9

C

C言語は、1972年にAT&Tベル研究所の、デニス・リッチーが主体となって作成したプログラミング言語です。 B言語の後継言語として開発されたことからC言語と命名。そのため、表記法などはB言語やALGOLに近いとされています。 Cの拡張版であるC++言語とともに、現在世界中でもっとも普及されているプログラミング言語です。

GCC

GCCはGNU Compiler Collectionの略です。LinuxのC言語コンパイラのデファクトスタンダードであり、数多くの他言語やプラットフォームサポートもします。

0グッド

0クリップ

投稿2021/08/12 10:54

自分の環境はDebianで、H8用のクロスコンパイラの環境を設定したいです。
gccのバージョンは11.2.0です。
binutilsはすでにbuild, makeしたのですが、gccのほうがうまくいきません。gccの./configure ... がうまくいきませんでした。どうすれば解決しますか?下に実行結果と参考リンク先を載せておきます。

リンク

terminal

1~/gcc-11.2.0/build$ ../configure --target=h8300-elf --disable-nls --disable-threads --disable-shared --enable-languages=c --disable-werror 2checking build system type... x86_64-pc-linux-gnu 3checking host system type... x86_64-pc-linux-gnu 4checking target system type... h8300-unknown-elf 5checking for a BSD-compatible install... /usr/bin/install -c 6checking whether ln works... yes 7checking whether ln -s works... yes 8checking for a sed that does not truncate output... /bin/sed 9checking for gawk... gawk 10checking for libatomic support... no 11checking for libitm support... no 12checking for libsanitizer support... no 13checking for libvtv support... no 14checking for libhsail-rt support... no 15checking for libphobos support... no 16checking for gcc... gcc 17checking whether the C compiler works... yes 18checking for C compiler default output file name... a.out 19checking for suffix of executables... 20checking whether we are cross compiling... no 21checking for suffix of object files... o 22checking whether we are using the GNU C compiler... yes 23checking whether gcc accepts -g... yes 24checking for gcc option to accept ISO C89... none needed 25checking for g++... g++ 26checking whether we are using the GNU C++ compiler... yes 27checking whether g++ accepts -g... yes 28checking whether g++ accepts -static-libstdc++ -static-libgcc... yes 29checking for gnatbind... no 30checking for gnatmake... no 31checking whether compiler driver understands Ada... no 32checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2 33checking whether g++ supports C++11 features by default... yes 34checking for objdir... .libs 35checking for the correct version of gmp.h... no 36configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+. 37Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify 38their locations. Source code for these libraries can be found at 39their respective hosting sites as well as at 40https://gcc.gnu.org/pub/gcc/infrastructure/. See also 41http://gcc.gnu.org/install/prerequisites.html for additional info. If 42you obtained GMP, MPFR and/or MPC from a vendor distribution package, 43make sure that you have installed both the libraries and the header 44files. They may be located in separate packages. 45~/gcc-11.2.0/build$ make 46make: *** ターゲットが指定されておらず, makefile も見つかりません. 中止.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答3

0

専門ではないのでまったく的を外しているかもしれませんが,ちょっとググって出てきた

https://github.com/kjmatu/12step_self_embedded_os_dev_enviroment/blob/master/Dockerfile

の内容が参考になるのではないでしょうか?

Dockerfileの中身は素のubuntuインストール後の環境からコマンドを実行して環境を作成する
スクリプトのような感じになっています。

仮想マシン上のubuntuですし,gccもパージョンが全然違うのですが,
debianはubuntuの親ディストリビューションですし,ほぼ同様の感じでビルドできるのではないかと思います。

仮想イメージのボリューム削減のためrmが多いのですがこれは無視してRUNのところを参考に
WORKDIRのところを適切に自分の環境に合わせて(cd ほにゃらら等)変更してビルドしていけばいいのかなと思います。

投稿2021/08/23 15:52

ujimushi_sradjp

総合スコア2103

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

ここで、H8のGCCパッケージが取得できます
ユーザ登録が必要ですが

H8 レガシーToolchains | Open Source Tools for Renesas

#debianで動かしたことはないですが。。

投稿2021/08/12 11:14

y_waiwai

総合スコア87800

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

john010

2021/08/12 12:05

拡張子がrpmしかないですね...
guest

0

ベストアンサー

GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+ が無いって言われてますね。
それらの場所をオプションで指定するか、未インストールならインストールが必要だということだと思います。

投稿2021/08/12 11:00

itagagaki

総合スコア8402

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

john010

2021/08/12 11:14

インストールしたのですが、変わらずにエラーが起きます。 "sudo apt-get install g++ m4 zlib1g-dev make p7zip sudo apt install libgmp-dev sudo apt install libmpfr-dev " "configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+. Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations. Source code for these libraries can be found at their respective hosting sites as well as at https://gcc.gnu.org/pub/gcc/infrastructure/. See also http://gcc.gnu.org/install/prerequisites.html for additional info. If you obtained GMP, MPFR and/or MPC from a vendor distribution package, make sure that you have installed both the libraries and the header files. They may be located in separate packages."
itagagaki

2021/08/12 11:29

それらがライブラリ検索パス(環境変数LDFLAGSかな?)に無いのでしょうね。 なので環境変数LDFLAGSを設定するか、さもなくば configure に --with-gmp --with-mpfr --with-mpc オプションで指定する必要があるのだと思います。 メッセージに書かれているリンク先のドキュメントにはこう書いてあります。 GNU Multiple Precision Library (GMP) version 4.3.2 (or later) Necessary to build GCC. If a GMP source distribution is found in a subdirectory of your GCC sources named gmp, it will be built together with GCC. Alternatively, if GMP is already installed but it is not in your library search path, you will have to configure with the --with-gmp configure option. See also --with-gmp-lib and --with-gmp-include. The in-tree build is only supported with the GMP version that download_prerequisites installs. MPFR Library version 3.1.0 (or later) Necessary to build GCC. It can be downloaded from https://www.mpfr.org. If an MPFR source distribution is found in a subdirectory of your GCC sources named mpfr, it will be built together with GCC. Alternatively, if MPFR is already installed but it is not in your default library search path, the --with-mpfr configure option should be used. See also --with-mpfr-lib and --with-mpfr-include. The in-tree build is only supported with the MPFR version that download_prerequisites installs. MPC Library version 1.0.1 (or later) Necessary to build GCC. It can be downloaded from http://www.multiprecision.org/mpc/. If an MPC source distribution is found in a subdirectory of your GCC sources named mpc, it will be built together with GCC. Alternatively, if MPC is already installed but it is not in your default library search path, the --with-mpc configure option should be used. See also --with-mpc-lib and --with-mpc-include. The in-tree build is only supported with the MPC version that download_prerequisites installs.
episteme

2021/08/12 11:31

> Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations. と言うてますが、試しました?
john010

2021/08/12 12:06

gmp,mpfr,mpcの場所がわかりません。whichコマンドを使用したのですが、何も出力されません
episteme

2021/08/12 12:09 編集

./configure のオプションに --with-gmp どーのこーのを追加しろって言うてるんじゃなくて?
itagagaki

2021/08/12 12:18 編集

バイナリではなくライブラリなのでwhichでは探せませんね。 aptでどこにインストールされているのかわかりませんが、たぶん/usr/localの下だと思うので、 find /usr/local -name gmp -print とか実行してみるといいと思います。 で、もしかしてライブラリファイルが/usrl/local/lib下にシンボリックリンクも貼られているなら、 環境変数 LD_LIBRARY_PATH に /usr/local/lib を加えるだけで良さそうな気がします。 もし設定されていないなら設定してみてください。
john010

2021/08/13 05:02

mpfrをビルドしようと思ったのですが、./congifure ~まではできたのですがmakeをしようとしたらエラーが出ます。どうすればビルドできますか? " sudo make && make check && make install Making all in doc make[1]: ディレクトリ '/home/usr/mpfr-4.1.0/doc' に入ります make[1]: 'all' に対して行うべき事はありません. make[1]: ディレクトリ '/home/usr/mpfr-4.1.0/doc' から出ます Making all in src make[1]: ディレクトリ '/home/usr/mpfr-4.1.0/src' に入ります ../tools/get_patches.sh ../PATCHES > get_patches.c || { rm -f get_patches.c; exit 1; } /bin/bash: ../tools/get_patches.sh: 許可がありません make[1]: *** [Makefile:1744: get_patches.c] エラー 1 make[1]: ディレクトリ '/home/usr/mpfr-4.1.0/src' から出ます make: *** [Makefile:500: all-recursive] エラー 1" 参考のリンク https://stackoverflow.com/questions/9450394/how-to-install-gcc-piece-by-piece-with-gmp-mpfr-mpc-elf-without-shared-libra
itagagaki

2021/08/13 05:22

apt install libmpfr-dev でビルド済みのライブラリがインストールされたのではなかったのですか?
john010

2021/08/13 05:24

mpfrがインストールされているか試したのですが、以下のように表示されました。 " dpkg -L mpfr dpkg-query: パッケージ 'mpfr' はまだインストールされていませ Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. "
jbpb0

2021/08/13 06:27 編集

dpkg -L libmpfr-dev では? (aptで入れたときの名前に合わせる)
john010

2021/08/13 06:59

そのコマンドならできました。ここから何を入力すればbuildできますか? $dpkg -L libmpfr-dev /. /usr /usr/include /usr/include/mpf2mpfr.h /usr/include/mpfr.h /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libmpfr.a /usr/lib/x86_64-linux-gnu/pkgconfig /usr/lib/x86_64-linux-gnu/pkgconfig/mpfr.pc /usr/share /usr/share/doc /usr/share/doc/libmpfr-dev /usr/share/doc/libmpfr-dev/changelog.Debian.gz /usr/share/doc/libmpfr-dev/copyright /usr/lib/x86_64-linux-gnu/libmpfr.so /usr/share/doc/libmpfr-dev/AUTHORS /usr/share/doc/libmpfr-dev/BUGS /usr/share/doc/libmpfr-dev/NEWS.gz /usr/share/doc/libmpfr-dev/README /usr/share/doc/libmpfr-dev/TODO.gz /usr/share/doc/libmpfr-dev/changelog.gz
jbpb0

2021/08/13 09:46 編集

lib*.a, lib*.so がある場所を「--with-mpfr-lib」に、*.h がある場所を「--with-mpfr-include」に指定するようなので、 --with-mpfr-lib /usr/lib/x86_64-linux-gnu と --with-mpfr-include /usr/include を、gcc の「configure」のオプションに追加するのではないですかね あと、GMP と MPC も、同様にインストールされた場所を調べて、gcc の「configure」のオプションに追加する必要があります
john010

2021/08/14 07:05 編集

gccのところでconfigをやろうとしたら以下のようにエラーが出ました. " gcc-3.4.6/build$ sudo ../configure --target=h8300-elf --disable-nls --disable-threads --disable-shared --enable-languages=c --disable-werror --with-mpfr-lib /usr/lib/x86_64-linux-gnu --with-mpfr-include /usr/include configure: warning: /usr/lib/x86_64-linux-gnu: invalid host type configure: warning: /usr/include: invalid host type configure: error: can only configure for one host and one target at a time "
itagagaki

2021/08/14 07:12

各ライブラリもネイティブアーキテクチャ用にビルド済みなやつではダメで、ターゲットアーキテクチャ向けにソースからビルドしないとダメっぽい感じですね。 gccと各ライブラリを含めてすべてソースを展開して、ビルドする必要がありそうです。 で、こちらのページが参考になりそうです。 https://www.soramimi.jp/h8300gcc/index.html
john010

2021/08/14 07:17

わかりました。今までビルドしたものはどうやって削除すればいいでしょうか?
john010

2021/08/14 07:37 編集

=に変更したら無事にconfigできましたが、makeは通りません。おそらくGMP と MPCの場所がわかればできると思うのですが、このdpkg -L コンテンツ名がわかりません。一応make最後のエラー文も載せておきます。 " ar: argv.o: そのようなファイルやディレクトリはありません make[1]: *** [Makefile:221: libiberty.a] エラー 1 make[1]: ディレクトリ '/home/usr/gcc-3.4.6/build/libiberty' make: *** [Makefile:19871: all-libiberty] エラー 2 "
jbpb0

2021/08/14 07:56 編集

> dpkg -L コンテンツ名がわかりません。 aptで入れたときの名前に合わせるのです GMPは、これですよね > sudo apt install libgmp-dev MPCは、aptで入れましたか?
john010

2021/08/14 13:06 編集

おそらくbuildで行ったような気もします。 GMPは見つかりました。MPCのライブラリの名前がわかりません。 " dpkg -L libgmp-dev /. /usr /usr/include /usr/include/gmpxx.h /usr/include/x86_64-linux-gnu /usr/include/x86_64-linux-gnu/gmp.h /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libgmp.a /usr/lib/x86_64-linux-gnu/libgmpxx.a /usr/share /usr/share/doc /usr/share/doc/libgmp-dev /usr/share/doc/libgmp-dev/AUTHORS /usr/share/doc/libgmp-dev/NEWS.gz /usr/share/doc/libgmp-dev/README /usr/share/doc/libgmp-dev/changelog.Debian.gz /usr/share/doc/libgmp-dev/changelog.gz /usr/share/doc/libgmp-dev/copyright /usr/lib/x86_64-linux-gnu/libgmp.so /usr/lib/x86_64-linux-gnu/libgmpxx.so "
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問