Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added build steps for windows #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions _posts/2020-04-03-build-rustpython-windows.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
layout: post
title: "Build RustPython on Windows"
date: 2020-04-03 01:11:01 -0400
categories: featured
---

Building RustPython on windows is an issue for people new to the project.
This articles seeks to make it easy for you.

## Let's get to work.
- First [Download Rust](https://www.google.com "Rust download page") and follow the installation guide.

- Make sure you have a C/C++ compiler installed. I'd advice using Microsoft Visual Studio compilers for the job. [Download Visual Studio](https://visualstudio.microsoft.com/downloads/ "Visual Studio Download Page") and follow the installation guide. A community version is all we need. Be sure to check `Desktop Development with C++`.

- [Download and setup git](https://git-scm.com/download/win "Git download page") if you haven't already.

- Next we need to install openssl since RustPython depends on it. However the build process for openssl is not very straight forward. We employ [Vcpkg](https://github.com/Microsoft/vcpkg) to help us. [Clone Vcpkg](https://github.com/Microsoft/vcpkg "Vcpkg github repository") into a folder of your choosing. I will use ```C:\vcpkg\``` in this example. Following vcpkg's installation guide, in the cloned directory

From your Powershell run the scripts.
```Powershell
PS C:\vcpkg> .\bootstrap-vcpkg.bat
PS C:\vcpkg> .\vcpkg integrate install
```

Finally we install openssl by running
```Powershell
PS C:\vcpkg> .\vcpkg install openssl:x64-windows
```
Get some coffee for this one.
After the installation is done, there will be a created path
```
C:\vcpkg\installed\x64-windows\
```
Edit your User environment Variables or System Variables, whichever you prefer and set `OPENSSL_DIR` to this path
Comment on lines +18 to +35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this isn't necessary anymore since RustPython/RustPython#1841, as far as I can tell all that's necessary is a perl installation like Strawberry Perl in order to build openssl.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops didn't catch that.
I will work on that.


## Now for the real deal: Building Rustpython.

- Clone Rustpython from [https://github.com/rustpython/rustpython](https://github.com/rustpython/rustpython).
- Change directory into the clone directory. Suppose this directory is `C:\rustpython`,
```Powershell
PS C:\> cd rustpython
```
- Run the script ```symlinks-to-hardlinks.ps1``` in windows powershell to copy some python files into the vm project (There was no need to type the same code twice, lol)
```powershell
PS C:\rustpython> .\scripts\symlinks-to-hardlinks.ps1
```

- When all is done, build RustPython with cargo from the project's parent directory
```Powershell
PS C:\rustpython> Cargo build --release
```
After cargo does its magic, you should see a ```targets/release``` folder created

copy the `.dll` files `libcrypto-1_1-x64.dll` and `libssl-1_1-x64.dll` from
```
C:\vcpkg\installed\x64-windows\bin
```
or the `bin` folder of wherever you installed openssl to into the ```targets/release``` directory.
Comment on lines +55 to +59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this shouldn't be necessary either, as openssl is statically linked.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until I copied it, I didn't get the built exe running. At least that was for me.


## Now run *`ruspython.exe`* and enjoy it's beauty.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

Suggested change
## Now run *`ruspython.exe`* and enjoy it's beauty.
## Now run *`rustpython.exe`* and enjoy it's beauty.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, Fixing that right up.