akopytov / sysbench

Scriptable database and system performance benchmark
GNU General Public License v2.0
6.09k stars 1.08k forks source link

Build failure with riscv64 toolchain #457

Open zetalog opened 2 years ago

zetalog commented 2 years ago

I tried sysbench with the following build steps:

./autogen.sh
./configure --host=riscv64-linux-gnu --without-mysql
make

And failed with:

make[1]: Entering directory '/home/zetalog/workspace/kuhan/sysbench/third_party/concurrency_kit'
rm -rf tmp
mkdir tmp
tar -C . -cf - ck | tar -xf - -C tmp/
chmod -R u+w tmp
cd tmp/ck &&                        \
CC="riscv64-linux-gnu-gcc"                          \
CFLAGS="-O3 -funroll-loops  -D_GNU_SOURCE "      \
LDFLAGS=""                \
  ./configure  \
  --prefix=/home/zetalog/workspace/kuhan/sysbench/third_party/concurrency_kit && \
make && \
make install
Detecting operating system.......success [linux]
Detecting machine architecture...success [x86_64]
Finding dirname command..........success [/usr/bin/dirname]
Determining build directory......success [/home/zetalog/workspace/kuhan/sysbench/third_party/concurrency_kit/tmp/ck]
Finding gzip tool................success [/bin/gzip]
Finding suitable compiler........failed  [update compiler]
Makefile:498: recipe for target 'lib/libck.a' failed
make[1]: *** [lib/libck.a] Error 1
make[1]: Leaving directory '/home/zetalog/workspace/kuhan/sysbench/third_party/concurrency_kit'
Makefile:478: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

It seems the concurrency_ck configure was trying to execute a target binary on host:

$CC -o .1 .1.c
COMPILER=`./.1 2> /dev/null`
r=$?
rm -f .1.c .1

What should I do to fix the issue? Thanks in advance.

zetalog commented 2 years ago

I also created an issue to ck here if this issue is not meant to be fixed by sysbench: https://github.com/concurrencykit/ck/issues/193

zetalog commented 2 years ago

ck riscv support is pushed here: https://github.com/concurrencykit/ck/pull/194

EnkiSun86 commented 1 year ago

Do you cross compile a riscv binary on a X86 host machine? I found it will compile with gcc on x86 even if I select --host and --target variable.: ./configure --with-sysroot=/home/caelus/share/sysbench/rfs_ramfs --target=riscv32-linux-gnu --without-mysql --prefix=/mnt/sysbench --host=riscv32-linux-gnu

If I set CC to the cross tool chain, it wille stopped with error in

$CC -o .1 .1.c
COMPILER=`./.1 2> /dev/null`
r=$?
rm -f .1.c .1

Since it tried to run a riscv binary on a X86 machine.