Closed Bug 1593502 Opened 1 year ago Closed 1 year ago

Failed to compile on macOS 10.15 with 10.14 SDK: "System inttypes.h not found"

Categories

(Firefox Build System :: General, defect)

x86_64
macOS
defect
Not set
normal

Tracking

(firefox72 fixed)

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: nyhvec, Assigned: rstewart)

Details

(Keywords: in-triage)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3955.4 Safari/537.36

Steps to reproduce:

Xcode version: 10.3

mozconfig content:

ac_add_options --with-ccache=/usr/local/bin/ccache
ac_add_options --with-macos-sdk=$HOME/Park/ff/macos-sdks/MacOSX10.14.sdk
CC="clang -fcolor-diagnostics"
CXX="clang++ -fcolor-diagnostics"

Actual results:

0:01.03 Clobber not needed.
0:01.03 Adding make options from /Users/nil/Park/ff/mozilla-unified/mozconfig
MOZ_OBJDIR=/Users/nil/Park/ff/mozilla-unified/out/Debug
OBJDIR=/Users/nil/Park/ff/mozilla-unified/out/Debug
FOUND_MOZCONFIG=/Users/nil/Park/ff/mozilla-unified/mozconfig
export FOUND_MOZCONFIG
0:01.05 /usr/bin/make -f client.mk -s configure
0:01.08 cd /Users/nil/Park/ff/mozilla-unified/out/Debug
0:01.09 /Users/nil/Park/ff/mozilla-unified/configure
0:01.41 Reexecuting in the virtualenv
0:01.81 Adding configure options from /Users/nil/Park/ff/mozilla-unified/mozconfig
0:01.81 --with-ccache=/usr/local/bin/ccache
0:01.81 --enable-debug-symbols
0:01.81 CC=clang -fcolor-diagnostics
0:01.81 CXX=clang++ -fcolor-diagnostics
0:01.81 CPATH=/Users/nil/Park/ff/macos-sdks/MacOSX10.14.sdk/usr/include
0:01.82 checking for vcs source checkout... hg
0:01.91 checking for a shell... /bin/sh
0:01.99 checking for host system type... x86_64-apple-darwin19.0.0
0:01.99 checking for target system type... x86_64-apple-darwin19.0.0
0:03.08 checking whether cross compiling... no
0:03.47 checking for Python 3... /usr/local/bin/python3 (3.7.5)
0:03.47 checking for hg... /usr/local/bin/hg
0:03.68 checking for Mercurial version... 5.1.1
0:03.90 checking for sparse checkout... no
0:03.91 checking for yasm... /usr/local/bin/yasm
0:03.92 checking yasm version... 1.3.0
0:03.95 checking for ccache... /usr/local/bin/ccache
0:03.97 checking for the target C compiler... /Users/nil/Park/ff/tools/clang/bin/clang
0:04.13 checking whether the target C compiler can be used... yes
0:04.13 checking the target C compiler version... 9.0.0
0:04.26 checking the target C compiler works... yes
0:04.26 checking for the target C++ compiler... /Users/nil/Park/ff/tools/clang/bin/clang++
0:04.32 checking whether the target C++ compiler can be used... yes
0:04.32 checking the target C++ compiler version... 9.0.0
0:04.46 checking the target C++ compiler works... yes
0:04.46 checking for the host C compiler... /Users/nil/Park/ff/tools/clang/bin/clang
0:04.60 checking whether the host C compiler can be used... yes
0:04.60 checking the host C compiler version... 9.0.0
0:04.71 checking the host C compiler works... yes
0:04.71 checking for the host C++ compiler... /Users/nil/Park/ff/tools/clang/bin/clang++
0:04.78 checking whether the host C++ compiler can be used... yes
0:04.78 checking the host C++ compiler version... 9.0.0
0:04.89 checking the host C++ compiler works... yes
0:04.97 ERROR: System inttypes.h not found. Please try running open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg and following the instructions to install the necessary headers
0:05.03 *** Fix above errors and then restart with "./mach build"
0:05.03 make: *** [configure] Error 1

