[llvm-dev] Compiling LLVM with locally built clang | Errors

SANJAY SRIVALLABH SINGAPURAM via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 27 07:43:27 PST 2017


Hello Kevin,

The error doesn't seem to be with sending C++  options to clang. Here's the
CMake output,
-- Performing Test CXX_SUPPORTS_CXX11
-- Performing Test CXX_SUPPORTS_CXX11 - Failed
CMake Error at cmake/modules/HandleLLVMOptions.cmake:511 (message):
  LLVM requires C++11 support but the '-std=c++11' flag isn't supported.
Call Stack (most recent call first):
  CMakeLists.txt:578 (include)

The configuration runs fine when LLVM_ENABLE_LLD is set to OFF. But, when
enabled, the debug stops at the test checking for C++11 support,
-- Performing Test CXX_SUPPORTS_CXX11
-- Performing Test CXX_SUPPORTS_CXX11 - Failed
CMake Error at cmake/modules/HandleLLVMOptions.cmake:511 (message):
  LLVM requires C++11 support but the '-std=c++11' flag isn't supported.
Call Stack (most recent call first):
  CMakeLists.txt:578 (include)

These lines of CMakeError.log reveal that clang++ actually fails because of
"-fuse-ld=lld",
[...] ( the following test is the only one that sends -std=c++11 to clang++
)
Performing C++ SOURCE FILE Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR
failed with the following output:
Change Dir: /home/sanjay/Software/polly/llvm_build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/ninja" "cmTC_9cfd8"
[1/2] Building CXX object CMakeFiles/cmTC_9cfd8.dir/src.cxx.o
[2/2] Linking CXX executable cmTC_9cfd8
FAILED: : && /home/sanjay/Software/clang_vanilla/llvm_build/bin/clang++
-Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -pedantic
-Wno-long-long -DCXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR  -std=c++11
-Werror=non-virtual-dtor  -fuse-ld=lld CMakeFiles/cmTC_9cfd8.dir/src.cxx.o
 -o cmTC_9cfd8  -lm && :
clang-5.0: error: invalid linker name in argument '-fuse-ld=lld'
ninja: build stopped: subcommand failed.

Source file was:
class base {public: virtual void anchor();protected: ~base();};
                                 class derived final : public base {
public: ~derived();};
                                 int main() { return 0; }
[...]
Performing C++ SOURCE FILE Test CXX_SUPPORTS_WERROR_DATE_TIME failed with
the following output:
Change Dir: /home/sanjay/Software/polly/llvm_build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/ninja" "cmTC_39bc5"
[1/2] Building CXX object CMakeFiles/cmTC_39bc5.dir/src.cxx.o
[2/2] Linking CXX executable cmTC_39bc5
FAILED: : && /home/sanjay/Software/clang_vanilla/llvm_build/bin/clang++
-Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -pedantic
-Wno-long-long -Wno-comment -DCXX_SUPPORTS_WERROR_DATE_TIME  -fuse-ld=lld
CMakeFiles/cmTC_39bc5.dir/src.cxx.o  -o cmTC_39bc5  -lm && :
clang-5.0: error: invalid linker name in argument '-fuse-ld=lld'
ninja: build stopped: subcommand failed.

Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test CXX_SUPPORTS_CXX11 failed with the
following output:
Change Dir: /home/sanjay/Software/polly/llvm_build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/ninja" "cmTC_25a8d"
[1/2] Building CXX object CMakeFiles/cmTC_25a8d.dir/src.cxx.o
[2/2] Linking CXX executable cmTC_25a8d
FAILED: : && /home/sanjay/Software/clang_vanilla/llvm_build/bin/clang++
-Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -pedantic
-Wno-long-long -Wno-comment -DCXX_SUPPORTS_CXX11  -fuse-ld=lld
CMakeFiles/cmTC_25a8d.dir/src.cxx.o  -o cmTC_25a8d  -lm && :
clang-5.0: error: invalid linker name in argument '-fuse-ld=lld'
ninja: build stopped: subcommand failed.

Source file was:
int main() { return 0; }
(EOF)

It's odd that cmake reports that clang++ failed on "-std=c++11" when the
problem was with "-fuse-ld=lld".

Also, do I have to explicitly indicate that lld needs to be built when
building LLVM ? ( I couldn't find lld in llvm_build/bin )

Thank You,
Sanjay Srivallabh

On Mon, Feb 27, 2017 at 5:05 PM Flamedoge <code.kchoi at gmail.com> wrote:

This might be error from `clang -std=c++11 a.c`. I would dump out and see
what commands CMake is running to check if it's feeding c++ options to c
files.

Regards,
Kevin

On Sun, Feb 26, 2017 at 11:11 PM, SANJAY SRIVALLABH SINGAPURAM via llvm-dev
<llvm-dev at lists.llvm.org> wrote:

Hello,

I issued the following command to point the build to use clang and clang++,
from a local llvm build directory included in PATH, instead of
/usr/bin/{cc,c++},

cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm_src

The configuration failed with the error stating the compiler didn't
recognize '-std=c++11' flag, whereas clang compiled a dummy c++ file with
warnings.

int main(){return 0;} ( which was used during the config, found in
build/CMakeFiles/CMakeErrors.log )

How can I resolve this ?

Thank You,
Sanjay

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170227/1777b8ea/attachment.html>


More information about the llvm-dev mailing list