Skip to content

Commit d00fe53

Browse files
xiazhveraadolfogc
andauthored
Update the instructions for building from source in README.md (#477)
* Update the instructions for building from source in README.md * readme update --------- Co-authored-by: Adolfo E. Garcia <[email protected]>
1 parent c4b7ecb commit d00fe53

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

README.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,49 @@ python -m pip install awsiotsdk
5252

5353
### Install from source
5454

55-
```
56-
# Create a workspace directory to hold all the SDK files
55+
```bash
56+
# 1. Create a workspace directory to hold all the SDK files
5757
mkdir sdk-workspace
5858
cd sdk-workspace
59-
# Clone the repository
60-
git clone https://github.com/aws/aws-iot-device-sdk-python-v2.git
61-
# Install using Pip (use 'python' instead of 'python3' on Windows)
59+
60+
# 2. Clone the repository. You could select the version of the SDK you desire to use.
61+
git clone -b <SDK_VERSION> https://github.com/aws/aws-iot-device-sdk-python-v2.git
62+
63+
# 3. (Optional) Setup the version number of your local build. The default version for awsiotsdk is set to "1.0.0-dev", you can set the version number of the local build in "aws-iot-device-sdk-python-v2/awsiot/__init__.py"
64+
sed -i "s/__version__ = '1.0.0-dev'/__version__ = '<SDK_VERSION>'/" aws-iot-device-sdk-python-v2/awsiot/__init__.py
65+
66+
# 4. Install using Pip (use 'python' instead of 'python3' on Windows)
6267
python3 -m pip install ./aws-iot-device-sdk-python-v2
6368
```
6469

70+
6571
### Installation Issues
6672

67-
`awsiotsdk` depends on [awscrt](https://github.com/awslabs/aws-crt-python), which makes use of C extensions. Precompiled wheels are downloaded when installing on major platforms (Mac, Windows, Linux, Raspberry Pi OS). If wheels are unavailable for your platform, your machine must compile some C libraries.
73+
`awsiotsdk` depends on [awscrt](https://github.com/awslabs/aws-crt-python), which makes use of C extensions. Precompiled wheels are downloaded when installing on major platforms (Mac, Windows, Linux, Raspberry Pi OS). If wheels are unavailable for your platform, your machine must compile some C libraries. For example:
74+
75+
```bash
76+
# 1. Create a workspace directory to hold all the CRT files
77+
mkdir crt-workspace
78+
cd crt-workspace
79+
80+
# 2. Clone the repository, you could select the version you would like to use. You can find the awscrt version used by the current SDK from the file "./aws-iot-device-sdk-python-v2/setup.py". Update the version number in "./aws-iot-device-sdk-python-v2/setup.py" can change the awscrt version you would like to use in awsiotsdk
81+
git clone -b <CRT_VERSION> https://github.com/awslabs/aws-crt-python.git
82+
83+
# 3. Update the submodules
84+
cd aws-crt-python
85+
git submodule update --init --recursive
86+
87+
# 4. (Optional) Setup the version number of your local build. Similar to the awsiotsdk, the default version for awscrt is set to "1.0.0-dev", you can set the version number of the local build in "./aws-crt-python/awscrt/__init__.py". The awscrt version set here need to match the version specified in "./aws-iot-device-sdk-python-v2/setup.py" so that the awsiotsdk could locate the correct awscrt library.
88+
sed -i "s/__version__ = '1.0.0.dev0'/__version__ = '<CRT_VERSION>'/" awscrt/__init__.py
89+
90+
# 5. Install using Pip
91+
python3 -m pip install .
92+
```
93+
If you need aws-crt-python to use the libcrypto included on your system, set environment variable AWS_CRT_BUILD_USE_SYSTEM_LIBCRYPTO=1 while building from source:
94+
```
95+
AWS_CRT_BUILD_USE_SYSTEM_LIBCRYPTO=1 python3 -m pip install --no-binary :all: --verbose awscrt
96+
```
97+
( --no-binary :all: ensures you do not use the precompiled wheel from PyPI)
6898

6999
If you encounter issues, see [Installation Issues](./documents/PREREQUISITES.md#installation-issues) and try again.
70100

0 commit comments

Comments
 (0)