Skip to contentSkip to conversation

Can we build fio statically with both libaio and posixaio?

DISCUSSION Professor Pro 2 participants 2 messages May 26, 2021 – Jun 11, 2021

lore
Share & tools
lore
#0 lore raw

I'm missing reason why fio can not be built statically with both libaio and posixaio

Here is simplest way to reproduce on clear linux using docker ubuntu image:

echo '
url=https://brick.kernel.dk/snaps/fio-3.26.tar.gz libaio=https://pagure.io/libaio/archive/libaio-0.3.112/libaio-libaio-0.3.112.tar.gz apt-get update
apt-get install libc6-dev build-essential autoconf autoconf make wget -y -q work=/build/fio-src
mkdir -p $work
rm -rf $work/*
cd $work
rm -rf $work/*
wget -q -nv --no-check-certificate -O _fio.tgz $url
wget -q -nv --no-check-certificate -O _libaio.tgz $libaio
tar xzf _fio.tgz
rm -f _fio.tgz
tar xzf _libaio.tgz
rm -f _libaio.tgz

# build libaio
cd lib*
make prefix=/usr/local install
cd ../fio*
# build fio
./configure --prefix=/usr/local --build-static | tee configure.log
make -j && make install && echo "SUCCESS. $(fio --version) engines:" && fio --enghelp | tail -n +2 | sort
cat configure.log | grep "AIO"
' > /tmp/reproduce-missing-posixaio.sh
time docker run -t --rm -v/tmp/reproduce-missing-posixaio.sh:/tmp/reproduce-missing-posixaio.sh ubuntu:20.04 bash /tmp/reproduce-missing-posixaio.sh

OUTPUT is
SUCCESS. fio-3.26 engines:
        cpuio
        e4defrag
        falloc
        filecreate
        filestat
        ftruncate
        io_uring
        libaio
        mmap
        mtd
        net
        netsplice
        null
        psync
        pvsync
        pvsync2
        sg
        splice
        sync
        vsync
Linux AIO support             yes
Linux AIO support rw flags    yes
POSIX AIO support             no
POSIX AIO support needs -lrt  no
POSIX AIO fsync               no
Solaris AIO support           no

According to man [https://man7.org/linux/man-pages/man7/aio.7.html] posix aio was introduced in glibc 2.1. Another words, libc6-dev 2.31 is preinstalled but posixaio is not available for static build?

Can we build fio statically with both libaio and posixaio?

Thanks in advance
Vlad

#1 lore raw

Hi,

Quoted 12 lines · Professor Pro

I'm missing reason why fio can not be built statically with both libaio and posixaio

Here is simplest way to reproduce on clear linux using docker ubuntu image:

echo '
url=https://brick.kernel.dk/snaps/fio-3.26.tar.gz libaio=https://pagure.io/libaio/archive/libaio-0.3.112/libaio-libaio-0.3.112.tar.gz apt-get update
apt-get install libc6-dev build-essential autoconf autoconf make wget -y -q work=/build/fio-src

<snip>

Quoted 10 lines
# build libaio
cd lib*
make prefix=/usr/local install
cd ../fio*
# build fio
./configure --prefix=/usr/local --build-static | tee configure.log
make -j && make install && echo "SUCCESS. $(fio --version) engines:" &&
fio --enghelp | tail -n +2 | sort
cat configure.log | grep "AIO"

<snip>

Quoted 8 lines
Linux AIO support             yes
Linux AIO support rw flags    yes
POSIX AIO support             no
POSIX AIO support needs -lrt  no
POSIX AIO fsync               no
Solaris AIO support           no
Quoted 6 lines

According to man [https://man7.org/linux/man-pages/man7/aio.7.html]
posix aio was introduced in glibc 2.1.
Another words, libc6-dev 2.31 is preinstalled but posixaio is not available for static build?

Can we build fio statically with both libaio and posixaio?

Probably not both without a large amount of effort.

Whether you can build fio statically with Linux AIO depends entirely on whether you have a static (.a) version of of libaio library in your library search path. Since you're building libaio by hand it's up to you to check the paths/fiddle with environment variables... FWIW I thought Debian-like distros like Ubuntu actually shipped a static libaio in libaio-dev (e.g.
https://packages.ubuntu.com/focal/amd64/libaio-dev/filelist ) so I'm unsure why you need to build your own...

For the POSIX AIO failure you would have to look through config.log. My guess is that when you use posixaio on Linux it also needs libpthread to be available and perhaps this is something that doesn't take place when doing a static build (i.e. try adding -lpthread after -lrt in the fio configure script). Note that the posixaio I/O engine on Linux is somewhat slow and won't achieve high concurrency when multiple I/Os are targeting the same file descriptor.

--
Sitsofe