Skip to content

Build on older systems - #786

Merged
smcv merged 3 commits into
containers:mainfrom
ao2:build-on-older-systems
Sep 7, 2026
Merged

Build on older systems#786
smcv merged 3 commits into
containers:mainfrom
ao2:build-on-older-systems

Conversation

@ao2

@ao2 ao2 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Fix building bubblewrap on some older systems, like for example the SDK from https://gitlab.steamos.cloud/steamrt/scout/sdk

cc @smcv

Fix building with older compilers that do not default to C99 or newer,
resulting in errors like the following:

-----------------------------------------------------------------------
In file included from ../bind-mount.c:24:0:
../utils.h: In function ‘cleanup_fdsetp’:
../utils.h:260:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (size_t i = 0; i < set->len; i++)
-----------------------------------------------------------------------

This was the only occurrence of initial declarations in for loops, so
the change also realigns the code style to what is used for the rest of
the project.

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>

@smcv smcv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me, some minor issues around __NR_pivot_root.

Comment thread utils.c Outdated
ao2 added 2 commits September 7, 2026 18:04
Fix compilation warnings about `-Wunused-parameter` in
`mount_setattr_wrapper` when building on older systems that do not have
`__NR_mount_setattr`:

-----------------------------------------------------------------------
../utils.c: In function ‘mount_setattr_wrapper’:
../utils.c:1101:28: warning: unused parameter ‘dirfd’ [-Wunused-parameter]
 mount_setattr_wrapper (int dirfd, const char *path, unsigned int flags,
                            ^
../utils.c:1101:47: warning: unused parameter ‘path’ [-Wunused-parameter]
 mount_setattr_wrapper (int dirfd, const char *path, unsigned int flags,
                                               ^
../utils.c:1101:66: warning: unused parameter ‘flags’ [-Wunused-parameter]
 mount_setattr_wrapper (int dirfd, const char *path, unsigned int flags,
                                                                  ^
../utils.c:1102:43: warning: unused parameter ‘attr’ [-Wunused-parameter]
                        struct mount_attr *attr, size_t size)
                                           ^
../utils.c:1102:56: warning: unused parameter ‘size’ [-Wunused-parameter]
                        struct mount_attr *attr, size_t size)
                                                        ^
-----------------------------------------------------------------------

And while at it also fix potential similar issues in `pivot_root` on
systems that do no have `__NR_pivot_root`.

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
On some old systems it's possible that `__u64` has not been defined
already when the fallback type for `mount_attr` is declared.

So make sure `__u64` is defined by including `linux/types.h` explicitly.

On systems where the file has been included already this causes no harm
because the file should also have `#ifndef _LINUX_TYPES_H` protection
guards.

Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
@ao2
ao2 force-pushed the build-on-older-systems branch from 1df4ae3 to a6ebe83 Compare September 7, 2026 16:05
@smcv
smcv merged commit 26bb788 into containers:main Sep 7, 2026
4 checks passed
@ao2
ao2 deleted the build-on-older-systems branch September 8, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants