• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Fixing Compilation and Building Errors
2
3
4## "ImportError: No module named apt_pkg" is displayed during the execution of an unidentifiable command
5
6- **Symptom**
7
8  The message "ImportError: No module named apt_pkg" is displayed when an unidentifiable command is executed on the Linux server.
9
10- **Possible Causes**
11
12  There is a compatibility issue of python3-apt.
13
14- **Solution**
15
16  Reinstall python3-apt.
17
18
19  ```
20  sudo apt-get remove  python3-apt
21  sudo apt-get install python3-apt
22  ```
23
24
25## The message indicating Python cannot be found is displayed during the build process
26
27- **Symptom**
28
29  The following information is displayed during the build process:
30
31
32  ```
33  -bash: /usr/bin/python: No such file or directory
34  ```
35
36- **Possible Cause 1**
37
38  Python is not installed.
39
40- **Solution**
41
42  Run the following command to install Python. The following uses Python 3.8 as an example.
43
44
45  ```
46  sudo apt-get install python3.8
47  ```
48
49- **Possible Cause 2**
50
51  The soft link to Python does not exist in the **usr/bin** directory.
52
53  ![faq-python-error](figures/faq-python-error.png)
54
55- **Solution**
56
57  Run the following commands to add the soft link to Python:
58
59
60  ```
61  # cd /usr/bin/
62  # which python3
63  # ln -s /usr/local/bin/python3 python
64  # python --version
65  ```
66
67  Example:
68
69  ![faq-python-add-soft-link](figures/faq-python-add-soft-link.png)
70
71
72## The message indicating Python 3 cannot be found is displayed during the build process
73
74- **Symptom**
75
76  ![faq-python3-not-found](figures/faq-python3-not-found.png)
77
78- **Possible Causes**
79
80  Python 3 is not installed.
81
82- **Solution**
83
84  Run the following command to install Python 3:
85
86
87  ```
88  sudo apt-get install python3.8
89  ```
90
91
92## "configure: error: no acceptable C compiler found in $PATH" is displayed during Python 3 installation
93
94- **Symptom**
95
96  The following information is displayed during the Python 3 installation process:
97
98
99  ```
100  configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
101  ```
102
103- **Possible Causes**
104
105  GCC is not installed.
106
107- **Solution**
108  1. Run the **apt-get install gcc** command to install **gcc** online.
109  2. Install Python 3.
110
111
112## "-bash: make: command not found" is displayed during Python 3 installation
113
114- **Symptom**
115
116  The following information is displayed during the Python 3 installation process:
117
118
119  ```
120  -bash: make: command not found
121  ```
122
123- **Possible Causes**
124
125  make is not installed.
126
127- **Solution**
128  1. Run the **apt-get install make** command to install make online.
129  2. Install Python 3.
130
131
132## "No module named '_ctypes'" is displayed during Python 3 installation
133
134- **Symptom**
135
136  The following information is displayed during the Python 3 installation process:
137
138
139  ```
140  ModuleNotFoundError: No module named '_ctypes'
141  ```
142
143- **Possible Causes**
144
145  libffi and libffi-devel are not installed.
146
147- **Solution**
148  1. Run the **apt-get install libffi* -y** command to install libffi and libffi-devel online.
149  2. Install Python 3.
150
151
152## "No module named 'Crypto'" is displayed during the build process
153
154- **Symptom**
155
156  The following information is displayed during the build process:
157
158
159  ```
160  ModuleNotFoundError: No module named 'Crypto'
161  ```
162
163- **Possible Causes**
164
165  **Crypto** is not installed.
166
167- **Solution**
168  Method 1: Run the **pip3 install Crypto** command to install **Crypto** online.
169
170  Method 2: Install **Crypto** offline.
171
172  Download the source code from [PyPI](https://pypi.org/project/pycrypto/#files).
173
174  ![faq-download-pycrypto](figures/faq-download-pycrypto.png)
175
176  Save the source package to the Linux server, decompress the package, and run the **python3 setup.py install** command to install **Crypto**.
177
178  Start the build again.
179
180
181## (Hi3861) "No module named 'ecdsa'" is displayed during the build process
182
183- **Symptom**
184
185  The following information is displayed during the build process:
186
187
188  ```
189  ModuleNotFoundError: No module named 'ecdsa'
190  ```
191
192- **Possible Causes**
193
194  **ecdsa** is not installed.
195
196- **Solution**
197  Method 1: Run the **pip3 install ecdsa** command to install **ecdsa** online.
198
199  Method 2: Offline installation
200
201  Download the installation package from [PyPI](https://pypi.org/project/ecdsa/#files).
202
203  ![faq-download-ecdsa](figures/faq-download-ecdsa.png)
204
205  Save the installation package to the Linux server and run the **pip3 install ecdsa-0.15-py2.py3-none-any.whl** command to install ecdsa.
206
207  Start the build again.
208
209
210## (Hi3861)" Could not find a version that satisfies the requirement six>=1.9.0" is displayed during the build process
211
212- **Symptom**
213
214  The following information is displayed during the build process:
215
216
217  ```
218  Could not find a version that satisfies the requirement six>=1.9.0
219  ```
220
221- **Possible Causes**
222
223  **six** is not installed.
224
225- **Solution**
226  Method 1: Run the **pip3 install six** command to install **six** online.
227
228  Method 2: Install **six** offline.
229
230  Download the installation package from [PyPI](https://pypi.org/project/six/#files).
231
232  ![faq-download-six](figures/faq-download-six.png)
233
234  Save the source code to the Linux server and run the **pip3 install six-1.14.0-py2.py3-none-any.whl** command to install **six**.
235
236  Start the build again.
237
238
239## (Hi3861) "cannot find -lgcc" is displayed during the build process
240
241- **Symptom**
242
243  The following information is displayed during the build process:
244
245
246  ```
247  riscv32-unknown-elf-ld: cannot find -lgcc
248  ```
249
250- **Possible Causes**
251
252  The gcc_riscv32 path is incorrectly set as follows. There is an extra slash (/) after **bin**.
253
254
255  ```
256  ~/gcc_riscv32/bin/:/data/toolchain/
257  ```
258
259- **Solution**
260
261  Modify the gcc_riscv32 path as follows:
262
263
264  ```
265  ~/gcc_riscv32/bin:/data/toolchain/
266  ```
267
268
269## (Hi3861) An lsb_release error occurs during kconfiglib installation
270
271- **Symptom**
272
273  The following information is displayed during the **kconfiglib** installation process:
274
275
276  ```
277  subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
278  ```
279
280- **Possible Causes**
281
282  The Python version matched with the **lsb_release** module is different from the current Python version.
283
284- **Solution**
285
286  Run the **find / -name lsb_release** command, for example, **sudo rm -rf /usr/bin/lsb_release** to locate and delete **lsb_release**.
287