[Fuego] Fix for libaio issues in Fuego

Bird, Timothy Tim.Bird at sony.com
Fri Aug 4 02:19:41 UTC 2017

Hi all,

I'm posting a patch that I used to fix a libaio issue with Fuego, for review.

I've already put this patch into my 'next' branch,  but I thought I'd post it
on the mailing list so that anyone who has additional ideas or who
wishes to review it can do so.

I finally got to the bottom of a bug with LTP builds that's been bothering me
for a long time.  LTP would sometimes fail to build one of it's sub-programs
io_submit01.  This was due to an issue with LTP's configure script having a
mismatch between its detection of libaio.h and libaio.so.  The issue boiled
down to installation of libaio-dev:armhf by the install_cross_toolchain.sh
script.  It turns out that installing a different architecture removes any
previously installed libaio-dev package (even for different architectures).
See  http://bird.org/fuego-1.2/Issue_0048 for more details.

Although /lib/<toolchain>/libaio.so.* was present, the symlink in
/usr/lib/<toolchain>/ was getting removed when a new toolchain
was installed.  I kept manually installing libaio-dev for different architectures
and other ones would keep get removed without me noticing.  This
was frustrating, as I would get LTP working on one board, then when
I switched to another board and fixed it there, it would stop working 
on the first.  Ugh.

See the fix in the patch below.  Let me know if you have any feedback.

 -- Tim

>From f3899e414f56eadbf8980ab985b3d309a0dcffa6 Mon Sep 17 00:00:00 2001
From: Tim Bird <tim.bird at sony.com>
Date: Thu, 3 Aug 2017 15:56:41 -0700
Subject: [PATCH] toolchains: fix issue with libaio-dev:$ARCH installation

Change the way libaio-dev:$ARCH is installed.  If it is
installed with 'apt-get install' it will remove another version
of libaio-dev, which results in boards for that architecture having
build failures.  In particular, if libaio-dev:armhf is installed,
then LTP builds for docker will start failing with an
error linking the test program io_submit01.  This is due
to configure getting confused because /usr/include/libaio.h
is present, but /usr/lib/<toolchain_dir>/libaio.so is missing
(for x64_64, in this case).

Instead of installing libaio-dev with apt-get, do a direct package
download, extract the files, and only install a
one file and symlink from /usr/lib/<toolchain_dir> into
the docker container.

See Fuego Issue 0048 for more details.

Signed-off-by: Tim Bird <tim.bird at sony.com>
 fuego-ro/toolchains/install_cross_toolchain.sh | 29 +++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/fuego-ro/toolchains/install_cross_toolchain.sh b/fuego-ro/toolchains/install_cross_toolchain.sh
index 7b4f8d9..86d3973 100755
--- a/fuego-ro/toolchains/install_cross_toolchain.sh
+++ b/fuego-ro/toolchains/install_cross_toolchain.sh
@@ -17,6 +17,14 @@ case $ARCH in
+# use working directory as a lock
+if [ -d /tmp/toolchain_install ] ; then
+    echo "Cannout use /tmp/toolchain_install as it's already present"
+    echo "Try again after other operation completes, or you remove it manually"
+    exit
+mkdir -p /tmp/toolchain_install
 echo deb http://emdebian.org/tools/debian/ jessie main > /etc/apt/sources.list.d/crosstools.list
 dpkg --add-architecture $ARCH
 curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -
@@ -24,4 +32,23 @@ DEBIAN_FRONTEND=noninteractive apt-get update
 DEBIAN_FRONTEND=noninteractive apt-get -yV install crossbuild-essential-$ARCH
 # libaio is needed for LTP
-DEBIAN_FRONTEND=noninteractive apt-get -yV install libaio-dev:$ARCH
+DEBIAN_FRONTEND=noninteractive apt-get -yV install libaio1:$ARCH
+# manually install libio-dev from the arch-specific libaio-dev debian package
+# (because 'apt-get install' removes any other libaio-dev package installed)
+echo "Install libaio-dev:$ARCH... (in a way that's a bit tricky)"
+cd /tmp/toolchain_install
+echo "  current directory: $(pwd)"
+apt-get download libaio-dev:$ARCH
+PKG=$(echo libaio-dev*.deb)
+echo "  downloaded package: $PKG"
+toolchain_dir=$(dpkg --contents $PKG | grep /usr/lib | head -n 2 | tail -n 1 | cut -b 59- )
+echo "  toolchain_dir: $toolchain_dir"
+# extract the package contents
+dpkg -x $PKG .
+# copy the file and symlink we need
+cp -vd usr/lib/${toolchain_dir}libaio.* /usr/lib/${toolchain_dir}
+# clean up
+rm -rf /tmp/toolchain_install

More information about the Fuego mailing list