• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Environment Setup
2
3
4## Mini and Small Systems
5
6### hb Installation
7
8#### Garbled Characters and Segmentation Faults
9
10- **Symptom**
11
12  After the **python3 -m pip install --user ohos-build** command is executed, garbled characters and segmentation faults occur.
13
14
15- **Possible Causes**
16
17  The pip version does not meet requirements.
18
19- **Solution**
20
21  Run the following command to upgrade pip:
22
23  ```
24  python3 -m pip install -U pip
25  ```
26
27
28#### "cannot import 'sysconfig' from 'distutils'"
29
30- **Symptom**
31
32  During the execution of **python3 -m pip install --user ohos-build**, the following information is displayed:<br>cannot import 'sysconfig' from 'distutils'
33
34
35- **Possible Causes**
36
37  The **distutils** module is unavailable.
38
39- **Solution**
40
41  Run the following command to install **distutils**:
42
43  ```
44  sudo apt-get install python3.8-distutils
45  ```
46
47
48#### "module 'platform' has no attribute 'linux_distribution'"
49
50- **Symptom**
51
52  During the execution of **python3 -m pip install --user ohos-build**, the following information is displayed:<br>module 'platform' has no attribute 'linux\_distribution'
53
54
55- **Possible Causes**
56
57  There is a compatibility issue of python3-pip.
58
59- **Solution**
60
61  Reinstall pip.
62
63  ```
64  sudo apt remove python3-pip
65  curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
66  python get-pip.py
67  ```
68
69
70#### "Could not find a version that satisfies the requirement ohos-build"
71
72- **Symptom**
73
74  During the execution of **python3 -m pip install --user ohos-build**, the following information is displayed:<br>Could not find a version that satisfies the requirement ohos-build
75
76
77- **Possible Causes**
78
79  The installation fails due to poor network connectivity.
80
81- **Solution**
82
83  1. Check that your computer has a good network connection. If the network connection is unstable, rectify the network fault and reinstall hb.
84
85  2. If the network is functional, run the following commands to install hb by specifying a temporary PyPI source:
86
87     ```
88     python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ohos-build
89     ```
90
91### Python 3 Installation
92
93#### "configure: error: no acceptable C compiler found in $PATH"
94
95- **Symptom**
96
97  The following informaton is displayed during the Python 3 installation process:
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
109  1. Run the **apt-get install gcc** command to install GCC online.
110
111  2. Install Python 3.
112
113
114#### "-bash: make: command not found"
115
116- **Symptom**
117
118  The following information is displayed during the Python 3 installation process:
119
120  ```
121  -bash: make: command not found
122  ```
123
124- **Possible Causes**
125
126  make is not installed.
127
128- **Solution**
129
130  1. Run the **apt-get install make** command to install make online.
131
132  2. Install Python 3.
133
134
135#### "zlib not available"
136
137- **Symptom**
138
139  The following information is displayed during the Python 3 installation process:
140
141  ```
142  zipimport.ZipImportError: can't decompress data; zlib not available
143  ```
144
145- **Possible Causes**
146
147  **zlib** is not installed.
148
149- **Solution**
150
151  1. Install zlib online or offline.
152
153     Online installation:
154
155     Run the **apt-get install zlib** command to install zlib online.
156
157     Offline installation:
158
159     1. Download zlib from http://www.zlib.net/.
160
161        ![](figures/download-zlib.png)
162
163     2. Run the following command to install zlib:
164
165        ```
166         # tar xvf zlib-1.2.11.tar.gz
167           # cd zlib-1.2.11
168           # ./configure
169           # make && make install
170        ```
171
172173
174  2. Install Python 3.
175
176
177#### "No module named '_ctypes'"
178
179- **Symptom**
180
181  The following information is displayed during the Python 3 installation process:
182
183  ```
184  ModuleNotFoundError: No module named '_ctypes'
185  ```
186
187
188- **Possible Causes**
189
190  libffi and libffi-devel are not installed.
191
192
193- **Solution**
194
195  1. Run the **apt-get install libffi\* -y** command to install libffi and libffi-devel online.
196
197  2. Install Python 3.
198
199
200### lsb_release Error During kconfiglib Installation
201
202- **Symptom**
203
204  The following information is displayed during the **kconfiglib** installation process:
205
206  ```
207  subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
208  ```
209
210- **Possible Causes**
211
212  The Python version in use does not match the Python version on which the lsb_release module depends.
213
214- **Solution**
215
216  Run **find / -name lsb_release** to locate lsb_release, and delete it, for example, run **sudo rm -rf /usr/bin/lsb_release**.
217
218
219### "ImportError: No module named apt_pkg"
220
221- **Symptom**
222
223  When an unidentifiable command is executed on the Linux server, the following information is displayed:<br>ImportError: No module named apt_pkg
224
225
226- **Possible Causes**
227
228  There is a compatibility issue of python3-apt.
229
230- **Solution**
231
232  Reinstall python3-apt.
233
234  ```
235  sudo apt-get remove  python3-apt
236  sudo apt-get install python3-apt
237  ```
238
239### Updating Source Code
240- **Scenario**
241
242  Update the OpenHarmony source code downloaded to the branch (for example, Master) source code.
243
244- **Solution**
245
246  1. Go to the OpenHarmony root directory.
247
248     Check that the root directory has a **.repo** folder, which is usually hidden. If the **.repo** folder does not exist, decompress the obtained source code package again to obtain complete source code.
249
250  2. Run the **repo init** command to initialize the source code repository information.
251
252     In the command, *branch* indicates the branch name, for example, **master** or **OpenHarmony-3.2-Beta3**.
253     ```shell
254     repo init -u https://gitee.com/openharmony/manifest -b branch --no-repo-verify
255     ```
256
257  3. Download and update the source code file.
258
259     ```shell
260     repo sync -c
261     repo forall -c 'pwd;git lfs pull'
262     ```
263     To keep the working directory clean, run the following command:
264
265     >![icon-note.gif](public_sys-resources/icon-caution.gif) **CAUTION**<br>
266     >This command will reset the local workspace and delete files or directories that are not managed by gitee. Exercise caution when performing this operation.
267     ```shell
268     repo forall -c 'git reset --hard;git clean -fdx'
269     ```
270
271  4. Run the prebuilts script to install the compiler and binary tool.
272
273     ```shell
274     bash build/prebuilts_download.sh
275     ```
276
277
278