3
3
import subprocess as sp
4
4
5
5
explain_LLVM_COMPILER = """
6
+
6
7
The environment variable 'LLVM_COMPILER' is a switch. It should either
7
8
be set to 'clang' or 'dragonegg'. Anything else will cause an error.
9
+
8
10
"""
9
11
10
12
explain_LLVM_DRAGONEGG_PLUGIN = """
11
- You need to set the environment variable LLVM_DRAGONEGG_PLUGIN to the full path
12
- to your dragonegg plugin. Thanks.
13
+
14
+ You need to set the environment variable LLVM_DRAGONEGG_PLUGIN to the
15
+ full path to your dragonegg plugin. Thanks.
16
+
17
+ """
18
+
19
+ explain_LLVM_CC_NAME = """
20
+
21
+ If your clang compiler is not called clang, but something else, then
22
+ you will need to set the environment variable LLVM_CC_NAME to the
23
+ appropriate string. For example if your clang is called clang-3.5 then
24
+ LLVM_CC_NAME should be set to clang-3.5.
25
+
26
+ """
27
+
28
+ explain_LLVM_CXX_NAME = """
29
+
30
+ If your clang++ compiler is not called clang++, but something else,
31
+ then you will need to set the environment variable LLVM_CXX_NAME to
32
+ the appropriate string. For example if your clang++ is called ++clang
33
+ then LLVM_CC_NAME should be set to ++clang.
34
+
35
+ """
36
+
37
+ explain_LLVM_COMPILER_PATH = """
38
+
39
+ Your compiler should either be in your PATH, or else located where the
40
+ environment variable LLVM_COMPILER_PATH indicates. It can also be used
41
+ to indicatethe directory that contains the other LLVM tools such as
42
+ llvm-link, and llvm-ar.
43
+
13
44
"""
14
45
15
46
class Checker (object ):
@@ -74,9 +105,6 @@ def checkDragonegg(self):
74
105
cc = '{0}{1}gcc' .format (self .path , pfx )
75
106
cxx = '{0}{1}g++' .format (self .path , pfx )
76
107
77
- (ccOk , ccVersion ) = self .checkExecutable (cc )
78
- (cxxOk , cxxVersion ) = self .checkExecutable (cxx )
79
-
80
108
return self .checkCompilers (cc , cxx )
81
109
82
110
@@ -130,7 +158,16 @@ def checkCompilers(self, cc, cxx):
130
158
if not cxxOk :
131
159
print 'The CXX compiler {0} was not found or not executable.\n Better not try using wllvm++!\n ' .format (cxx )
132
160
else :
133
- print 'The C++ compiler {0} is:\n {1}\n ' .format (cxx , cxxVersion )
161
+ print 'The C++ compiler {0} is:\n \n {1}\n ' .format (cxx , cxxVersion )
162
+
163
+ if not ccOk or not cxxOk :
164
+ print explain_LLVM_COMPILER_PATH
165
+ if not ccOk :
166
+ print explain_LLVM_CC_NAME
167
+ if not cxxOk :
168
+ print explain_LLVM_CXX_NAME
169
+
170
+
134
171
135
172
return ccOk or cxxOk
136
173
@@ -142,7 +179,12 @@ def checkExecutable(self, exe, version_switch='-v'):
142
179
output = compiler .communicate ()
143
180
compilerOutput = '{0}{1}' .format (output [0 ], output [1 ])
144
181
except OSError as e :
145
- return (False , '{0} not found or not executable' .format (exe ))
182
+ if e .errno == errno .EPERM :
183
+ return (False , '{0} not executable' .format (exe ))
184
+ elif e .errno == errno .ENOENT :
185
+ return (False , '{0} not found' .format (exe ))
186
+ else :
187
+ return (False , '{0} not sure why, errno is {1}' .format (exe , e .errno ))
146
188
else :
147
189
return (True , compilerOutput )
148
190
@@ -159,11 +201,11 @@ def checkAuxiliaries(self):
159
201
if not linkOk :
160
202
print 'The bitcode linker {0} was not found or not executable.\n Better not try using extract-bc!\n ' .format (link )
161
203
else :
162
- print 'The bitcode linker {0} is:\n {1}\n ' .format (link , linkVersion )
204
+ print 'The bitcode linker {0} is:\n \n {1}\n ' .format (link , linkVersion )
163
205
164
206
if not arOk :
165
207
print 'The bitcode archiver {0} was not found or not executable.\n Better not try using extract-bc!\n ' .format (ar )
166
208
else :
167
- print 'The bitcode archiver {0} is:\n {1}\n ' .format (ar , arVersion )
209
+ print 'The bitcode archiver {0} is:\n \n {1}\n ' .format (ar , arVersion )
168
210
169
211
0 commit comments