Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gollvm: build.ninja file is not created, in case if -DLLVM_ENABLE_RUNTIMES=compiler-rt;libcxx passed #40407

Closed
advancedwebdeveloper opened this issue Jul 26, 2020 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@advancedwebdeveloper
Copy link

While I was able to compile https://go.googlesource.com/gollvm/ project, by using
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
and corresponding GNU C++ compiler - I am surprised by LLVM related project, like such a Go front-end, was compiled with GCC (at least - the authors of the README file shared those commands/build instructions).

So I decided to compile using
$ clang -v
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
Candidate multilib: .;@m64
Selected multilib: .;@m64

and
$ cmake --version
cmake version 3.16.3

with https://libcxx.llvm.org/ (instead of https://gcc.gnu.org/onlinedocs/libstdc++/ ). Just to be more LLVM'ish, out here.

So while I was able to figure out (not without help of @jroelofs ) that I would have to rely on the following CMake's params:

$cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++ -D CMAKE_C_COMPILER=clang -DCMAKE_CXX_FLAGS=-stdlib=libc++ '-DLLVM_ENABLE_RUNTIMES=compiler-rt;libcxx' -DLLVM_USE_LINKER=gold -DLLVM_TARGETS_TO_BUILD=X86 -G Ninja ../llvm-project/llvm

However it looks like I am getting some errors, which avoid generating the build.ninja file :

CMake Error at /usr/share/cmake-3.16/Modules/ExternalProject.cmake:2962 (get_property):
get_property could not find TARGET clang-resource-headers. Perhaps it has
not yet been created.
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/ExternalProject.cmake:3239 (_ep_add_configure_command)
cmake/modules/LLVMExternalProjectUtils.cmake:234 (ExternalProject_Add)
runtimes/CMakeLists.txt:239 (llvm_ExternalProject_Add)
runtimes/CMakeLists.txt:301 (builtin_default_target)

.
My CMakeCache.txt contains the following line:

LLVM_ENABLE_RUNTIMES:STRING=compiler-rt;libcxx
so looks like the params where passed properly.

In the same time - I am able to run CMake with

$cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++ -D CMAKE_C_COMPILER=clang -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DLLVM_USE_LINKER=gold -DLLVM_TARGETS_TO_BUILD=X86 -G Ninja ../llvm-project/llvm

and generate build.ninja .

$ninja -j ... gollvm
allows to compile, by using Clang's C++ compiler, which I can track

408458 ubuntu 20 0 161824 78924 35912 R 94.1 1.0 0:01.26 clang++
408460 ubuntu 20 0 158608 75872 35776 R 88.2 0.9 0:01.18 clang++
.

I am not sure but it could relate to [https://reviews.llvm.org/D58791](https://reviews.llvm.org /D58791) . I am not sure that I do understand the cause - but I am attaching my logs, which reflect the situation around included runtime enablement.

Ivan

CMakeOutput.log
CMakeError.log

@ianlancetaylor ianlancetaylor changed the title [gollvm] build.ninja file is not created, in case if -DLLVM_ENABLE_RUNTIMES=compiler-rt;libcxx passed gollvm: build.ninja file is not created, in case if -DLLVM_ENABLE_RUNTIMES=compiler-rt;libcxx passed Jul 26, 2020
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 26, 2020
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Jul 26, 2020
@ianlancetaylor
Copy link
Contributor

CC @thanm @cherrymui

@advancedwebdeveloper
Copy link
Author

It looks like enabling those is not required.
I will stink to linking against a pre-compiled version of libc++.

This could be closed.
Ivan

@erifan erifan closed this as completed Aug 3, 2020
@golang golang locked and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants