From 34f1be968f731dd6c8cb1f515415d58acba8b532 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Tue, 30 Jan 2024 17:43:36 +0100 Subject: [PATCH] Fix extconf.rb to look for fdatasync in unistd.h Fix: https://github.com/Shopify/bootsnap/issues/470 --- CHANGELOG.md | 2 ++ ext/bootsnap/bootsnap.c | 1 + ext/bootsnap/extconf.rb | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb9d2f6..6c40bc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +* Fix a potential compilation issue on some systems. See #470. + # 1.18.1 * Handle `EPERM` errors when opening files with `O_NOATIME`. diff --git a/ext/bootsnap/bootsnap.c b/ext/bootsnap/bootsnap.c index 326aade..72c5b06 100644 --- a/ext/bootsnap/bootsnap.c +++ b/ext/bootsnap/bootsnap.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #ifndef O_NOATIME diff --git a/ext/bootsnap/extconf.rb b/ext/bootsnap/extconf.rb index 5d61d38..e7c1160 100644 --- a/ext/bootsnap/extconf.rb +++ b/ext/bootsnap/extconf.rb @@ -3,7 +3,7 @@ require "mkmf" if %w[ruby truffleruby].include?(RUBY_ENGINE) - have_func "fdatasync", "fcntl.h" + have_func "fdatasync", "unistd.h" unless RUBY_PLATFORM.match?(/mswin|mingw|cygwin/) append_cppflags ["_GNU_SOURCE"] # Needed of O_NOATIME