./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc CFLAGS=-static CXX=arm-linux-gnueabihf-g++ CXXFLAGS=-static
root@ubuntu:/home/ubuntu/riscv/iperf-3.1.3# riscv64-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=riscv64-linux-gnu-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/riscv64-linux-gnu/7/lto-wrapper Target: riscv64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04'
--with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,c++,d,fortran,objc,obj-c++
--prefix=/usr --with-gcc-major-version-only --program-suffix=-7
--enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-libitm --disable-libsanitizer --disable-libquadmath --disable-libquadmath-support
--enable-plugin --with-system-zlib --enable-multiarch --disable-werror --disable-multilib --with-arch=rv64imafdc
--with-abi=lp64d --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=riscv64-linux-gnu --program-prefix=riscv64-linux-gnu- --includedir=/usr/riscv64-linux-gnu/include Thread model: posix gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
root@ubuntu:/home/ubuntu/riscv/iperf-3.1.3# ./configure --prefix=$(pwd)/install --host=aarch64-linux-gnu CC=riscv64-linux-gnu-gcc CFLAGS=-static checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for aarch64-linux-gnu-strip... aarch64-linux-gnu-strip checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether to enable maintainer-specific portions of Makefiles... no checking build system type... aarch64-unknown-linux-gnu checking host system type... aarch64-unknown-linux-gnu checking for aarch64-linux-gnu-gcc... riscv64-linux-gnu-gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether riscv64-linux-gnu-gcc accepts -g... yes checking for riscv64-linux-gnu-gcc option to accept ISO C89... none needed checking whether riscv64-linux-gnu-gcc understands -c and -o together... yes checking for style of include used by make... GNU checking dependency style of riscv64-linux-gnu-gcc... gcc3 checking for aarch64-linux-gnu-ranlib... aarch64-linux-gnu-ranlib checking whether ln -s works... yes checking how to print strings... printf checking for a sed that does not truncate output... /bin/sed checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for fgrep... /bin/grep -F
make -j96
make install
root@ubuntu:/home/ubuntu/riscv/iperf-3.1.3# ls install/ bin include lib share root@ubuntu:/home/ubuntu/riscv/iperf-3.1.3# ls install/bin/ iperf3 root@ubuntu:/home/ubuntu/riscv/iperf-3.1.3# ls install/lib/ libiperf.a libiperf.la root@ubuntu:/home/ubuntu/riscv/iperf-3.1.3# make -j96
仍然有库依赖
[root@centos7 ~]# riscv64-unknown-elf-objdump -x ./usr/bin/iperf3 | grep need [root@centos7 ~]# riscv64-unknown-elf-objdump -x ./usr/bin/iperf3 | grep -i need NEEDED libiperf.so.0 NEEDED libm.so.6 NEEDED libc.so.6 VERNEED 0x0000000000010998 VERNEEDNUM 0x0000000000000001 [root@centos7 ~]# find ./ -name libiperf.so.0 ./usr/lib/libiperf.so.0 [root@centos7 ~]# find ./ -name libm.so.6 ./lib/libm.so.6 [root@centos7 ~]# find ./ -name libc.so.6 ./lib/libc.so.6 [root@centos7 ~]# riscv64-unknown-elf-objdump -x ./usr/bin/t | grep -i need tail telnet tftp timing_o top traceroute tty tee test time tlb tr truncate [root@centos7 ~]# riscv64-unknown-elf-objdump -x ./usr/sbin/tcpdump | grep -i need NEEDED libc.so.6 NEEDED ld-linux-riscv64-lp64d.so.1 VERNEED 0x0000000000001ba8 VERNEEDNUM 0x0000000000000002 [root@centos7 ~]#
./configure --prefix=$(pwd)/install --host=aarch64-linux-gnu CC=riscv64-linux-gnu-gcc CFLAGS=-static --enable-static LDFLAGS=-static --disable-shared
root@ubuntu:/home/ubuntu/riscv/iperf-3.1.3# riscv64-linux-gnu-objdump -x install/bin/iperf3 | grep -i need NEEDED libm.so.6 NEEDED libc.so.6 NEEDED ld-linux-riscv64-lp64d.so.1 VERNEED 0x00000000000113b8 VERNEEDNUM 0x0000000000000003