Skip to content

Commit

Permalink
Linux: Pin NodeJS to 8.x, fix watchman install
Browse files Browse the repository at this point in the history
Summary:
- On newer versions of Ubuntu, NodeJS 10.x is in the official packages, so apt will upgrade the PPA-installed 8.x version to 10.x the next time upgrades are run. This change adds an apt preferences file that pins the `nodejs` package at version 8.x.
- The watchman installation was previously broken on new installs, because the `ka-clone` executable doesn't get installed until after the Linux-specific installation is done. This commit changes the previous call to `kaclone_repo` to bare git commands, so it will work at all times.
- The watchman build previously didn't work on some Ubuntu machines, because there were two missing dependencies. This commit adds them to the `apt-get install` command run before building.
- Newer versions of GCC turn certain warnings into fatal errors, and watchman hasn't yet been updated to avoid those errors. As a workaround, we pass `--enable-lenient` to the configure command, so those warnings won't break the compile.

Test Plan:
- The scripts were executed on fresh Ubuntu 18.04 and 19.04 installations, as well as my previously-configured Ubuntu 19.04 machine.
- MacOS was not tested, because the changes are local to `linux-setup.sh`.

Reviewers: benkraft, colin, kevinb

Reviewed By: benkraft

Subscribers: csilvers

Differential Revision: https://phabricator.khanacademy.org/D54498
  • Loading branch information
aag committed May 20, 2019
1 parent 8a0bdb2 commit 181d778
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions linux-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ deb https://deb.nodesource.com/node_8.x `lsb_release -c -s` main
deb-src https://deb.nodesource.com/node_8.x `lsb_release -c -s` main
EOF
sudo chmod a+rX /etc/apt/sources.list.d/nodesource.list

# Pin nodejs to 8.x, otherwise apt will update it to 10.x on newer
# Ubuntu versions
cat <<EOF | sudo tee /etc/apt/preferences.d/nodejs
Package: nodejs
Pin: version 8.*
Pin-Priority: 999
EOF
updated_apt_repo=yes
fi

Expand Down Expand Up @@ -218,14 +226,21 @@ install_protoc() {
install_watchman() {
if ! which watchman ; then
update "Installing watchman..."
kaclone_repo https://github.com/facebook/watchman.git "$REPOS_DIR/"
builddir="$DEVTOOLS_DIR/watchman/"
if [ ! -d "$builddir" ]; then
mkdir -p "$builddir"
git clone https://github.com/facebook/watchman.git "$builddir"
fi

(
# Adapted from https://medium.com/@saurabh.friday/install-watchman-on-ubuntu-18-04-ba23c56eb23a
cd "$REPOS_DIR/watchman"
sudo apt-get install -y autoconf automake build-essential python-dev
cd "$builddir"
sudo apt-get install -y autoconf automake build-essential python-dev libtool libssl-dev
git checkout tags/v4.9.0
./autogen.sh
./configure
# --enable-lenient is required for newer versions of GCC, which is
# stricter with certain constructs.
./configure --enable-lenient
make
sudo make install
)
Expand Down

0 comments on commit 181d778

Please sign in to comment.