• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Compilation and Building
2
3
4## Mini and Small Systems
5
6
7### "usr/sbin/ninja: invalid option -- w"
8
9- **Symptom**
10
11  The build fails, and **usr/sbin/ninja: invalid option -- w** is displayed.
12
13- **Possible Causes**
14
15  The Ninja version in use does not support the **--w** option.
16
17- **Solution**
18
19  Uninstall Ninja and GN, and [install Ninja and GN of the required version](../get-code/gettools-ide.md).
20
21
22### "/usr/bin/ld: cannot find -lncurses"
23
24- **Symptom**
25
26  The build fails, and **/usr/bin/ld: cannot find -lncurses** is displayed.
27
28- **Possible Causes**
29
30  The ncurses library is not installed.
31
32- **Solution**
33
34  ```
35  sudo apt-get install lib32ncurses5-dev
36  ```
37
38
39### "line 77: mcopy: command not found"
40
41- **Symptom**
42
43  The build fails, and **line 77: mcopy: command not found** is displayed.
44
45- **Possible Causes**
46
47  mcopy is not installed.
48
49- **Solution**
50
51  ```
52  sudo apt-get install dosfstools mtools
53  ```
54
55
56### "riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory"
57
58- **Symptom**
59
60  The build fails, and the following information is displayed: <br>**riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory**
61
62- **Possible Causes**
63
64  You do not have the required permission to access files in the RISC-V compiler directory.
65
66- **Solution**
67
68    1. Run the following command to locate **gcc_riscv32**:
69
70     ```
71     which riscv32-unknown-elf-gcc
72     ```
73
74
75
76  2. Run the **chmod** command to change the directory permission to **755**.
77
78
79### "No module named 'Crypto'"
80
81- **Symptom**
82
83  The build fails, and **No module named 'Crypto'** is displayed.
84
85- **Possible Causes**
86
87  Crypto is not installed in Python3.
88
89- **Solution**
90
91  1. Run the following command to query the Python version:
92
93      ```
94      python3 --version
95      ```
96  2. Ensure that Python 3.7 or later is installed, and then run the following command to install pycryptodome:
97
98      ```
99      sudo pip3 install pycryptodome
100      ```
101
102
103### "xx.sh: xx unexpected operator"
104
105- **Symptom**
106
107  The build fails, and **xx.sh [: xx unexpected operator** is displayed.
108
109- **Possible Causes**
110
111  The build environment shell is not bash.
112
113- **Solution**
114
115  ```
116  sudo rm -rf /bin/sh
117  sudo ln -s /bin/bash /bin/sh
118  ```
119
120
121### "Could not find a version that satisfies the requirement six&gt;=1.9.0"
122
123- **Symptom**
124
125  The following information is displayed during the build process:
126
127
128  ```
129  Could not find a version that satisfies the requirement six>=1.9.0
130  ```
131
132- **Possible Causes**
133
134  **six** is not installed.
135
136- **Solution**
137
138  Method 1: Run the **pip3 install six** command to install **six** online.
139
140  Method 2: Install **six** offline.
141
142  1. Download the installation package from [PyPI](https://pypi.org/project/six/#files).
143
144
145  ![](figures/en-us_image_0000001251276115.png)
146
147  2. 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**.
148
149  3. Start the build again.
150
151
152### "cannot find -lgcc"
153
154- **Symptom**
155
156  The following information is displayed during the build process:
157
158
159  ```
160  riscv32-unknown-elf-ld: cannot find -lgcc
161  ```
162
163- **Possible Causes**
164
165  The gcc_riscv32 path is incorrectly set as follows. There is an extra slash (/) after **bin**.
166
167
168  ```
169  ~/gcc_riscv32/bin/:/data/toolchain/
170  ```
171
172- **Solution**
173
174  Modify the gcc_riscv32 path as follows:
175
176
177  ```
178  ~/gcc_riscv32/bin:/data/toolchain/
179  ```
180
181
182### Failed to Find Python
183
184- **Symptom**
185
186  The following information is displayed during the build process:
187
188
189  ```
190  -bash: /usr/bin/python: No such file or directory
191  ```
192
193- **Possible Cause 1**
194
195  Python is not installed.
196
197- **Solution**
198
199  Run the following command to install Python. The following uses Python 3.8 as an example.
200
201
202  ```
203  sudo apt-get install python3.8
204  ```
205
206- **Possible Cause 2**
207
208  The soft link to Python does not exist in the **usr/bin** directory.
209
210  ![](figures/en-us_image_0000001243200677.png)
211
212- **Solution**
213
214  Run the following commands to add the soft link to Python:
215
216
217  ```
218  # cd /usr/bin/
219  # which python3
220  # ln -s /usr/local/bin/python3 python
221  # python --version
222  ```
223
224  Example:
225
226  ![](figures/en-us_image_0000001243320787.png)
227
228
229### Failed to Find Python3
230
231- **Symptom**
232
233  ![](figures/en-us_image_0000001251276255.png)
234
235- **Possible Causes**
236
237  Python 3 is not installed.
238
239- **Solution**
240
241  Run the following command to install Python 3:
242
243
244  ```
245  sudo apt-get install python3.8
246  ```
247