[llvm-bugs] [Bug 40987] New: Unknown type names 'size_t' and 'uint64_t'

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 6 14:37:46 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40987

            Bug ID: 40987
           Summary: Unknown type names 'size_t' and 'uint64_t'
           Product: libc++abi
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ca6c at bitmessage.ch
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

[The original thread is here -
http://lists.llvm.org/pipermail/cfe-dev/2019-March/061492.html]

During the compilation of libcxxabi this happens:
---
/mnt/build/src/llvm/llvm/projects/libcxxabi/include/cxxabi.h:43:26: 
error: unknown type name
       'size_t'
__cxa_allocate_exception(size_t thrown_size) throw();
                          ^
/mnt/build/src/llvm/llvm/projects/libcxxabi/include/cxxabi.h:86:52: 
error: unknown type name
       'uint64_t'
extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint64_t *);

[...and it repeats]
---

The following CMake options are used:
-DDEFAULT_SYSROOT=/mnt/build/tools/amd64 \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_C_FLAGS_MINSIZEREL_INIT="-march=native" \
-DCMAKE_CXX_FLAGS_MINSIZEREL_INIT="-march=native" \
-DCMAKE_EXE_LINKER_FLAGS_MINSIZEREL="-L/mnt/build/tools/amd64/lib" \
-DCMAKE_INSTALL_PREFIX=/mnt/build/builds/amd64/comp \
-DCMAKE_C_COMPILER=/mnt/build/tools/amd64/bin/musl-clang \
-DCMAKE_CXX_COMPILER=/mnt/build/tools/amd64/bin/clangpp \
-DCMAKE_CXX_FLAGS="-I/mnt/build/tools/amd64/include" \
-DCMAKE_LINKER=/mnt/build/tools/amd64/bin/ld.lld \
-DLLVM_TARGET_ARCH=X86 \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-pc-linux-musl \
-DLLVM_INSTALL_BINUTILS_SYMLINKS=ON \
-DLLVM_TOOL_LIBUNWIND_BUILD=ON \
-DCLANG_DEFAULT_RTLIB=compiler-rt \
-DCLANG_DEFAULT_CXX_STDLIB=libc++ \
-DCLANG_ENABLE_BOOTSTRAP=ON \
-DLIBCXX_USE_COMPILER_RT=ON \
-DLIBCXX_HAS_MUSL_LIBC=ON \
-DLIBCXXABI_USE_COMPILER_RT=ON \
-DLLVM_ENABLE_LLD=ON \
-DLLVM_ENABLE_LIBCXX=ON \
-DLLVM_INCLUDE_TESTS=NO \
-DCLANG_INCLUDE_TESTS=NO \
-DLIBCXX_INCLUDE_TESTS=NO \
-DLIBCXXABI_INCLUDE_TESTS=NO \
-DLIBCXXABI_SYSROOT=/mnt/build/tools/amd64 \
-DCMAKE_AR="/mnt/build/tools/amd64/bin/llvm-ar" \
-DCMAKE_AS="/mnt/build/tools/amd64/bin/llvm-as" \
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
-DLIBUNWIND_USE_COMPILER_RT=ON \
-DLIBCXXABI_USE_LLVM_UNWINDER=ON

bin/musl-clang is this wrapper:
---
#!/bin/sh
cc="/mnt/build/tools/amd64/bin/clang"
libc="/mnt/build/tools/amd64"
libc_inc="/mnt/build/tools/amd64/include"
libc_lib="/mnt/build/tools/amd64/lib"
thisdir="`cd "$(dirname "$0")"; pwd`"

# prevent clang from running the linker (and erroring) on no input.
sflags=
eflags=
for x ; do
    case "$x" in
        -l*) input=1 ;;
        *) input= ;;
    esac
    if test "$input" ; then
        sflags="-l-user-start"
        eflags="-l-user-end"
        break
    fi
done

exec $cc \
    -B"$thisdir" \
    -Wno-unused-command-line-argument \
    -fuse-ld=musl-clang \
    -nostdinc \
    -rtlib=compiler-rt \
    --sysroot "$libc" \
    -isystem "$libc_inc" \
    -L-user-start \
    $sflags \
    "$@" \
    $eflags \
    -L"$libc_lib" \
    -L-user-end
---

and bin/clangpp is this wrapper:
---
/mnt/build/tools/amd64/bin/clang++ $@ -rtlib=compiler-rt \
         -Wno-unused-command-line-argument \
         -nostdinc++ \
         --sysroot /mnt/build/tools/amd64 \
         -I /mnt/build/tools/amd64/include/c++/v1 \
         -stdlib=libc++ \
         -L-user-start \
         -L /mnt/build/tools/amd64/lib \
         -L-user-end \

-Wl,-dynamic-linker,/mnt/build/tools/amd64/lib/ld-musl-x86_64.so.1 \
         -dynamic-linker /mnt/build/tools/amd64/lib/ld-musl-x86_64.so.1 \
         -nodefaultlibs \
         -fuse-ld=lld -lc++ -lunwind -lc++abi -s
---
and clang++ there itself is a cross-compiler, linked against libstc++ and
libgcc

The clangpp wrapper is able to compile Hello World, and link it against musl,
libc++, libc++abi, and libunwind properly.

The underlying OS here is CentOS 7.  LLVM version 7.0.1.  There is also the
Fort compiler in the tree.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190306/9e2f53f3/attachment.html>


More information about the llvm-bugs mailing list