Skip to content

Commit 87e6392

Browse files
roxellbhcopeland
authored andcommitted
check-environment: add fuse3 detection and cross pkg-config fallback
On arm64 runners the fuse check fails: FAIL - gcc can build against libfuse FAIL - x86_64-linux-gnu-gcc can build against libfuse Debian testing dropped libfuse-dev and only has libfuse3-dev. The check script did not know about fuse3. The cross pkg-config binary may also not be executable on the build host. Add fuse3 detection. Fall back to native pkg-config when the cross binary cannot execute. Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
1 parent de6bde2 commit 87e6392

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

tuxmake/runtime/bin/tuxmake-check-environment

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,22 @@ sub check_compiler_libc($) {
111111
check_compile_program("${compiler} can produce binaries using the libc", $compiler, undef, "#include <stdio.h>\n" . $PROGRAM, !$optional_compile_fatal);
112112
}
113113

114-
my $fuse_program = <<PROGRAM;
114+
my $fuse_program_fuse2 = <<PROGRAM;
115115
#include <fuse.h>
116116
int main(int argc, char *argv[])
117117
{
118118
return fuse_main(argc, argv, NULL);
119119
}
120120
PROGRAM
121121

122+
my $fuse_program_fuse3 = <<PROGRAM;
123+
#include <fuse3/fuse.h>
124+
int main(int argc, char *argv[])
125+
{
126+
return fuse_main(argc, argv, NULL);
127+
}
128+
PROGRAM
129+
122130
sub check_compiler_fuse($$) {
123131
my $compiler = shift;
124132
my $prefix = shift || '';
@@ -128,7 +136,19 @@ sub check_compiler_fuse($$) {
128136
skip("not checking for development packages on Debian < 11");
129137
return;
130138
}
131-
my $fuse_flags = `${prefix}pkg-config fuse --libs --cflags`;
139+
my $fuse_pkg = "fuse";
140+
my $fuse_program = $fuse_program_fuse2;
141+
# cross pkg-config may be a foreign binary that cannot execute on the build
142+
# host, fall back to native pkg-config when that happens
143+
my $pc = "${prefix}pkg-config";
144+
if ($prefix && system("$pc --version >/dev/null 2>&1") != 0) {
145+
$pc = "pkg-config";
146+
}
147+
if (system("$pc --exists fuse3 2>/dev/null") == 0) {
148+
$fuse_pkg = "fuse3";
149+
$fuse_program = $fuse_program_fuse3;
150+
}
151+
my $fuse_flags = `$pc ${fuse_pkg} --libs --cflags 2>/dev/null`;
132152
chomp $fuse_flags;
133153
check_compile_program("${compiler} can build against libfuse", ${compiler}, $fuse_flags, $fuse_program, !$optional_compile_fatal);
134154
}

0 commit comments

Comments
 (0)