Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: libtrace: errors due to undeclared stat64/lstat64 structs (musl libc) #6610

Open
kmk3 opened this issue Jan 15, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@kmk3
Copy link
Collaborator

kmk3 commented Jan 15, 2025

Description

The build_src_package (Alpine/musl) GitLab CI job is currently failing.

Steps to Reproduce

From https://gitlab.com/Firejail/firejail_ci/-/jobs/8853165146:

install/configure

$ apk add build-base linux-headers gawk
(1/23) Installing libgcc (14.2.0-r4)
(2/23) Installing jansson (2.14-r4)
(3/23) Installing libstdc++ (14.2.0-r4)
(4/23) Installing zstd-libs (1.5.6-r2)
(5/23) Installing binutils (2.43.1-r1)
(6/23) Installing libmagic (5.46-r2)
(7/23) Installing file (5.46-r2)
(8/23) Installing libgomp (14.2.0-r4)
(9/23) Installing libatomic (14.2.0-r4)
(10/23) Installing gmp (6.3.0-r2)
(11/23) Installing isl26 (0.26-r1)
(12/23) Installing mpfr4 (4.2.1-r0)
(13/23) Installing mpc1 (1.3.1-r1)
(14/23) Installing gcc (14.2.0-r4)
(15/23) Installing libstdc++-dev (14.2.0-r4)
(16/23) Installing musl-dev (1.2.5-r8)
(17/23) Installing g++ (14.2.0-r4)
(18/23) Installing make (4.4.1-r2)
(19/23) Installing fortify-headers (1.1-r5)
(20/23) Installing patch (2.7.6-r10)
(21/23) Installing build-base (0.5-r3)
(22/23) Installing gawk (5.3.1-r0)
(23/23) Installing linux-headers (6.6-r1)
Executing busybox-1.37.0-r9.trigger
OK: 250 MiB in 38 packages
$ ./ci/printenv.sh
nproc:  2
kernel: Linux 5.15.154+ #1 SMP Sat May 4 12:14:42 UTC 2024 x86_64
distro: Alpine Linux v3.21
sh:     /bin/busybox
user:   uid=0(root) gid=0(root)

[/etc/os-release]
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.21.2
PRETTY_NAME="Alpine Linux v3.21"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
$ ./configure --prefix=/usr || (cat config.log; exit 1)
checking for gcc... 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... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for codespell... no
checking for cppcheck... no
checking for gawk... gawk
checking for gzip... gzip
checking for scan-build... no
checking for strip... strip
checking for tar... tar
checking whether C compiler accepts -MMD -MP... yes
checking whether C compiler accepts -D_FORTIFY_SOURCE=2... yes
checking whether C compiler accepts -mindirect-branch=thunk... yes
checking whether C compiler accepts -fstack-clash-protection... yes
checking whether C compiler accepts -fstack-protector-strong... yes
checking for pkg-config... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for linux/landlock.h... yes
checking for linux/seccomp.h... yes
configure: creating ./config.status
config.status: creating config.mk
config.status: creating config.sh

Compile options:
   CC: gcc
   CFLAGS: -g -O2
   CPPFLAGS: 
   LDFLAGS: 
   EXTRA_CFLAGS:  -D_FORTIFY_SOURCE=2 -mindirect-branch=thunk -fstack-clash-protection -fstack-protector-strong
   DEPS_CFLAGS:  -MMD -MP
   EXTRA_LDFLAGS: 
   LIBS: 
   fatal warnings: 
   gcov instrumentation: 
   install as a SUID executable: -DHAVE_SUID
   install contrib scripts: yes
   prefix: /usr
   sysconfdir: /etc
   Spectre compiler patch: yes

Features:
   allow tmpfs as regular user: -DHAVE_USERTMPFS
   always enforce filters: 
   apparmor: 
   busybox workaround: no
   chroot: -DHAVE_CHROOT
   DBUS proxy support: -DHAVE_DBUSPROXY
   disable user profiles: 
   enable --output logging: -DHAVE_OUTPUT
   file transfer support: -DHAVE_FILE_TRANSFER
   global config: -DHAVE_GLOBALCFG
   IDS support: 
   Landlock support: -DHAVE_LANDLOCK
   manpage support: -DHAVE_MAN
   network: -DHAVE_NETWORK
   overlayfs support: 
   private home support: -DHAVE_PRIVATE_HOME
   private lib support: 
   sandbox check: -DHAVE_SANDBOX_CHECK
   SELinux labeling support: 
   user namespace: -DHAVE_USERNS
   X11 sandboxing support: -DHAVE_X11

Errors:

$ make
[...]
make -C src/libtrace/
make[1]: Entering directory '/builds/Firejail/firejail_ci/src/libtrace'
gcc -ggdb -O2 -DVERSION='"0.9.73"' -Wall -Wextra  -Wformat -Wformat-security -fstack-protector-all -DPREFIX='"/usr"' -DSYSCONFDIR='"/etc/firejail"' -DLIBDIR='"/usr/lib"' -DBINDIR='"/usr/bin"' -DVARDIR='"/var/lib/firejail"' -MMD -MP -fPIC -g -O2  -c ../../src/libtrace/libtrace.c -o ../../src/libtrace/libtrace.o
../../src/libtrace/libtrace.c:451:59: warning: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration
  451 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *statbuf);
      |                                                           ^~~~~~
