Skip to content

Set defines by OS name if cross-compiling, especially for Android#901

Open
ribbons wants to merge 1 commit into
RsyncProject:masterfrom
ribbons:have-mkfifoat
Open

Set defines by OS name if cross-compiling, especially for Android#901
ribbons wants to merge 1 commit into
RsyncProject:masterfrom
ribbons:have-mkfifoat

Conversation

@ribbons
Copy link
Copy Markdown

@ribbons ribbons commented May 20, 2026

If MKNOD_CREATES_FIFOS is not defined by configure (such as when cross-compiling), mkfifo() is available but mkfifoat() is not then compilation fails since 30656c5.

(I discovered this when trying to cross-compile v3.4.3 for Android, targeting API level 21 which provides mkfifo() but not mkfifoat()).

This PR adds a configure function check for mkfifoat and updates the preprocessor conditional that wraps the call to it in syscall.c to reference HAVE_MKFIFOAT.

ribbons added a commit to ribbons/android-rsync that referenced this pull request May 21, 2026
Compilation of v3.4.3 fails due to mkfifoat() being referenced but it is
not available on Android until API level 23 (we are targeting 21 and
above).

Add patch (submitted at RsyncProject/rsync#901
for the consideration of upstream) to test specifically for the
existence of mkfifoat() before trying to call it.

Extend the build script and workflow to automatically apply patches in
the root of the repository to the fetched source and reference the
number of patches in the version number of the release.
ribbons added a commit to ribbons/android-rsync that referenced this pull request May 21, 2026
Compilation of v3.4.3 fails due to mkfifoat() being referenced but it is
not available on Android until API level 23 (we are targeting 21 and
above).

Add patch (submitted at RsyncProject/rsync#901
for the consideration of upstream) to test specifically for the
existence of mkfifoat() before trying to call it.

Extend the build script and workflow to automatically apply patches in
the root of the repository to the fetched source and reference the
number of patches in the version number of the release.
@tridge
Copy link
Copy Markdown
Member

tridge commented May 23, 2026

@ribbons I'm planning to have android builds as part of the main rsync repo, both normal builds and specific termux deb pkgs. Are you interested in helping with that? I'd like android to be tested in CI to ensure it doesn't bitrot

@ribbons
Copy link
Copy Markdown
Author

ribbons commented May 23, 2026

@tridge That sounds great! Sure thing - happy to help (though with the caveat that I've not used Termux in anger before)!

If you're happy to add another third-party action, I've had pretty good results using
ReactiveCircus/android-emulator-runner
within Actions and I'm guessing with some fiddling it should then be possible to run the test suite within the emulator as part of the CI.

On the topic of this PR, do you think this is the right approach or is it getting the correct result the wrong way? I was a bit on the fence before but seeing your workaround in 8839314 made me think it might be better to adjust configure.ac to automatically set HAVE_SOCKETPAIR, MKNOD_CREATES_FIFOS and MKNOD_CREATES_SOCKETS when cross-compiling and the target is android ? That would then both fix this specific issue and give the correct feature detection for anyone downstream performing builds.

@tridge
Copy link
Copy Markdown
Member

tridge commented May 23, 2026

@ribbons I'm leaning towards the auto-set of options, but I'd be happy to declare you as being the rsync on android maintainer and let you decide on the approach. The aim would be that rsync.samba.org downloads has usable android builds for the various architectures and environments that android uses, maybe in an android subdirectory with a readme explaining when to use which one and how to install.
Note that I've found claude quite useful in setting up these CI jobs.

@ribbons ribbons force-pushed the have-mkfifoat branch 2 times, most recently from 9e6e418 to 8a10973 Compare May 24, 2026 20:17
@ribbons
Copy link
Copy Markdown
Author

ribbons commented May 24, 2026

@tridge great, thanks - I've switched this PR to that approach instead and so HAVE_C99_VSNPRINTF, HAVE_SECURE_MKSTEMP, HAVE_SOCKETPAIR, MKNOD_CREATES_FIFOS and MKNOD_CREATES_SOCKETS should all now get defined automatically when cross-compiling for Android. I took the liberty of making HAVE_SOCKETPAIR, MKNOD_CREATES_FIFOS and MKNOD_CREATES_SOCKETS set themselves when cross-compiling for any Linux target as unless I'm mistaken it looks like they should apply to anything Linux.

@ribbons ribbons changed the title Only try falling back to mkfifoat() if it is available Set defines by OS name if cross-compiling, especially for Android May 24, 2026
The following defines set by autoconf tests always default to unset if
cross-compiling:

-  HAVE_C99_VSNPRINTF
-  HAVE_SECURE_MKSTEMP
-  HAVE_SOCKETPAIR
-  MKNOD_CREATES_FIFOS
-  MKNOD_CREATES_SOCKETS

To avoid all builds for Android needing to override the same cached
values, add some extra logic to set HAVE_C99_VSNPRINTF and
HAVE_SECURE_MKSTEMP when cross-compiling and OS name matches *android*.

Go even further with HAVE_SOCKETPAIR, MKNOD_CREATES_FIFOS and
MKNOD_CREATES_SOCKETS - as it looks like the underlying tests should
pass for any Linux based system, enable them when cross-compiling and OS
name matches *linux*.
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