FTBFS with Linux 5.13/GCC 11

Bug #1939424 reported by Sergio Durigan Junior
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
llvm-toolchain-11 (Ubuntu)
Fix Released
High
Sergio Durigan Junior

Bug Description

llvm-toolchain-11 is FTBFS'ing with Linux 5.13 because of:

[ 8%] Building CXX object projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_posix.cpp.o
cd /<<PKGBUILDDIR>>/build-llvm/projects/compiler-rt/lib/sanitizer_common && /usr/bin/g++-11 -DHAVE_RPC_XDR_H=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/<<PKGBUILDDIR>>/build-llvm/projects/compiler-rt/lib/sanitizer_common -I/<<PKGBUILDDIR>>/compiler-rt/lib/sanitizer_common -I/<<PKGBUILDDIR>>/build-llvm/include -I/<<PKGBUILDDIR>>/llvm/include -I/<<PKGBUILDDIR>>/compiler-rt/lib/sanitizer_common/.. -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O2 -DNDEBUG -g1 -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=570 -std=c++14 -o CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_posix.cpp.o -c /<<PKGBUILDDIR>>/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp
/<<PKGBUILDDIR>>/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:133:10: fatal error: linux/cyclades.h: No such file or directory
  133 | #include <linux/cyclades.h>
      | ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[5]: *** [projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/build.make:358: projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_platform_limits_posix.cpp.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make -f projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonCoverage.x86_64.dir/build.make projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonCoverage.x86_64.dir/depend
make[5]: Entering directory '/<<PKGBUILDDIR>>/build-llvm'

This is happening because the Cyclades driver has been finally removed from Linux (after being orphaned 13 years ago):

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux?h=v5.12&id=f76edd8f7ce06cdff2fe5b6b39a49644c684a161

LLVM includes cyclades.h when building libsanitizer, and therefore the FTBFS occurs.

Upstream has fixed this by removing support for Cyclades from libsanitizer:

https://github.com/llvm/llvm-project/commit/884040db086936107ec81656aa5b4c607235fb9a

As for the GCC 11 failure, the problem is:

[ 19%] Building CXX object tools/clang/utils/TableGen/CMakeFiles/obj.clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o
cd /<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/clang/utils/TableGen && /<<PKGBUILDDIR>>/build-llvm/./bin/clang++ -DCLANG_VENDOR="\"Ubuntu \"" -D_GNU_SOURCE -D__STDC_CONSTANT_M
ACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/clang/utils/TableGen -I/<<PKGBUILDDIR>>/clang/utils/TableGen -I/<<PKGBUILDDIR>
>/clang/include -I/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/clang/include -I/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/include -I/<<PKGBUILDDIR>>/llvm/include -fuse
-ld=gold -fPIC -Wno-unused-command-line-argument -Wno-unknown-warning-option -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-class-memaccess -Wno-noexcept-type -Wnon-vi
rtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O2 -DNDEBUG -g1 -fno-exceptions -std=c
++14 -o CMakeFiles/obj.clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o -c /<<PKGBUILDDIR>>/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
In file included from /<<PKGBUILDDIR>>/llvm/utils/benchmark/src/benchmark_register.cc:15:
/<<PKGBUILDDIR>>/llvm/utils/benchmark/src/benchmark_register.h:17:30: error: no member named 'numeric_limits' in namespace 'std'
  static const T kmax = std::numeric_limits<T>::max();
                        ~~~~~^
/<<PKGBUILDDIR>>/llvm/utils/benchmark/src/benchmark_register.h:17:45: error: 'T' does not refer to a value
  static const T kmax = std::numeric_limits<T>::max();
                                            ^
/<<PKGBUILDDIR>>/llvm/utils/benchmark/src/benchmark_register.h:8:20: note: declared here
template <typename T>
                   ^
/<<PKGBUILDDIR>>/llvm/utils/benchmark/src/benchmark_register.h:17:47: error: no member named 'max' in the global namespace; did you mean 'kmax'?
  static const T kmax = std::numeric_limits<T>::max();
                                              ^~~~~
                                              kmax
/<<PKGBUILDDIR>>/llvm/utils/benchmark/src/benchmark_register.h:17:18: note: 'kmax' declared here
  static const T kmax = std::numeric_limits<T>::max();

This comes from the fact that GCC 11 requires the inclusion of the <limits> header in order to access std::numeric_limits<T>. This has also been fixed upstream:

https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1

I'm preparing and testing a patch, and will attach it to this bug soon.

Tags: ftbfs patch
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

This is the patch to fix the current llvm-toolchain FTBFS.

I explained everything on the description already, but feel free to ask questions.

There's a PPA with the proposed change here:

https://launchpad.net/~sergiodj/+archive/ubuntu/ftbfs-impish/+packages

This PPA depends on the "volatile" PPA that doko is using to build the packages. Unfortunately, the llvm-toolchain package takes a long time to build, but I did verify locally that the build is passing.

One of the dep8 tests is failing locally, but the failure is not related to this change. IMO, fixing the FTBFS is orthogonal to fixing the dep8 failure, which should be done later.

tags: added: patch
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks for the patch Sergio! Also for the well explained reason why those patches are needed. I did not build the package since it takes too long but I see it built fine in the PPA so far (I'd wait until the builds end in all architectures before uploading it to the archive).

One thing that you need to fix before uploading is adding a reference to this LP bug in the changelog to close it automatically. After that, feel free to upload the package once it builds in all architectures.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the review, Lucas.

I added the proper "LP: #" snippet to the d/changelog entry, and uploaded the package now:

$ dput llvm-toolchain-11_11.0.1-2ubuntu5_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/llvm-toolchain/llvm-toolchain-11_11.0.1-2ubuntu5_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/llvm-toolchain/llvm-toolchain-11_11.0.1-2ubuntu5.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading llvm-toolchain-11_11.0.1-2ubuntu5.dsc: done.
  Uploading llvm-toolchain-11_11.0.1-2ubuntu5.debian.tar.xz: done.
  Uploading llvm-toolchain-11_11.0.1-2ubuntu5_source.buildinfo: done.
  Uploading llvm-toolchain-11_11.0.1-2ubuntu5_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package llvm-toolchain-11 - 1:11.0.1-2ubuntu5

---------------
llvm-toolchain-11 (1:11.0.1-2ubuntu5) impish; urgency=medium

  * Fix FTBFS with Linux 5.13 and GCC 11. (LP: #1939424)
    - d/p/libsanitizer-remove-cyclades.patch: Fix FTBFS with Linux 5.13,
      where the Cyclades TTY code has been removed. For this reason,
      libsanitizer's Cyclades support also needs to be removed.
    - d/p/fix-missing-include-limit.patch: Fix FTBFS with GCC 11, which now
      requires that <limits> be included if the source wants to use
      std::numeric_limits.

 -- Sergio Durigan Junior <email address hidden> Mon, 09 Aug 2021 20:05:15 -0400

Changed in llvm-toolchain-11 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.