Build-script fails with strange error

build-script fails with error:

Warning, treated as error:

/Users/-------/Documents/Apple/swift/docs/proposals/UnsupportedOptimizationAttributes.rst:18:undefined label: transparent-attribute (if the link has no caption the label must precede a section header)

[463/1834][ 25%][392.153s] Building CXX object stdlib/publi...swiftRemoteMirror-macosx-x86_64.dir/SwiftRemoteMirror.cpp.o

ninja: build stopped: subcommand failed.

ERROR: command terminated with a non-zero exit status 1, aborting

What's the problem with the build? Is this because of some problems with UnsupportedOptimizationAttributes.rst? How to fix this?

Regards,
Valeriy Van

I encountered it too.
The fix has been merged: [docs] Fix link in UnsupportedOptimizationAttributes.rst. by dan-zheng · Pull Request #31587 · apple/swift · GitHub

Thank you.
This error gone.

Runnings ./swift/utils/build-script --clean --xcode --release-debuginfo --debug-swift I still get error. May be you know what this error might mean:

The following build commands failed:

CompileC /Users/valeriyvan/Documents/Apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/tools/SourceKit/tools/sourcekitd-repl/Swift.build/Debug/sourcekitd-repl.build/Objects-normal/x86_64/sourcekitd-repl.o tools/SourceKit/tools/sourcekitd-repl/sourcekitd-repl.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler

(1 failure)

ERROR: command terminated with a non-zero exit status 65, aborting

Regards,
Valeriy Van

Hi Valeriy: I don't think you shared the actual error message.
Are there messages (maybe starting with error: ...) that provide info about the compilation error?

Some random ideas:

  • Try passing --reconfigure to utils/build-script.
  • Try re-running utils/update-checkout.
  • Try a clean build. I haven't seen the above issue, so maybe you have some bad local state.

I always just remove manually build folder before running build script. I guess I't kind of equivalent of running build scrip with --clean. And there for it doesn't make any sense run build script with --reconfigure. Also I do re-run of update-checkout. Trying following recommendation about Xcode version I installed Xcode 11.4 (and sure, I did xcode-select). Whatever I do I can't build without errors. The last error I have:

/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:317:9: error: no member named 'signbit' in the global namespace
using ::signbit;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:318:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:319:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/math.h:749:12: note: 'finite' declared here
extern int finite(double)
^
In file included from /Users/valeriyvan/Documents/Apple/swift/tools/SourceKit/tools/sourcekitd-repl/sourcekitd-repl.cpp:15:
In file included from /Users/valeriyvan/Documents/Apple/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:12:
In file included from /Users/valeriyvan/Documents/Apple/llvm-project/llvm/include/llvm/ADT/Hashing.h:47:
In file included from /Users/valeriyvan/Documents/Apple/llvm-project/llvm/include/llvm/Support/DataTypes.h:16:
In file included from /Users/valeriyvan/Documents/Apple/llvm-project/llvm/include/llvm-c/DataTypes.h:28:
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:320:9: error: no member named 'isinf' in the global namespace
using ::isinf;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:321:9: error: no member named 'isnan' in the global namespace
using ::isnan;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:322:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:323:9: error: no member named 'isgreater' in the global namespace
using ::isgreater;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:324:9: error: no member named 'isgreaterequal' in the global namespace
using ::isgreaterequal;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:325:9: error: no member named 'isless' in the global namespace
using ::isless;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:326:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:327:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:328:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:329:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
~~^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:335:9: error: no member named 'abs' in the global namespace; did you mean 'fabs'?
using ::abs;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/math.h:417:15: note: 'fabs' declared here
extern double fabs(double);
^
In file included from /Users/valeriyvan/Documents/Apple/swift/tools/SourceKit/tools/sourcekitd-repl/sourcekitd-repl.cpp:15:
In file included from /Users/valeriyvan/Documents/Apple/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:12:
In file included from /Users/valeriyvan/Documents/Apple/llvm-project/llvm/include/llvm/ADT/Hashing.h:47:
In file included from /Users/valeriyvan/Documents/Apple/llvm-project/llvm/include/llvm/Support/DataTypes.h:16:
In file included from /Users/valeriyvan/Documents/Apple/llvm-project/llvm/include/llvm-c/DataTypes.h:28:
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:640:26: error: no template named 'numeric_limits'
bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:640:60: error: no template named 'numeric_limits'
bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:641:18: error: no template named 'numeric_limits'
int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:641:50: error: no template named 'numeric_limits'
int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
^
/Applications/Xcode11.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:646:17: error: no template named 'numeric_limits'
static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

One thing to try, check in llvm-project that you have the swift/master branch of llvm checked out, rather than the master branch. I mess that up a lot and it causes weird problems like this.

—Dan

llvm-project is on swift/master branch.

This one looks like SR-12726 to me. I've previously reported it in "Is anyone else getting this error when building the compiler from `master` on macOS? - #3 by Max_Desiatov". Seems like the only known way to fix that is to delete the command line tools package or (re)move directories that it installed.

2 Likes