../../src/libtrace/libtrace.c:453:41: warning: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration
  453 | int stat64(const char *pathname, struct stat64 *statbuf) {
      |                                         ^~~~~~
../../src/libtrace/libtrace.c: In function 'stat64':
../../src/libtrace/libtrace.c:457:40: error: passing argument 2 of 'orig_stat64' from incompatible pointer type [-Wincompatible-pointer-types]
  457 |         int rv = orig_stat64(pathname, statbuf);
      |                                        ^~~~~~~
      |                                        |
      |                                        struct stat64 *
../../src/libtrace/libtrace.c:457:40: note: expected 'struct stat64 *' but argument is of type 'struct stat64 *'
../../src/libtrace/libtrace.c: At top level:
../../src/libtrace/libtrace.c:476:60: warning: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration
  476 | typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *statbuf);
      |                                                            ^~~~~~
../../src/libtrace/libtrace.c:478:42: warning: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration
  478 | int lstat64(const char *pathname, struct stat64 *statbuf) {
      |                                          ^~~~~~
../../src/libtrace/libtrace.c: In function 'lstat64':
../../src/libtrace/libtrace.c:482:41: error: passing argument 2 of 'orig_lstat64' from incompatible pointer type [-Wincompatible-pointer-types]
  482 |         int rv = orig_lstat64(pathname, statbuf);
      |                                         ^~~~~~~
      |                                         |
      |                                         struct stat64 *
../../src/libtrace/libtrace.c:482:41: note: expected 'struct stat64 *' but argument is of type 'struct stat64 *'
make[1]: Leaving directory '/builds/Firejail/firejail_ci/src/libtrace'
make[1]: *** [../../src/so.mk:25: ../../src/libtrace/libtrace.o] Error 1
make: *** [Makefile:72: src/libtrace/libtrace.so] Error 2

Environment

  • Name/version/arch of the Linux kernel (uname -srm): Linux 5.15.154+ #1 SMP Sat May 4 12:14:42 UTC 2024 x86_64
  • Name/version of the Linux distribution (e.g. "Ubuntu 20.04" or "Arch Linux"):
    Alpine Linux v3.21
  • Name/version of the C compiler (e.g. "gcc 14.1.1-1"): gcc (14.2.0-r4)
  • Name/version of the libc (e.g. "glibc 2.40-1"): musl-dev (1.2.5-r8)
  • Name/version of the Linux API headers (e.g. "linux-api-headers 6.10-1" on
    Arch Linux): linux-headers (6.6-r1)
  • Version of the source code being built (git rev-parse HEAD):
    e6de48c

Relates to:

@kmk3 kmk3 added the bug Something isn't working label Jan 15, 2025
kmk3 added a commit to kmk3/firejail that referenced this issue Jan 15, 2025
Build log[1]:

    $ make
    [...]
    make -C src/libtrace/
    make[1]: Entering directory '/builds/Firejail/firejail_ci/src/libtrace'
    gcc -ggdb -O2 -DVERSION='"0.9.73"' [...]  -c ../../src/libtrace/libtrace.c -o ../../src/libtrace/libtrace.o
    ../../src/libtrace/libtrace.c:451:59: warning: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration
      451 | typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *statbuf);
          |                                                           ^~~~~~
    ../../src/libtrace/libtrace.c:453:41: warning: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration
      453 | int stat64(const char *pathname, struct stat64 *statbuf) {
          |                                         ^~~~~~
    ../../src/libtrace/libtrace.c: In function 'stat64':
    ../../src/libtrace/libtrace.c:457:40: error: passing argument 2 of 'orig_stat64' from incompatible pointer type [-Wincompatible-pointer-types]
      457 |         int rv = orig_stat64(pathname, statbuf);
          |                                        ^~~~~~~
          |                                        |
          |                                        struct stat64 *
    ../../src/libtrace/libtrace.c:457:40: note: expected 'struct stat64 *' but argument is of type 'struct stat64 *'
    ../../src/libtrace/libtrace.c: At top level:
    ../../src/libtrace/libtrace.c:476:60: warning: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration
      476 | typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *statbuf);
          |                                                            ^~~~~~
    ../../src/libtrace/libtrace.c:478:42: warning: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration
      478 | int lstat64(const char *pathname, struct stat64 *statbuf) {
          |                                          ^~~~~~
    ../../src/libtrace/libtrace.c: In function 'lstat64':
    ../../src/libtrace/libtrace.c:482:41: error: passing argument 2 of 'orig_lstat64' from incompatible pointer type [-Wincompatible-pointer-types]
      482 |         int rv = orig_lstat64(pathname, statbuf);
          |                                         ^~~~~~~
          |                                         |
          |                                         struct stat64 *
    ../../src/libtrace/libtrace.c:482:41: note: expected 'struct stat64 *' but argument is of type 'struct stat64 *'
    make[1]: Leaving directory '/builds/Firejail/firejail_ci/src/libtrace'

Environment: gcc (14.2.0-r4), musl-dev (1.2.5-r8) on Alpine Linux v3.21.

Relates to netblue30#6610.

[1] https://gitlab.com/Firejail/firejail_ci/-/jobs/8853165146
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant