You need to sign in or sign up before continuing.
faqs-building.md 5.2 KB
Newer Older
E
ester.zhou 已提交
1
# Compilation and Building Subsystem
W
wusongqing 已提交
2 3


E
ester.zhou 已提交
4
## Mini and Small Systems
W
wusongqing 已提交
5 6


E
ester.zhou 已提交
7
### "usr/sbin/ninja: invalid option -- w" Displayed During the Build Process
W
wusongqing 已提交
8

E
ester.zhou 已提交
9
- **Symptom**
W
wusongqing 已提交
10 11 12
  
The compilation fails, and **usr/sbin/ninja: invalid option -- w** is displayed.
  
E
ester.zhou 已提交
13
- **Possible Causes**
W
wusongqing 已提交
14 15 16
  
The Ninja version in the compilation environment is outdated and does not support the **--w** option.
  
E
ester.zhou 已提交
17
- **Solution**
W
wusongqing 已提交
18
  
E
ester.zhou 已提交
19
  Uninstall Ninja and GN in the environment and reinstall them by following instructions in [Obtaining Tools](../get-code/gettools-ide.md).
W
wusongqing 已提交
20 21


E
ester.zhou 已提交
22
### "/usr/bin/ld: cannot find -lncurses" Displayed During the Build Process
W
wusongqing 已提交
23

E
ester.zhou 已提交
24
- **Symptom**
W
wusongqing 已提交
25 26 27
  
The compilation fails, and **/usr/bin/ld: cannot find -lncurses** is displayed.
  
E
ester.zhou 已提交
28
- **Possible Causes**
W
wusongqing 已提交
29 30 31
  
The ncurses library is not installed.
  
E
ester.zhou 已提交
32
- **Solution**
W
wusongqing 已提交
33
  
E
ester.zhou 已提交
34 35 36
  ```
  Run **sudo apt-get install lib32ncurses5-dev** to install the library.
  ```
W
wusongqing 已提交
37 38


E
ester.zhou 已提交
39
### "line 77: mcopy: command not found" Displayed During the Build Process
W
wusongqing 已提交
40

E
ester.zhou 已提交
41
- **Symptom**
W
wusongqing 已提交
42 43 44
  
The compilation fails, and **line 77: mcopy: command not found** is displayed.
  
E
ester.zhou 已提交
45
- **Possible Causes**
W
wusongqing 已提交
46 47 48
  
Mcopy is not installed.
  
E
ester.zhou 已提交
49
- **Solution**
W
wusongqing 已提交
50
  
E
ester.zhou 已提交
51 52 53
  ```
  Run **sudo apt-get install dosfstools mtools** to install mcopy.
  ```
W
wusongqing 已提交
54 55


E
ester.zhou 已提交
56
### "riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory" Displayed During the Build Process
W
wusongqing 已提交
57

E
ester.zhou 已提交
58
- **Symptom**
W
wusongqing 已提交
59 60 61
  
The compilation fails, and the following information is displayed: **riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory**.
  
E
ester.zhou 已提交
62
- **Possible Causes**
W
wusongqing 已提交
63 64 65
  
Permission is required to access files in the **riscv** compiler path.
  
E
ester.zhou 已提交
66 67
- **Solution**
    
W
wusongqing 已提交
68 69
    Run the following command to query the directory where **gcc_riscv32** is located:
  
E
ester.zhou 已提交
70 71
  ```
  which riscv32-unknown-elf-gcc
W
wusongqing 已提交
72 73
```
  
E
ester.zhou 已提交
74
  Run the **chmod** command to change the directory permission to **755**.
W
wusongqing 已提交
75 76


E
ester.zhou 已提交
77
### "No module named 'Crypto'" Displayed During the Build Process
W
wusongqing 已提交
78

E
ester.zhou 已提交
79
- **Symptom**
W
wusongqing 已提交
80 81 82
  
The compilation fails, and **No module named'Crypto loaded** is displayed.
  
E
ester.zhou 已提交
83
- **Possible Causes**
W
wusongqing 已提交
84 85 86
  
Crypto is not installed in Python3.
  
E
ester.zhou 已提交
87
- **Solution**
W
wusongqing 已提交
88
  
E
ester.zhou 已提交
89
  1. Run the following command to query the Python version:
W
wusongqing 已提交
90
     
E
ester.zhou 已提交
91 92 93 94
      ```
      python3 --version
      ```
  2. Ensure that Python 3.7 or later is installed, and then run the following command to install pycryptodome:
W
wusongqing 已提交
95
     
E
ester.zhou 已提交
96 97 98
      ```
      sudo pip3 install pycryptodome
      ```
W
wusongqing 已提交
99 100


E
ester.zhou 已提交
101
### "xx.sh : xx unexpected operator" Displayed During the Build Process
W
wusongqing 已提交
102

E
ester.zhou 已提交
103
- **Symptom**
W
wusongqing 已提交
104 105 106
  
