FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

Coremark-Proのクロスコンパイルを試す (ライブラリが足りずに失敗)

Coremark-ProのクロスコンパイルをMIPSで試行中。ライブラリ不足でうまくいかない...

基本的に、./util/make 内のファイルを変更してクロスコンパイル用にしていく。 Coremark-Proの環境は、make実行時にTARGET=xxxを指定してクロスコンパイルターゲットを決める仕組みになっている。 例えば、./util/make 内に mips.mak を作っておけば、

make TARGET=mips.mak

を作っておけば良い。今回は、プラットフォーム向けにmips.mak (linux64.makよりコピー)、 mips_gcc.mak (gcc64.makよりコピー)してコンパイルを実行した。 ツールの部分を mips-mti-linux-elf-xxx に変更しておく。あとは各種定数の設定。 COMPILER_DEFINESに変更点を追加していく。これらの設定は基本的に./mith/al/include/th_cfg.h で設定できるが、あまりソースコードを変更したくないので、外からコンパイラの設定として与えていく。

COMPILER_DEFINES += HAVE_SYS_STAT_H=1 USE_NATIVE_PTHREAD=0 USE_SINGLE_CONTEXT=1 GCC_INLINE_MACRO=1 NO_RESTRICT_QUALIFIER=1
COMPILER_DEFINES += EE_SIZEOF_LONG=8 EE_SIZEOF_PTR=8 EE_PTR_ALIGN=8
COMPILER_DEFINES += HAVE_MALLOC=1 HAVE_FILEIO=1 FAKE_FILEIO=1 HAVE_VPRINTF=0 HOST_EXAMPLE_CODE=1 USE_CLOCK=1 CLOCK_REALTIME=100

うーん、ここまでやって、コンパイル試行しているが、標準ライブラリが足りずにうまくいかない。

make[2]: *** [/home/masayuki/benchmark/coremark-pro_1.1.2446/builds/linux64/mips_gcc/bin/nnet_test.exe] エラー 1
make[2]: ディレクトリ `/home/masayuki/benchmark/coremark-pro_1.1.2446/builds/linux64/mips_gcc/obj/workloads/nnet_test' から出ます
make[2]: ディレクトリ `/home/masayuki/benchmark/coremark-pro_1.1.2446/builds/linux64/mips_gcc/obj/workloads/parser-125k' に入ります
/home/masayuki/mips-tools/imagination/install32-mips-mti-linux-gnu//bin/mips-mti-linux-gnu-ld   -o/home/masayuki/benchmark/coremark-pro_1.1.2446/builds/linux64/mips_gcc/bin/parser-125k.exe parser-125k.o /home/masayuki/benchmark/coremark-pro_1.1.2446/builds/linux64/mips_gcc/obj/bench/darkmark/parser/*.o  /home/masayuki/benchmark/coremark-pro_1.1.2446/builds/linux64/mips_gcc/obj/mith.a -lm -lrt -lm -lrt
/home/masayuki/mips-tools/imagination/install32-mips-mti-linux-gnu//bin/mips-mti-linux-gnu-ld: /home/masayuki/benchmark/coremark-pro_1.1.2446/builds/linux64/mips_gcc/obj/mith.a(th_lib.o): シンボル 'vsprintf@@GLIBC_2.0' への未定義参照です
/home/masayuki/mips-tools/imagination/install32-mips-mti-linux-gnu/bin/../sysroot/usr/lib/libc.so.6: error adding symbols: DSO missing from command line
make[2]: *** [/home/masayuki/benchmark/coremark-pro_1.1.2446/builds/linux64/mips_gcc/bin/parser-125k.exe] エラー 1
make[2]: ディレクトリ `/home/masayuki/benchmark/coremark-pro_1.1.2446/builds/linux64/mips_gcc/obj/workloads/parser-125k' から出ます

vsprintfって別にOS依存しないよね?配列に出力するだけだからなあ。。。特にLinuxの環境を設定する必要なないと思ったけど...