Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 714030 - app-forensics/zzuf-0.15 : libzzuf/lib-fd.c: error: dereferencing pointer to incomplete type struct aiocb
Summary: app-forensics/zzuf-0.15 : libzzuf/lib-fd.c: error: dereferencing pointer to i...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo musl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-22 20:42 UTC by Toralf Förster
Modified: 2021-11-29 14:55 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,17.23 KB, text/plain)
2020-03-22 20:42 UTC, Toralf Förster
Details
app-forensics:zzuf-0.15:20200322-200748.log (app-forensics:zzuf-0.15:20200322-200748.log,26.25 KB, text/plain)
2020-03-22 20:42 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,278.45 KB, text/plain)
2020-03-22 20:42 UTC, Toralf Förster
Details
environment (environment,16.25 KB, text/plain)
2020-03-22 20:42 UTC, Toralf Förster
Details
etc.portage.tbz2 (etc.portage.tbz2,20.99 KB, application/x-bzip)
2020-03-22 20:42 UTC, Toralf Förster
Details
logs.tbz2 (logs.tbz2,15.37 KB, application/x-bzip)
2020-03-22 20:42 UTC, Toralf Förster
Details
temp.tbz2 (temp.tbz2,10.26 KB, application/x-bzip)
2020-03-22 20:42 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2020-03-22 20:42:07 UTC
      |                   ^
libzzuf/lib-fd.c: In function aio_read:
libzzuf/lib-fd.c:622:20: error: dereferencing pointer to incomplete type struct aiocb
  622 |     int fd = aiocbp->aio_fildes;
      |                    ^~
libzzuf/lib-fd.c:624:31: warning: passing argument 1 of aio_read_orig from incompatible pointer type [-Wincompatible-pointer-types]

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.0_musl-20200316-165821

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-gentoo-linux-musl-9.3.0 *
clang version 10.0.0 
Target: x86_64-gentoo-linux-musl
Thread model: posix
InstalledDir: /usr/lib/llvm/10/bin
/usr/lib/llvm/10
10.0.0
Available Python interpreters, in order of preference:
  [1]   python3.8
  [2]   python3.7
  [3]   python3.6
  [4]   python2.7 (fallback)
Available Ruby profiles:
  [1]   ruby24 (with Rubygems)
  [2]   ruby25 (with Rubygems) *
Available Rust versions:
  [1]   rust-1.41.1 *

timestamp of HEAD at this tinderbox image:
/var/db/repos/gentoo	Sun Mar 22 18:14:26 UTC 2020
/var/db/repos/musl	Sun Mar 22 15:02:57 UTC 2020

emerge -qpvO app-forensics/zzuf
[ebuild  N    ] app-forensics/zzuf-0.15
Comment 1 Toralf Förster gentoo-dev 2020-03-22 20:42:09 UTC
Created attachment 624570 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2020-03-22 20:42:12 UTC
Created attachment 624572 [details]
app-forensics:zzuf-0.15:20200322-200748.log
Comment 3 Toralf Förster gentoo-dev 2020-03-22 20:42:15 UTC
Created attachment 624574 [details]
emerge-history.txt
Comment 4 Toralf Förster gentoo-dev 2020-03-22 20:42:17 UTC
Created attachment 624576 [details]
environment
Comment 5 Toralf Förster gentoo-dev 2020-03-22 20:42:20 UTC
Created attachment 624578 [details]
etc.portage.tbz2
Comment 6 Toralf Förster gentoo-dev 2020-03-22 20:42:22 UTC
Created attachment 624580 [details]
logs.tbz2
Comment 7 Toralf Förster gentoo-dev 2020-03-22 20:42:25 UTC
Created attachment 624582 [details]
temp.tbz2
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2020-03-23 08:27:45 UTC
The bug here is incomplete aio.h header on musl which autoconf can't detect as working:

"""
zzuf-0.15 # fgrep -A5 'checking aio.h usability' config.log
configure:12580: checking aio.h usability
configure:12580: x86_64-gentoo-linux-musl-gcc -c -O2 -pipe -fdiagnostics-show-option -frecord-gcc-switches -std=c99 -g -O2 -Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare  conftest.c >&5
In file included from conftest.c:66:
/usr/include/aio.h:21:18: error: field 'aio_sigevent' has incomplete type
   21 |  struct sigevent aio_sigevent;
      |                  ^~~~~~~~~~~~
"""

Shorter reproducer is:

"""
$ x86_64-gentoo-linux-musl-gcc -xc -c -o /dev/null - <<<"#include <aio.h>"
<ok>

$ x86_64-gentoo-linux-musl-gcc -std=c99 -xc -c -o /dev/null - <<<"#include <aio.h>"
In file included from <stdin>:1:
/usr/include/aio.h:21:18: error: field 'aio_sigevent' has incomplete type
   21 |  struct sigevent aio_sigevent;
      |                  ^~~~~~~~~~~~
"""

For comparison glibc system Just Works:

"""
$ x86_64-pc-linux-gnu-gcc -xc -c -o /dev/null - <<<"#include <aio.h>"
$ x86_64-pc-linux-gnu-gcc -std=c99 -xc -c -o /dev/null - <<<"#include <aio.h>"
"""

I think it's a musl deficiency. Either aio.h should just work by defining complete 'struct aiocb' or it should just work by not defining 'struct aiocb' at all.
Comment 9 Marek Szuba archtester gentoo-dev 2021-11-28 19:39:00 UTC
The problem at hand can be worked around by either making the Autoconf test for aio.h pass (which can be done e.g. by appending -D_POSIX_SOURCE to CFLAGS - see the musl version of signal.h to find out which complaiance levels are required in order to have 'struct sigevent' defined), or simply override the result of this test for USE=elibc_musl by appending -DHAVE_AIO_H=1 to CFLAGS (in theory appending to CPPFLAGS should suffice, haven't tested it though). Unfortunately this only makes compilation fail slightly later - on a musl system, Autoconf ends up setting the macro FPOS64_CAST(x) to "unknown".
Comment 10 Larry the Git Cow gentoo-dev 2021-11-29 14:55:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1205600d6d0ee0d83a00c6068c93a38e7f05d07c

commit 1205600d6d0ee0d83a00c6068c93a38e7f05d07c
Author:     Marek Szuba <marecki@gentoo.org>
AuthorDate: 2021-11-29 14:06:37 +0000
Commit:     Marek Szuba <marecki@gentoo.org>
CommitDate: 2021-11-29 14:55:51 +0000

    app-forensics/zzuf: support musl in configure.ac
    
    One, call AC_USE_SYSTEM_EXTENSIONS so that all compiler invocations have
    the correct feature-set macros set. This is required so that configure
    can include the musl version of aio.h without
    
    error: field 'aio_sigevent' has incomplete type
    
    Not quite sure WHY this is necessary given that according to musl
    documentation, if no feature test macros are defined musl exposes the
    equivalent of _BSD_SOURCE - but there you go.
    
    Two, extend the test identifying the way of extracting raw position
    index from the structure fpos64_t, so that it supports the musl layout
    of this structure as well.
    
    With these two fixes in place zzuf builds successfully against musl.
    Tests (which currently have to be run manually because they like neither
    the sandbox nor out-of-tree builds) fail but in the same way as against
    glibc.
    
    Closes: https://bugs.gentoo.org/714030
    Signed-off-by: Marek Szuba <marecki@gentoo.org>

 .../zzuf/files/zzuf-0.15_autoconf-musl.patch       | 24 ++++++++++++++++++++++
 app-forensics/zzuf/zzuf-0.15_p20190208.ebuild      |  4 ++++
 2 files changed, 28 insertions(+)