如何在Winodws上使用MINGW构建Clang? [英] How to build clang with MINGW on winodws?

查看:137
本文介绍了如何在Winodws上使用MINGW构建Clang?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows 8上使用MINGW从源代码构建clang.

I am trying to build clang from the source code using MINGW on Windows 8.

我从llvm的官方页面上下载了clang的源代码和其他必要的工具

I downloaded the clang from the source and other necessary tools from the official page of llvm

clang-llvm源代码: git clone https://github.com/llvm/llvm-project.git

clang-llvm source code : git clone https://github.com/llvm/llvm-project.git

cmake和ninja ,就像在下一页

http://clang.llvm.org/docs/LibASTMatchersTutorial.html

我正在终端上运行并给出以下命令

I m running on terminal and giving the following commands

cmake -GNinja -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt" -DCMAKE_BUILD_TYPE=Release /path/to/llvm 

所以cmake在运行文件夹中输出一些文件

So cmake output some files in the folder where it is running

但是在下一步中,如果我给忍者

But In the next step If I give ninja

5个步骤后,出现以下错误

after 5 step it is giving following error

In file included from ../lib/Demangle/ItaniumDemangle.cpp:14:0:
../include/llvm/Demangle/ItaniumDemangle.h: In instantiation of 'void llvm::itanium_demangle::FloatLiteralImpl<Float>::printLeft(llvm::itanium_demangle::OutputStream&) const [with Float = long double]':
../lib/Demangle/ItaniumDemangle.cpp:587:1:   required from here
../include/llvm/Demangle/ItaniumDemangle.h:2177:23: warning: unknown conversion type character 'L' in format [-Wformat=]
       int n = snprintf(num, sizeof(num), FloatData<Float>::spec, value);
                       ^
../include/llvm/Demangle/ItaniumDemangle.h:2177:23: warning: too many arguments for format [-Wformat-extra-args]
       int n = snprintf(num, sizeof(num), FloatData<Float>::spec, value);
               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/llvm/Demangle/ItaniumDemangle.h: In instantiation of 'void llvm::itanium_demangle::FloatLiteralImpl<Float>::printLeft(llvm::itanium_demangle::OutputStream&) const [with Float = double]':
../lib/Demangle/ItaniumDemangle.cpp:587:1:   required from here
../include/llvm/Demangle/ItaniumDemangle.h:2177:23: warning: unknown conversion type character 'a' in format [-Wformat=]
       int n = snprintf(num, sizeof(num), FloatData<Float>::spec, value);
                       ^
../include/llvm/Demangle/ItaniumDemangle.h:2177:23: warning: too many arguments for format [-Wformat-extra-args]
       int n = snprintf(num, sizeof(num), FloatData<Float>::spec, value);
               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/llvm/Demangle/ItaniumDemangle.h: In instantiation of 'void llvm::itanium_demangle::FloatLiteralImpl<Float>::printLeft(llvm::itanium_demangle::OutputStream&) const [with Float = float]':
../lib/Demangle/ItaniumDemangle.cpp:587:1:   required from here
../include/llvm/Demangle/ItaniumDemangle.h:2177:23: warning: unknown conversion type character 'a' in format [-Wformat=]
       int n = snprintf(num, sizeof(num), FloatData<Float>::spec, value);
                       ^
../include/llvm/Demangle/ItaniumDemangle.h:2177:23: warning: too many arguments for format [-Wformat-extra-args]
       int n = snprintf(num, sizeof(num), FloatData<Float>::spec, value);
               ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[22/4328] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Chrono.cpp.obj
FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/Chrono.cpp.obj
C:\MinGW\bin\g++.exe  -DGTEST_HAS_RTTI=0 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I../lib/Support -Iinclude -I../include -std=c++11 -Werror=date-time -std=gnu++14 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment  -O2 -DNDEBUG    -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Chrono.cpp.obj -MF lib\Support\CMakeFiles\LLVMSupport.dir\Chrono.cpp.obj.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Chrono.cpp.obj -c ../lib/Support/Chrono.cpp
../lib/Support/Chrono.cpp: In function 'tm llvm::getStructTM(llvm::sys::TimePoint<>)':
../lib/Support/Chrono.cpp:35:15: error: '::localtime_s' has not been declared
   int Error = ::localtime_s(&Storage, &OurTime);
               ^~
[25/4328] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj
FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj
C:\MinGW\bin\g++.exe  -DGTEST_HAS_RTTI=0 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I../lib/Support -Iinclude -I../include -std=c++11 -Werror=date-time -std=gnu++14 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment  -O2 -DNDEBUG    -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj -MF lib\Support\CMakeFiles\LLVMSupport.dir\CodeGenCoverage.cpp.obj.d -o lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj -c ../lib/Support/CodeGenCoverage.cpp
In file included from ../lib/Support/CodeGenCoverage.cpp:18:0:
../include/llvm/Support/Mutex.h:29:12: error: 'recursive_mutex' in namespace 'std' does not name a type
       std::recursive_mutex impl;
            ^~~~~~~~~~~~~~~
../include/llvm/Support/Mutex.h: In member function 'bool llvm::sys::SmartMutex<mt_only>::lock()':
../include/llvm/Support/Mutex.h:35:11: error: 'impl' was not declared in this scope
           impl.lock();
           ^~~~
../include/llvm/Support/Mutex.h: In member function 'bool llvm::sys::SmartMutex<mt_only>::unlock()':
../include/llvm/Support/Mutex.h:48:11: error: 'impl' was not declared in this scope
           impl.unlock();
           ^~~~
../include/llvm/Support/Mutex.h: In member function 'bool llvm::sys::SmartMutex<mt_only>::try_lock()':
../include/llvm/Support/Mutex.h:62:18: error: 'impl' was not declared in this scope
           return impl.try_lock();
                  ^~~~
[26/4328] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.obj
FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.obj
C:\MinGW\bin\g++.exe  -DGTEST_HAS_RTTI=0 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I../lib/Support -Iinclude -I../include -std=c++11 -Werror=date-time -std=gnu++14 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment  -O2 -DNDEBUG    -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.obj -MF lib\Support\CMakeFiles\LLVMSupport.dir\CachePruning.cpp.obj.d -o lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.obj -c ../lib/Support/CachePruning.cpp
In file included from ../lib/Support/CachePruning.cpp:16:0:
../include/llvm/Support/Errc.h:65:23: error: 'not_supported' is not a member of 'std::errc'
   not_supported = int(std::errc::not_supported),
                       ^~~
[27/4328] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.obj
ninja: build stopped: subcommand failed.

为什么clang在Windows中是依赖的?在Windows上构建clang时,我在做什么错了?

Why clang is dependent in Windows.? What is the wrong thing I am doing When building clang on windows.?

请让我知道是否有解决方案.

Please let me know if there is any solution .

推荐答案

我有同样的问题.我只是用Chocolatey来安装clang.
https://chocolatey.org/
安装此程序后,以管理员身份打开Windows Power Shell,然后键入以下命令:
choco install llvm .
这应该安装编译器.

I had the same probem. I just used chocolatey to install clang.
https://chocolatey.org/
After you install this, open windows power shell as administrator, and type this command:
choco install llvm.
This should install the compiler.

这篇关于如何在Winodws上使用MINGW构建Clang?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