bloomberg / clang-p2996

Experimental clang support for WG21 P2996 (Reflection).
https://github.com/bloomberg/clang-p2996/tree/p2996/P2996.md
62 stars 15 forks source link

Cannot build from source #116

Closed githubuser6000 closed 1 week ago

githubuser6000 commented 1 week ago

Describe the bug I'm trying to build from source, but this step fails like so

$ ninja -C build install clang-cpp
... 

/usr/include/c++/14/bits/unique_ptr.h:1076:30: error: no matching function for call to ‘clang::CXXBaseSpecifier::CXXBaseSpecifier(clang::SourceRange, bool&, bool&, clang::AccessSpecifier, clang::TypeSourceInfo*, clang::SourceLocation)’
 1076 |     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }

...

Is this expected? Am I using the wrong build command?

These are the build steps I'm following

RUNTIMES="libc;libunwind;libcxxabi;libcxx;compiler-rt;openmp;llvm-libgcc;offload"

$ cmake -G Ninja  \
    -B build    \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo                           \
    -DCMAKE_INSTALL_PREFIX="/home/user/.local/llvm-reflect"       \
    -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lldb;lld"   \
    -DLLVM_ENABLE_RUNTIMES="libc;libcxx;libcxxabi;libunwind"    \
    -DLLVM_RUNTIME_TARGETS="x86_64-redhat-linux"                \
    -DLLVM_HOST_TRIPLE="x86_64-redhat-linux"                    \
    -DLLVM_INSTALL_UTILS=ON                                     \
    -DLLVM_ENABLE_FFI=ON                                        \
    -DLLVM_ENABLE_ZSTD=ON                                       \
    -DLLVM_ENABLE_ZLIB=ON                                       \
    -DLLVM_BUILD_DOCS=OFF                                       \
    -DLLVM_BUILD_BENCHMARKS=OFF                                 \
    -DLIBCXX_INSTALL_MODULES=ON                                 \
    -DLLVM_BINUTILS_INCDIR=/usr/include                         \
    -DLLVM_BUILD_LLVM_DYLIB=ON                                  \
    -DLLVM_LINK_LLVM_DYLIB=ON                                   \
    -DLLVM_BINUTILS_INCDIR=/usr/include                         \
    -DLLVM_EXTERNALIZE_DEBUGINFO=ON                             \
    -DLLVM_USE_LINKER=lld                                       \
    -DLLVM_PARALLEL_{COMPILE,LINK,TABLEGEN}_JOBS=8              \
    -S llvm

$ ninja -C build install-runtimes
$ ninja -C build install clang-cpp
katzdm commented 1 week ago

Hey! I think the build of lldb in particular is broken - there was a PR a while back to try to fix that, but the contributor didn't have time to see it through. Try removing lldb from the list of enabled projects, and let me know if that works.

githubuser6000 commented 1 week ago

That seems to have worked! Thank you!

githubuser6000 commented 1 week ago

Unrelated question perhaps. Does clangd work with the reflection stuff? I can't seem to get it to work properly.

Ah, nevermind, got it working, sorry for the noise!