• 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  Garbled characters and segmentation faults occur during the execution of the **python3 -m pip install --user ohos-build** command.
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  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  1. Ensure that your computer has a good network connection. If the network connection is unstable, rectify the network fault and reinstall hb.
83  2. If the network is functional, run the following commands to install hb by specifying a temporary PyPI source:
84
85     ```
86     python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ohos-build
87     ```
88
89### Python3 Installation
90
91#### configure: error: no acceptable C compiler found in $PATH
92
93- **Symptom**
94
95  The following error occurs during Python 3 installation:
96
97  ```
98  configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
99  ```
100
101- **Possible Causes**
102
103  GCC is not installed.
104
105- **Solution**
106
107  1. Run the **apt-get install gcc** command to install GCC online.
108
109  2. Install Python 3.
110
111
112#### -bash: make: command not found
113
114- **Symptom**
115
116  The following error occurs during Python 3 installation:
117
118  ```
119  -bash: make: command not found
120  ```
121
122- **Possible Causes**
123
124  make is not installed.
125
126- **Solution**
127
128  1. Run the **apt-get install make** command to install make online.
129
130  2. Install Python 3.
131
132
133#### zlib Not Available
134
135- **Symptom**
136
137  The following error occurs during Python 3 installation:
138
139  ```
140  zipimport.ZipImportError: can't decompress data; zlib not available
141  ```
142
143- **Possible Causes**
144
145  **zlib** is not installed.
146
147- **Solution**
148
149  Method 1: Run the **apt-get install zlib** command to install zlib online.
150
151  Method 2: If the software source does not contain zlib, download zlib from http://www.zlib.net/.
152
153  ![](figures/download-zlib.png)
154
155  Run the following command to install zlib:
156
157  ```
158  # tar xvf zlib-1.2.11.tar.gz
159  # cd zlib-1.2.11
160  # ./configure
161  # make && make install
162  ```
163
164  Install Python 3.
165
166
167#### No module named'\_ctypes'
168
169- **Symptom**
170
171  The following error occurs during Python 3 installation:
172
173  ```
174  ModuleNotFoundError: No module named '_ctypes'
175  ```
176
177
178- **Possible Causes**
179
180  libffi and libffi-devel are not installed.
181
182
183- **Solution**
184
185  1. Run the **apt-get install libffi* -y** command to install libffi and libffi-devel online.
186
187  2. Install Python 3.
188
189
190### lsb_release Error Occurred During kconfiglib Installation
191
192- **Symptom**
193
194  The following information is displayed during the **kconfiglib** installation process:
195
196  ```
197  subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
198  ```
199
200- **Possible Causes**
201
202  The Python version in use does not match the Python version on which the lsb_release module depends.
203
204- **Solution**
205
206  Run **find / -name lsb_release** to locate lsb_release and delete it, for example, **sudo rm -rf /usr/bin/lsb_release**.
207
208
209### ImportError: No module named apt\_pkg
210
211- **Symptom**
212
213  The message "ImportError: No module named apt\_pkg" is displayed when an unidentifiable command is executed on the Linux server.
214
215
216- **Possible Causes**
217
218  There is a compatibility issue of python3-apt.
219
220- **Solution**
221
222  Reinstall python3-apt.
223
224  ```
225  sudo apt-get remove  python3-apt
226  sudo apt-get install python3-apt
227  ```
228
229### Updating Source Code
230- **Scenario**
231
232  Update the OpenHarmony source code downloaded to the branch (for example, Master) source code.
233
234- **Solution**
235
236  1. Go to the OpenHarmony root directory.
237
238     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.
239
240  2. Run the **repo init** command to initialize the source code repository information.
241
242     In the command, *branch* indicates the branch name, for example, **master** or **OpenHarmony-3.2-Beta3**.
243     ```shell
244     repo init -u https://gitee.com/openharmony/manifest -b branch --no-repo-verify
245     ```
246
247  3. Download and update the source code file.
248
249     ```shell
250     repo sync -c
251     repo forall -c 'pwd;git lfs pull'
252     ```
253     To keep the working directory clean, run the following command:
254
255     >![icon-note.gif](public_sys-resources/icon-caution.gif) **CAUTION**<br>
256     >This command will reset the local workspace and delete files or directories that are not managed by gitee. Exercise caution when performing this operation.
257     ```shell
258     repo forall -c 'git reset --hard;git clean -fdx'
259     ```
260
261  4. Run the prebuilts script to install the compiler and binary tool.
262
263     ```shell
264     bash build/prebuilts_download.sh
265     ```
266
267
268