macOS_SDK_headers_for_macOS_10.14.pkg is unable to install on macOS 10.15 since it checks the OS version:

❯ sudo installer -pkg ./macOS_SDK_headers_for_macOS_10.14.pkg -target /
Password:
installer: Cannot install on volume / because it is disabled.
installer: The version of macOS is too new.

Summary: Failed to compile on macOS 10.15 with 10.14 SDK → Failed to compile on macOS 10.15 with 10.14 SDK: "System inttypes.h not found"

weird... I removed ccache caches and error no longer occured.

No. There's nothing to do with ccache. If I put

CC="clang -fcolor-diagnostics"
CXX="clang++ -fcolor-diagnostics"

in mozconfig, this error occurs again.

Component: Untriaged → General
OS: Unspecified → macOS
Product: Firefox → Firefox Build System
Hardware: Unspecified → x86_64
Assignee: nobody → rstewart
Attached patch patchSplinter Review

Hi Haonan, can you patch this change into your workspace and see if the build succeeds? I can't reproduce the failure on my end but I'm taking a shot in the dark here. If this resolves the issue, let me know and I'll submit this; otherwise I'll try another route.

Flags: needinfo?(rebuilty)

Previous problem solved but another error occured :(

0:26.81 checking for CoreMedia/CoreMedia.h... no
0:26.81 configure: error: MacOS X 10.9 SDK or later is required
0:26.85 DEBUG: <truncated - see config.log for full output>
0:26.85 DEBUG: 1 error generated.
0:26.85 DEBUG: configure: failed program was:
0:26.85 DEBUG: #line 9534 "configure"
0:26.85 DEBUG: #include "confdefs.h"
0:26.86 DEBUG: #include <linux/ethtool.h>
0:26.86 DEBUG: int main() {
0:26.86 DEBUG: struct ethtool_cmd cmd; cmd.speed_hi = 0;
0:26.86 DEBUG: ; return 0; }
0:26.86 DEBUG: configure:9570: checking for CoreMedia/CoreMedia.h
0:26.86 DEBUG: configure:9580: /usr/local/bin/ccache /Users/nil/Park/ff/tools/clang/bin/clang -E -fcolor-diagnostics -std=gnu99 -Qunused-arguments -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong conftest.c >/dev/null 2>conftest.out
0:26.86 DEBUG: configure:9576:10: fatal error: 'CoreMedia/CoreMedia.h' file not found
0:26.86 DEBUG: #include <CoreMedia/CoreMedia.h>
0:26.86 DEBUG: ^~~~~~~~~~~~~~~~~~~~~~~
0:26.86 DEBUG: configure:9576:10: note: did not find header 'CoreMedia.h' in framework 'CoreMedia' (loaded from '/System/Library/Frameworks')
0:26.86 DEBUG: 1 error generated.
0:26.86 DEBUG: configure: failed program was:
0:26.86 DEBUG: #line 9575 "configure"
0:26.86 DEBUG: #include "confdefs.h"
0:26.86 DEBUG: #include <CoreMedia/CoreMedia.h>
0:26.86 DEBUG: configure: error: MacOS X 10.9 SDK or later is required
0:26.86 ERROR: old-configure failed
0:26.90 *** Fix above errors and then restart with "./mach build"
0:26.90 make: *** [configure] Error 1

Flags: needinfo?(rebuilty)

Try removing -fcolor-diagnostics from CC and CXX. You can also revert the proposed patch.

Tried

CC="clang"
CXX="clang++"

in mozconfig and the build could run. However any clang commandline argument(even CC="clang --verbose") will cause ERROR: System inttypes.h not found. failure.

The problem is here: https://dxr.mozilla.org/mozilla-central/rev/d271c572a9bcd008ed14bf104b2eb81949952e4c/build/moz.configure/toolchain.configure#963-976

If the provided CC/CXX contains flags, then we don't add -isysroot (which comes from prepare_flags).

Pushed by rstewart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d3c959c0b75a
Build system does not add -isysroot to the command-line flags for compiler invocations when the provided_compiler has additional flags r=glandium
Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.