Skip to content

Backport cstdint patch for building with Clang #273

Open
@GZGavinZhao

Description

@GZGavinZhao

llvm#101761 should be backported to the ROCm 6.4 release, otherwise when building llvm-project 6.4.0 release on Clang 19 with libstdc++ 14.2.0, it fails with the following error appears:

[10/4951] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o
FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o
/usr/lib64/ccache/bin/clang++ -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build/YPKG/root/rocm-llvm/build/llvm-project-rocm-6.4.0/solusBuildDir/lib/Support -I/home/build/YPKG/root/rocm-llvm/build/llvm-project-rocm-6.4.0/llvm/lib/Support -I/home/build/YPKG/root/rocm-llvm/build/llvm-project-rocm-6.4.0/solusBuildDir/include -I/home/build/YPKG/root/rocm-llvm/build/llvm-project-rocm-6.4.0/llvm/include -fPIC -fno-semantic-interposition -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 -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Werror=global-constructors -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o -c /home/build/YPKG/root/rocm-llvm/build/llvm-project-rocm-6.4.0/llvm/lib/Support/Allocator.cpp
In file included from ../llvm/lib/Support/Allocator.cpp:13:
In file included from ../llvm/include/llvm/Support/Allocator.h:20:
../llvm/include/llvm/ADT/SmallVector.h:119:62: error: use of undeclared identifier 'uint64_t'
  119 |     std::conditional_t<sizeof(T) < 4 && sizeof(void *) >= 8, uint64_t,
      |                                                              ^
../llvm/include/llvm/ADT/SmallVector.h:124:27: error: use of undeclared identifier 'SmallVectorSizeType'
  124 |   alignas(SmallVectorBase<SmallVectorSizeType<T>>) char Base[sizeof(
      |                           ^
../llvm/include/llvm/ADT/SmallVector.h:125:23: error: use of undeclared identifier 'SmallVectorSizeType'
  125 |       SmallVectorBase<SmallVectorSizeType<T>>)];
      |                       ^
../llvm/include/llvm/ADT/SmallVector.h:134:30: error: use of undeclared identifier 'SmallVectorSizeType'
  134 |     : public SmallVectorBase<SmallVectorSizeType<T>> {
      |                              ^
../llvm/include/llvm/ADT/SmallVector.h:135:32: error: use of undeclared identifier 'SmallVectorSizeType'
  135 |   using Base = SmallVectorBase<SmallVectorSizeType<T>>;
      |                                ^
../llvm/include/llvm/ADT/SmallVector.h:275:9: error: use of undeclared identifier 'Base'
  275 |   using Base::capacity;
      |         ^
../llvm/include/llvm/ADT/SmallVector.h:276:9: error: use of undeclared identifier 'Base'
  276 |   using Base::empty;
      |         ^
../llvm/include/llvm/ADT/SmallVector.h:277:9: error: use of undeclared identifier 'Base'
  277 |   using Base::size;
      |         ^
../llvm/include/llvm/ADT/SmallVector.h:148:44: error: member initializer 'Base' does not name a non-static data member or base class
  148 |   SmallVectorTemplateCommon(size_t Size) : Base(getFirstEl(), Size) {}
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~
../llvm/include/llvm/ADT/SmallVector.h:151:5: error: use of undeclared identifier 'Base'
  151 |     Base::grow_pod(getFirstEl(), MinSize, TSize);
      |     ^
../llvm/include/llvm/ADT/SmallVector.h:156:39: error: no member named 'BeginX' in 'SmallVectorTemplateCommon<T, type-parameter-0-1>'
  156 |   bool isSmall() const { return this->BeginX == getFirstEl(); }
      |                                 ~~~~  ^
../llvm/include/llvm/ADT/SmallVector.h:160:11: error: no member named 'BeginX' in 'SmallVectorTemplateCommon<T, type-parameter-0-1>'
  160 |     this->BeginX = getFirstEl();
      |     ~~~~  ^
../llvm/include/llvm/ADT/SmallVector.h:161:11: error: no member named 'Size' in 'SmallVectorTemplateCommon<T, type-parameter-0-1>'
  161 |     this->Size = this->Capacity = 0; // FIXME: Setting Capacity to 0 is suspect.
      |     ~~~~  ^
../llvm/include/llvm/ADT/SmallVector.h:161:24: error: no member named 'Capacity' in 'SmallVectorTemplateCommon<T, type-parameter-0-1>'
  161 |     this->Size = this->Capacity = 0; // FIXME: Setting Capacity to 0 is suspect.
      |                  ~~~~  ^
../llvm/include/llvm/ADT/SmallVector.h:193:26: error: no member named 'size' in 'SmallVectorTemplateCommon<T, type-parameter-0-1>'
  193 |     if (NewSize <= this->size())
      |                    ~~~~  ^
../llvm/include/llvm/ADT/SmallVector.h:197:29: error: no member named 'capacity' in 'SmallVectorTemplateCommon<T, type-parameter-0-1>'
  197 |     return NewSize <= this->capacity();
      |                       ~~~~  ^
../llvm/include/llvm/ADT/SmallVector.h:210:55: error: no member named 'size' in 'SmallVectorTemplateCommon<T, type-parameter-0-1>'
  210 |     this->assertSafeToReferenceAfterResize(Elt, this->size() + N);
      |                                                 ~~~~  ^
../llvm/include/llvm/ADT/SmallVector.h:280:45: error: no member named 'BeginX' in 'SmallVectorTemplateCommon<T, type-parameter-0-1>'
  280 |   iterator begin() { return (iterator)this->BeginX; }
      |                                       ~~~~  ^
../llvm/include/llvm/ADT/SmallVector.h:281:63: error: no member named 'BeginX' in 'SmallVectorTemplateCommon<T, type-parameter-0-1>'
  281 |   const_iterator begin() const { return (const_iterator)this->BeginX; }
      |                                                         ~~~~  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Under InvestigationgenericBuild error, or some other issue not caused by an LLVM bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions