Compiling Iperf3 statically on gentoo and cross-platform compile as well as on other platforms
Some Warnings
- Configure doesn't like spaces in directories
I presumed you are cd into ~ or $HOME
mkdir Compile_Drop
cd Compile_Drop
sudo nano /etc/portage/package.use/openssl
and insert the line
dev-libs/openssl static-libs
Depedencies x64
sudo emerge openssl
Dependencies x86
sudo emerge openssl[abi_x86_32] --autounmask-write
sudo dispatch-conf
sudo emerge openssl[abi_x86_32]
Dependencies ARM (This step is only necessary if cross Compiling)
sudo emerge crossdev
Then follow this guide https://wiki.gentoo.org/wiki/Crossdev
crossdev --stable -t aarch64-unknown-linux-gnu
crossdev --stable -t arm-linux-gnueabi
Set static-lib use flags
sed -i 's/USE="${ARCH}"/USE="${ARCH} static-libs"/g' "/usr/aarch64-unknown-linux-gnu/etc/portage/make.conf"
sed -i 's/USE="${ARCH}"/USE="${ARCH} static-libs"/g' "/usr/arm-linux-gnueabi/etc/portage/make.conf"
Emerge and install openssl static-libs
emerge-arm-linux-gnueabi dev-libs/openssl -v
emerge-aarch64-unknown-linux-gnu dev-libs/openssl -v
./bootstrap.sh
Compile x64
./configure --enable-static-bin --disable-shared
make -j$(nproc)
strip -s src/iperf3
Compile x86
export CC="gcc -m32"
export CXX="g++ -m32"
./configure --enable-static-bin --disable-shared
make -j$(nproc)
strip -s src/iperf3
unset CC
unset CXX
Compile ARM (Something is wrong with the ARM cross compiler so only works up to v3.15)
Replace the configure command ./configure --host=arm-linux-gnueabi --enable-static-bin --with-openssl="${HOME}/Compile_Drop/opensslARM" with ./configure --host=arm-linux-gnueabi --enable-static-bin --with-openssl="${HOME}/Compile_Drop/opensslARM" --disable-shared LDFLAGS="-latomic" and compile on ubuntu instead.
# You might want to change this line to a valid directory where you compiled stored openssl
./configure --host=arm-linux-gnueabi --enable-static-bin --disable-shared
make -j$(nproc)
arm-linux-gnueabi-strip -s src/iperf3
Compile ARM64
# You might want to change this line to a valid directory where you compiled stored openssl
./configure --host=aarch64-unknown-linux-gnu --enable-static-bin --disable-shared
make -j$(nproc)
aarch64-unknown-linux-gnu-strip -s src/iperf3
- Install Cygwin
- Install Wget
- Run these commands
wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
apt-cyg install git nano make cmake extra-cmake-modules automake autoconf gcc-core gcc-g++ gdb binutils cygwin-devel w32api-headers w32api-runtime libguile3.0_1 libisl23 libmpc3 libgc1 libffi8
git clone https://github.com/esnet/iperf.git
cd iperf
./configure --enable-static-bin
make -j$(nproc)
make install
- Install Cygwin from
https://cygwin.com/setup-x86.exeviasetup-x86.exe --allow-unsupported-windows - set mirror to:
http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2022/11/23/063457 - Install wget
- Run these commands
wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
apt-cyg install git nano make cmake extra-cmake-modules automake autoconf gcc-core gcc-g++ gdb binutils cygwin-devel w32api-headers w32api-runtime libguile3.0_1 libisl23 libmpc3 libgc1 libguile2.2_1 libltdl7
git clone https://github.com/esnet/iperf.git
cd iperf
./configure --enable-static-bin
make -j$(nproc)
make install