Skip to content

Commit c84fc63

Browse files
committed
folly: fix build on 10.12 and 10.11 with Xcode 8
1 parent 945cf78 commit c84fc63

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Formula/folly.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,24 @@ def install
3838
ENV.cxx11
3939

4040
cd "folly" do
41+
# Workaround for "no matching function for call to 'clock_gettime'"
42+
# See upstream PR from 2 Oct 2016 facebook/folly#488
43+
if DevelopmentTools.clang_build_version >= 800
44+
inreplace ["Benchmark.cpp", "Benchmark.h"] do |s|
45+
s.gsub! "detail::DEFAULT_CLOCK_ID",
46+
"(clockid_t)detail::DEFAULT_CLOCK_ID"
47+
s.gsub! "clock_gettime(CLOCK_REALTIME",
48+
"clock_gettime((clockid_t)CLOCK_REALTIME", false
49+
end
50+
end
51+
52+
# Fix "candidate function not viable: no known conversion from
53+
# 'folly::detail::Clock' to 'clockid_t' for 1st argument"
54+
# See upstream PR mentioned above
55+
if MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
56+
inreplace "portability/Time.h", "typedef uint8_t clockid_t;", ""
57+
end
58+
4159
# Build system relies on pkg-config but gflags removed
4260
# the .pc files so now folly cannot find without flags.
4361
ENV["GFLAGS_CFLAGS"] = Formula["gflags"].opt_include

0 commit comments

Comments
 (0)