2016-10-05 9 views
6

मैं http://llvm.org/releases/3.9.0/LLVM-3.9.0-win32.exeकैसे खिड़कियों

clang version 3.9.0 (branches/release_39) 
Target: i686-pc-windows-msvc 
Thread model: posix 
InstalledDir: C:\Program Files\LLVM\bin 

और जीसीसी 6.2.0 (Mingw-W64)

gcc (i686-posix-dwarf-rev1, Built by MinGW-W64 project) 6.2.0 
Copyright (C) 2016 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

से 3.9 बजना है पर MinGW-W64 हेडर के साथ बजना उपयोग करने के लिए मैं MSVC की जरूरत नहीं है मेरे पीसी पर स्थापित और कोई विंडोज एसडीके नहीं। मुझे क्लैंग की कुछ विशेष विशेषता की आवश्यकता है और मैं इसे जीसीसी के साथ बदलना चाहता हूं और विशेष रूप से जी ++ के साथ बदलना चाहता हूं क्योंकि मैं सी ++ का उपयोग करता हूं।

जब मैं सरल फ़ाइल संकलन करने की कोशिश मैं:

fatal error: 'string' file not found

यह मतलब यह है मेरे वर्तमान बजना स्थापना खिड़कियों पर MinGW का समर्थन नहीं करता? असल में मैं चाहता हूं कि मेरे mingw-w64 स्थापना से हेडर और libs का उपयोग करें। मैं समाधान की तलाश में था और कुछ भी नहीं मिला। मुझे नहीं पता कि मुझे क्या करना चाहिए।

क्या इसका मतलब यह भी है कि मेरी क्लैंग स्थापना एमएसवीसी पर निर्भर करती है जो मेरे पास नहीं है?

संपादित करें: इस पेज पर टिप्पणी से: http://blog.johannesmp.com/2015/09/01/installing-clang-on-windows-pt2/

This doesn't work anymore with the latest binaries (3.7.1, 3.8, 3.9) from LLVM, because these were compiled with Visual Studio and for Visual Studio.

You can install the full Visual Studio 2015 (takes about 8GB) or install "Microsoft Visual C++ Build Tools 2015 Update 3" which contains only the command line tools from VS plus the standard C++ header files that Clang needs.

मैं इसे सब कुछ बताते हैं लगता है। क्या इसका मतलब है कि मुझे मिंगव के साथ काम करने के लिए मिंगव बिल्ड की ज़रूरत है?

उत्तर

2

ऐसा करने का सही बात है, यह है ...

clang -target i686-pc-windows-gnu test.c -otest.exe 

या आप 64 बिट उत्पादन चाहते हैं, तो ...

clang -target x86_64-pc-windows-gnu test.c -otest.exe 

बजना हेडर और पुस्तकालयों के स्थान से तय करेंगे अपनी पथ। सुनिश्चित करें कि आपके पास केवल आपके पथ में मिंगव का संस्करण है जिसे आप लक्षित कर रहे हैं।

डिफ़ॉल्ट रूप से, बजना की मौजूदा रिलीज (5.0.0 अब के रूप में) को लक्षित करेंगे x86_64-pc-windows-msvc

उदाहरण के द्वारा ...

Microsoft Windows [Version 10.0.16299.19] 
(c) 2017 Microsoft Corporation. All rights reserved. 

C:\Users\burito>copy con hello.c 
#include <stdio.h> 

int main(int argc, char *argv[]) 
{ 
    printf("Hello World!\n"); 
    return 0; 
} 
^Z 
     1 file(s) copied. 

C:\Users\burito>clang hello.c -ohello.exe --verbose 
clang version 5.0.0 (tags/RELEASE_500/final) 
Target: x86_64-pc-windows-msvc 
Thread model: posix 
InstalledDir: C:\Program Files\LLVM\bin 
clang.exe: warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found] 
"C:\\Program Files\\LLVM\\bin\\clang.exe" -cc1 -triple x86_64-pc-windows- msvc18.0.0 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free - disable-llvm-verifier -discard-value-names -main-file-name hello.c -mrelocation- model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "C:\\Program Files\\LLVM\\lib\\clang\\5.0.0" -internal-isystem "C:\\Program Files\\LLVM\\lib\\clang\\5.0.0\\include" -internal-isystem C:/Program Files/Microsoft Visual Studio 10.0/VC/include -internal-isystem C:/Program Files/Microsoft Visual Studio 9.0/VC/include -internal-isystem C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include -internal-isystem C:/Program Files/Microsoft Visual Studio 8/VC/include -internal-isystem C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include -fdebug-compilation-dir "C:\\Users\\burito" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=18 -fno-threadsafe-statics -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\burito\\AppData\\Local\\Temp\\hello-5c526d.o" -x c hello.c 
clang -cc1 version 5.0.0 based upon LLVM 5.0.0 default target x86_64-pc-windows-msvc 
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 10.0/VC/include" 
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/include" 
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include" 
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/include" 
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include" 
#include "..." search starts here: 
#include <...> search starts here: 
C:\Program Files\LLVM\lib\clang\5.0.0\include 
End of search list. 
hello.c:1:10: fatal error: 'stdio.h' file not found 
#include <stdio.h> 
     ^~~~~~~~~ 
