Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#61555 closed defect (fixed)

clang-10: 10.0.1_3 build fails on sanitizer_platform_limits_posix.cpp

Reported by: blair (Blair Zajac) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: cjones051073 (Chris Jones)
Port: clang-10

Description

On 10.15.7 with Xcode 12.2 building 10.0.1_3 fails:

[ 15%] Building CXX object projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_posix.cpp.o
cd /opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/build/projects/compiler-rt/lib/sanitizer_common && /usr/bin/clang++ -DHAVE_RPC_XDR_H=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/build/projects/compiler-rt/lib/sanitizer_common -I/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/llvm-10.0.1.src/projects/compiler-rt/lib/sanitizer_common -I/opt/local/include/libxml2 -I/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/build/include -I/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/llvm-10.0.1.src/include -I/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/llvm-10.0.1.src/projects/compiler-rt/lib/sanitizer_common/.. -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Wall -std=c++14 -Wno-unused-parameter -DNDEBUG -arch arm64 -arch x86_64 -arch x86_64h -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk  -stdlib=libc++ -mmacosx-version-min=10.10 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -fPIC -fno-builtin -fno-exceptions -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -std=c++14 -o CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_posix.cpp.o -c /opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/llvm-10.0.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/llvm-10.0.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:174:31: error: invalid application of 'sizeof' to an incomplete type 'struct stat64'
  unsigned struct_stat64_sz = sizeof(struct stat64);
                              ^     ~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/llvm-10.0.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:174:45: note: forward declaration of '__sanitizer::stat64'
  unsigned struct_stat64_sz = sizeof(struct stat64);
                                            ^
/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/llvm-10.0.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:200:33: error: invalid application of 'sizeof' to an incomplete type 'struct statfs64'
  unsigned struct_statfs64_sz = sizeof(struct statfs64);
                                ^     ~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/llvm-10.0.1.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:200:47: note: forward declaration of '__sanitizer::statfs64'
  unsigned struct_statfs64_sz = sizeof(struct statfs64);
                                              ^
2 errors generated.
make[2]: Leaving directory `/opt/local/var/macports/build/_Users_blairzajac_Code_MacPorts_macports-ports.git_lang_llvm-10/clang-10/work/build'
make[1]: *** [projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Change History (13)

comment:1 Changed 4 years ago by blair (Blair Zajac)

Owner: set to kencu
Status: newassigned

comment:2 Changed 4 years ago by kencu (Ken)

That is the exact error we just fixed in clang-9.0 and 10.0.

We decided it was being caused by compiler_rt trying to build +universal with arm64 included, but that clang version was not handling it correctly.

We disabled the arm64 build by forcing the arches.

Are you right-up-to-date with this patch <https://github.com/macports/macports-ports/commit/de3b2c09de90fdb69c5bdc1ba14444d9e92c2eba#diff-75a7064672f7786bd2d4c739ca50f73874ea2975347f471159a672a91d6bb0d7>?

comment:3 Changed 4 years ago by kencu (Ken)

maybe the test is not quite right...

comment:4 Changed 4 years ago by kencu (Ken)

It might also have something to do with this:

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

That is going to be a symlink to the MacOSX11.0.sdk, and so it will try to build ARM (as it sees support in that SDK).

So we need to enable this test for > darwin18 not 19 I suspect.

We need to be able to force these builds (qt5 15.1 as well) to use the OS-specific SDK (10.15) and we are not seemingly doing that -- although the compiler_rt part of this tends to do it's own thing with respect to searching out SDKs, to be honest...

comment:5 Changed 4 years ago by kencu (Ken)

Cc: cjones051073 added

comment:6 Changed 4 years ago by kencu (Ken)

@chris -- FYI -- not quite got it yet.

comment:7 Changed 4 years ago by kencu (Ken)

simplest, right-now thing is to enable the arch forcing on > darwin18 I think...

comment:8 Changed 4 years ago by blair (Blair Zajac)

Ken, my git checkout is at https://github.com/macports/macports-ports/commit/3d688b45d5279f2aeea588e065aeb586aa754480 which is newer than the commit you mention.

comment:9 Changed 4 years ago by cjones051073 (Chris Jones)

One possibility is to change the condition to check on xcode version instead if darwin version.

But, yeah, the forced arches are anyway what should be picked automatically so forcing them on Darwin 19 as well is probably fine too.

Version 0, edited 4 years ago by cjones051073 (Chris Jones) (next)

comment:10 Changed 4 years ago by cjones051073 (Chris Jones)

Blair, its not expected that the commit Ken pointed you at would fix things in your case, as we only force the arches on darwin 20. We didnt consider the possibility that users on darwin 19 with xcode 12.2 would see it as well...

comment:11 Changed 4 years ago by kencu (Ken)

Let's just build without arm64 on these clang versions. I'll change the darwin test.

comment:12 Changed 4 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

In eabdb0eeb3be18992b55a5bfcd05fe0b0a6e43d0/macports-ports (master):

clang-[9.0-10]: force compiler_rt archs

we need to also force compiler_rt to not build arm64
on 10.15, which it will attempt to do if Xcode12
finds the MacOSX11.0.sdk.

add a platform test
condense the comments somewhat

closes: #61555

comment:13 Changed 4 years ago by kencu (Ken)

blair -- thanks for spotting this so quickly. I believe we have it now. Please let me know if otherwise. -- Ken

Note: See TracTickets for help on using tickets.