Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Hacking on Atom Core: Update build requirements to be accurate #630

Merged
merged 11 commits into from
Oct 5, 2020
47 changes: 23 additions & 24 deletions content/hacking-atom/sections/hacking-on-atom-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,33 +83,34 @@ In order to build Atom from source, you need to have a number of other requireme
##### Requirements

* macOS 10.9 or later
* Node.js 6.x or later (we recommend installing it via [nvm](https://github.com/creationix/nvm))
* npm 3.10.x or later (run `npm install -g npm`)
* Python v2.7.x
* Node.js 10.12 or later (we recommend installing it via [nvm](https://github.com/creationix/nvm))
* npm 6 or later (run `npm install -g npm`)
* Python v2.6.x, v2.7.x or v3.5+
* Command Line Tools for [Xcode](https://developer.apple.com/xcode/downloads/) (run `xcode-select --install` to install)

{{/mac}}

{{#windows}}

* Node.js 6.9.4 or later (the architecture of node available to the build system will determine whether you build 32-bit or 64-bit Atom)
* Python v2.7.x
* The `python.exe` must be available at `%SystemDrive%\Python27\python.exe`. If it is installed elsewhere create a symbolic link to the directory containing the `python.exe` using: `mklink /d %SystemDrive%\Python27 D:\elsewhere\Python27`
* 7zip (7z.exe available from the command line) - for creating distribution zip files
* C++ build tools, either:
* [Visual C++ Build Tools 2015](https://visualstudio.microsoft.com/vs/older-downloads/)
* [Visual Studio 2013 Update 5](https://www.visualstudio.com/downloads/) (Express Edition or better)
* [Visual Studio 2015](https://www.visualstudio.com/downloads/) (Community Edition or better)
* **Unsupported** but more convenient for some who know Node: [windows-build-tools](https://www.npmjs.com/package/windows-build-tools)

* Node.js 10.12 or later (the architecture of node available to the build system will determine whether you build 32-bit or 64-bit Atom)
Copy link
Contributor

Choose a reason for hiding this comment

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

We use Node 12 in our CI builds. Shouldn't that be the supported version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

10 is still an officially supported Long Term Support version for now: https://nodejs.org/about/releases/

(Until the end of April in 2021)

* Python v2.6.x, v2.7.x, or v3.5+
* [Get Python from the Microsoft Store](https://www.microsoft.com/en-us/search/shop/apps?q=python+software+foundation&devicetype=pc&category=Developer+tools%5cDevelopment+kits&Price=0&MaturityRating=ESRB%3aE), or
* Download Python from https://www.python.org/downloads/.
* For Python 2, be sure to install in the default location, or check "Add Python 2.x to PATH" before installing.
* For Python 3, check "Add Python 3.x to PATH", or change the install path to `[Your_Drive_Letter]:\Python37` e.g. `C:\Python37`, (even if your version of Python 3 isn't 3.7, that's one place where the scripts will look.)
* If python isn't found by the bootstrap script, create a symbolic link to the directory containing `python.exe` using e.g.: `mklink /d %SystemDrive%\Python27 D:\elsewhere\Python27`(Links should be set at either `%SystemDrive%\Python27` or `%SystemDrive%\Python37`, regardless of what version of Python you actually have.)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if this is too much detail. It should be accurate, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is ok with me. 👍

* C++ build tools:
* **Option 1:** [windows-build-tools](https://www.npmjs.com/package/windows-build-tools) - From an elevated Powershell window (right click and "run as Administrator") do: `npm install --global --production windows-build-tools` to install
* **Option 2:** [Visual C++ Build Tools 2015, 2017 or 2019](https://visualstudio.microsoft.com/visual-cpp-build-tools/)
* **Option 3:** [Visual Studio 2015, 2017 or 2019](https://www.visualstudio.com/downloads/) (Community Edition or better)

Also ensure that:

* The default installation folder is chosen so the build tools can find it
* If using Visual Studio make sure Visual C++ support is selected/installed
* If using Visual C++ Build Tools make sure Windows 8 SDK is selected/installed
* If using Visual C++ Build Tools make sure a Windows SDK (Windows 8 SDK or Windows 10 SDK) is selected/installed
* A `git` command is in your path
* Set the `GYP_MSVS_VERSION` environment variable to the Visual Studio/Build Tools version (`2013` or `2015`) e.g. ``[Environment]::SetEnvironmentVariable("GYP_MSVS_VERSION", "2015", "User")`` in PowerShell (or set it in Windows advanced system settings).
* Set the `GYP_MSVS_VERSION` environment variable to the Visual Studio/Build Tools version (`2015`, `2017`, or `2019`.) e.g. ``[Environment]::SetEnvironmentVariable("GYP_MSVS_VERSION", "2015", "User")`` in PowerShell (or set it in Windows advanced system settings).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting GYP_MSVS_VERSION is usually unnecessary, if you've installed to the default location.

node-gyp has gotten better at locating Visual Studio and its components.

Maybe leave this for the troubleshooting area instead. It's already mentioned there.


{{/windows}}

Expand All @@ -122,9 +123,9 @@ Ubuntu LTS 16.04 64-bit is the recommended platform.
* OS with 64-bit or 32-bit architecture
* C++11 toolchain
* Git
* Node.js 6.x or later (we recommend installing it via [nvm](https://github.com/creationix/nvm))
* npm 3.10.x or later (run `npm install -g npm`)
* Ensure node-gyp uses python2 (run `npm config set python /usr/bin/python2 -g`, use `sudo` if you didn't install node via nvm)
* Node.js 10.12 or later (we recommend installing it via [nvm](https://github.com/creationix/nvm))
* npm 6 or later (run `npm install -g npm`)
* Python 2.6.x, 2.7.x or 3.5+
* Development headers for [libsecret](https://wiki.gnome.org/Projects/Libsecret).

For more details, scroll down to find how to setup a specific Linux distro.
Expand Down Expand Up @@ -162,11 +163,9 @@ $ sudo yum install -y make gcc gcc-c++ glibc-devel git-core libsecret-devel rpmd
###### Arch

``` command-line
sudo pacman -S --needed gconf base-devel git nodejs npm libsecret python2 libx11 libxkbfile
sudo pacman -S --needed gconf base-devel git nodejs npm libsecret python libx11 libxkbfile
```

Be certain to use `export PYTHON=/usr/bin/python2` before building Atom.

###### Slackware

``` command-line
Expand Down Expand Up @@ -228,7 +227,7 @@ To also install the newly built application, use the `--create-debian-package` o
##### `script\build` Options

* `--code-sign`: signs the application with the GitHub certificate specified in `$WIN_P12KEY_URL`.
* `--compress-artifacts`: zips the generated application as `out\atom-windows.zip` (requires [7-Zip](http://www.7-zip.org)).
* `--compress-artifacts`: zips the generated application as `out\atom-windows.zip`.
* `--create-windows-installer`: creates an `.exe` and two `.nupkg` packages in the `out` directory.
* `--install[=dir]`: installs the application in `${dir}\Atom\app-dev`; `${dir}` defaults to `%LOCALAPPDATA%`.

Expand Down Expand Up @@ -262,7 +261,7 @@ Use [this search](https://github.com/atom/atom/search?q=label%3Abuild-error+labe

* `msbuild.exe failed with exit code: 1`
* If using **Visual Studio**, ensure you have the **Visual C++** component installed. Go into Add/Remove Programs, select Visual Studio, press Modify, and then check the Visual C++ box.
* If using **Visual C++ Build Tools**, ensure you have the **Windows 8 SDK** component installed. Go into Add/Remove Programs, select Visual C++ Build Tools, press Modify and then check the Windows 8 SDK box.
* If using **Visual C++ Build Tools**, ensure you have the **Windows 8 SDK** or **Windows 10 SDK** component installed. Go into Add/Remove Programs, select Visual C++ Build Tools, press Modify and then check the "Windows 8 SDK" or "Windows 10 SDK" box.

* `script\build` stops with no error or warning shortly after displaying the versions of node, npm and Python
* Make sure that the path where you have checked out Atom does not include a space. For example, use `C:\atom` instead of `C:\my stuff\atom`.
Expand All @@ -281,7 +280,7 @@ Use [this search](https://github.com/atom/atom/search?q=label%3Abuild-error+labe
* See the next item.

* `error MSB8020: The build tools for Visual Studio 201? (Platform Toolset = 'v1?0') cannot be found.`
* Try setting the `GYP_MSVS_VERSION` environment variable to **2013** or **2015** depending on what version of Visual Studio/Build Tools is installed and then `script\clean` followed by `script\build` (re-open the Command Prompt if you set the variable using the GUI).
* Try setting the `GYP_MSVS_VERSION` environment variable to **2015**, **2017** or **2019** depending on what version of Visual Studio/Build Tools is installed and then `script\clean` followed by `script\build` (re-open the Command Prompt if you set the variable using the GUI).

* `'node-gyp' is not recognized as an internal or external command, operable program or batch file.`
* Try running `npm install -g node-gyp`, and run `script\build` again.
Expand Down