1 error generated. 

C:\Users\burito>clang hello.c -ohello.exe --verbose -target x86_64-pc-windows-gnu 
clang version 5.0.0 (tags/RELEASE_500/final) 
Target: x86_64-pc-windows-gnu 
Thread model: posix 
InstalledDir: C:\Program Files\LLVM\bin 
"C:\\Program Files\\LLVM\\bin\\clang.exe" -cc1 -triple x86_64-pc-windows-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello.c -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "C:\\Program Files\\LLVM\\lib\\clang\\5.0.0" -internal-isystem "C:\\Program Files\\LLVM\\lib\\clang\\5.0.0\\include" -internal-isystem "C:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\x86_64-w64-mingw32/sys-root/mingw/include" -internal-isystem "C:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\x86_64-w64-mingw32\\include" -internal-isystem "C:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\include" -fdebug-compilation-dir "C:\\Users\\burito" -ferror-limit 19 -fmessage-length 120 -fno-use-cxa-atexit -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\burito\\AppData\\Local\\Temp\\hello-d88ba4.o" -x c hello.c 
clang -cc1 version 5.0.0 based upon LLVM 5.0.0 default target x86_64-pc-windows-msvc 
ignoring nonexistent directory "C:\Program Files\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev0\mingw64\x86_64-w64-mingw32/sys-root/mingw/include" 
#include "..." search starts here: 
#include <...> search starts here: 
C:\Program Files\LLVM\lib\clang\5.0.0\include 
C:\Program Files\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev0\mingw64\x86_64-w64-mingw32\include 
C:\Program Files\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev0\mingw64\include 
End of search list. 
"C:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\bin\\ld.exe" -m i386pep -Bdynamic -o hello.exe "C:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\x86_64-w64-mingw32\\lib\\crt2.o" "C:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\7.2.0\\crtbegin.o" "-LC:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\7.2.0" "-LC:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\x86_64-w64-mingw32\\lib" "-LC:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\lib" "-LC:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\x86_64-w64-mingw32/sys-root/mingw/lib" "C:\\Users\\burito\\AppData\\Local\\Temp\\hello-d88ba4.o" -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt "C:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix-seh-rt_v5-rev0\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\7.2.0\\crtend.o" 

C:\Users\burito>hello 
Hello World! 

C:\Users\burito> 
+0

प्रश्न यह था कि mingw-w64 शीर्षकों के साथ इसका उपयोग कैसे करें, विभिन्न वास्तुकला के निर्माण के लिए नहीं। यह कुछ लोगों के लिए स्पष्ट नहीं है। उदाहरण के लिए जब मैंने शुरू किया तो मेरे कंप्यूटर पर कोई एमएसवीसी नहीं था लेकिन मैंने अंत में '-msvc' के साथ निर्माण करने की कोशिश की। जैसा कि आप कहते हैं कि नवीनतम रिलीज लक्ष्य डिफ़ॉल्ट रूप से msvc को लक्षित करता है और उस समय मेरी समस्या थी। अपनी नवीनतम रिलीज के बजाय gnu का उपयोग करने का चयन करने का कोई आसान तरीका नहीं था, इसलिए मेरे पास 3 तरीके थे - डाउनग्रेड करें, MSYS2 का उपयोग करें या इसे स्वयं बनाएं। – lll

+2

यह * है * MinGW-w64 शीर्षलेखों का उपयोग कैसे करें। यदि mingw इंस्टॉल किया गया है और आपके पथ में, लक्ष्य पैरामीटर यह है कि कोई क्लैंग हेडर का उपयोग कैसे करता है, बस सुनिश्चित करें कि आपने इंस्टॉल किए गए मिंगव के लिए सही बिट संस्करण चुनें। – burito

+0

मैंने अभी परीक्षण किया है, क्लैंग 3.9.0 में भी यह व्यवहार है। – burito

4

मिनीगैड के साथ निर्मित पुराने संस्करण को स्थापित करने के बाद 3.7.0 आरसी 3 यह काम करता है।

आप संस्करण i686-पीसी-Windows- gnu में अंतर बनाम i686-पीसी-Windows- MSVC नोटिस कर सकते हैं।

मुझे लगता है कि क्लैंग 3.9 भी काम करेगा अगर उन्होंने अपने स्रोत कोड में कुछ तोड़ नहीं दिया और यदि आप इसे स्वयं बनाना चाहते हैं। MingW के साथ भी नवीनतम 3.9 काम करना अच्छा लगेगा। मैं खुद को बनाने की कोशिश करने के लिए बहुत आलसी हूँ।

संपादित करें: वहाँ MinGW के लिए कुछ पैकेज भी https://github.com/Alexpux/MINGW-packages कि आप MSYS2 का उपयोग कर स्थापित कर सकते हैं कि बजना के लिए सहायता प्रदान करने लगते हैं। 3.8 और 3.9 से संबंधित कुछ काम हैं।

आशा है कि इससे किसी ऐसे व्यक्ति की मदद मिलेगी जिसमें समान समस्याएं हों।

संबंधित मुद्दे