The compilation fails, and **xx.sh [: xx unexpected operator** is displayed.
  
E
ester.zhou 已提交
107
- **Possible Causes**
W
wusongqing 已提交
108 109 110
  
The compilation environment is shell instead of bash.
  
E
ester.zhou 已提交
111
- **Solution**
W
wusongqing 已提交
112
  
E
ester.zhou 已提交
113 114 115 116
  ```
  sudo rm -rf /bin/sh
  sudo ln -s /bin/bash /bin/sh
  ```
W
wusongqing 已提交
117 118


E
ester.zhou 已提交
119
### "Could not find a version that satisfies the requirement six>=1.9.0" Displayed During the Build Process
W
wusongqing 已提交
120

E
ester.zhou 已提交
121
- **Symptom**
W
wusongqing 已提交
122 123 124 125
  
The following error occurs during compilation and building:
  
  
E
ester.zhou 已提交
126 127
  ```
  Could not find a version that satisfies the requirement six>=1.9.0
W
wusongqing 已提交
128 129
```
  
E
ester.zhou 已提交
130
- **Possible Causes**
W
wusongqing 已提交
131 132 133
  
**six** is not installed.
  
E
ester.zhou 已提交
134
- **Solution**
W
wusongqing 已提交
135 136 137 138 139 140 141 142 143 144 145
  
Solution 1: Run the **pip3 install six** command to install **six** online.
  
Method 2: Offline installation
  
Download the installation package from [PyPI](https://pypi.org/project/six/#files).
  
![en-us_image_0000001251276115](figures/en-us_image_0000001251276115.png)
  
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**.
  
E
ester.zhou 已提交
146
  After the preceding installation is complete, rebuild an environment.
W
wusongqing 已提交
147 148


E
ester.zhou 已提交
149
### "cannot find -lgcc" Displayed During the Build Process
W
wusongqing 已提交
150

E
ester.zhou 已提交
151
- **Symptom**
W
wusongqing 已提交
152 153 154 155
  
The following error occurs during the build process:
  
  
E
ester.zhou 已提交
156 157
  ```
  riscv32-unknown-elf-ld: cannot find -lgcc
W
wusongqing 已提交
158 159
```
  
E
ester.zhou 已提交
160
- **Possible Causes**
W
wusongqing 已提交
161 162 163 164
  
The PATH is incorrectly written by **gcc_riscv32**. There is an extra slash (/).
  
  
E
ester.zhou 已提交
165 166
  ```
  ~/gcc_riscv32/bin/:/data/toolchain/
W
wusongqing 已提交
167 168
```
  
E
ester.zhou 已提交
169
- **Solution**
W
wusongqing 已提交
170 171 172 173
  
Modify the PATH by deleting the slash (/).
  
  
E
ester.zhou 已提交
174 175 176
  ```
  ~/gcc_riscv32/bin:/data/toolchain/
  ```
W
wusongqing 已提交
177 178


E
ester.zhou 已提交
179
### The Message Indicating Python Cannot Be Found Is Displayed During the Build Process
W
wusongqing 已提交
180

E
ester.zhou 已提交
181
- **Symptom**
W
wusongqing 已提交
182 183 184 185
  
The following error occurs during the build process:
  
  
E
ester.zhou 已提交
186 187
  ```
  -bash: /usr/bin/python: No such file or directory
W
wusongqing 已提交
188 189
```
  
E
ester.zhou 已提交
190
- **Possible Cause 1**
W
wusongqing 已提交
191 192 193
  
Python is not installed.
  
E
ester.zhou 已提交
194
- **Solution**
W
wusongqing 已提交
195 196 197 198
  
Run the following command to install Python. The following uses Python 3.8 as an example.
  
  
E
ester.zhou 已提交
199 200
  ```
  sudo apt-get install python3.8
W
wusongqing 已提交
201 202
```
  
E
ester.zhou 已提交
203
- **Possible Cause 2**
W
wusongqing 已提交
204 205 206 207 208
  
The soft link that points to the Python does not exist in the **usr/bin** directory.
  
![en-us_image_0000001243200677](figures/en-us_image_0000001243200677.png)
  
E
ester.zhou 已提交
209
- **Solution**
W
wusongqing 已提交
210 211 212 213
  
Run the following commands to add a soft link:
  
  
E
ester.zhou 已提交
214 215 216 217 218
  ```
  # cd /usr/bin/ 
  # which python3
  # ln -s /usr/local/bin/python3 python
  # python --version
W
wusongqing 已提交
219 220 221 222
```
  
Example:
  
E
ester.zhou 已提交
223
  ![en-us_image_0000001243320787](figures/en-us_image_0000001243320787.png)
W
wusongqing 已提交
224 225


E
ester.zhou 已提交
226
### The Message Indicating Python 3 Cannot Be Found Is Displayed During the Build Process
W
wusongqing 已提交
227

E
ester.zhou 已提交
228
- **Symptom**
W
wusongqing 已提交
229

E
ester.zhou 已提交
230
  ![en-us_image_0000001251276255](figures/en-us_image_0000001251276255.png)
W
wusongqing 已提交
231

E
ester.zhou 已提交
232
- **Possible Causes**
W
wusongqing 已提交
233 234 235
  
Python 3 is not installed.
  
E
ester.zhou 已提交
236
- **Solution**
W
wusongqing 已提交
237 238 239 240
  
Run the following command to install Python 3:
  
  
E
ester.zhou 已提交
241 242 243
  ```
  sudo apt-get install python3.8
  ```