Skip to content
Shahid edited this page Jan 17, 2020 · 6 revisions

Building grpc-node

gRPC for Node.js is a modern open source high performance RPC framework that can run in any environment. The instructions provided below specify the steps to build grpc-node (v1.24.2) on Linux on IBM Z for following distributions:

  • RHEL (7.5, 7.6, 7.7, 8.0)
  • SLES (12 SP4, 15 SP1)
  • Ubuntu (16.04, 18.04, 19.10)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Install the dependencies

export SOURCE_ROOT=/<source_root>/
  • Install dependency packages

    • RHEL (7.5, 7.6, 7.7)

      sudo yum install -y gcc-c++ git make wget curl python
    • RHEL (8.0)

      sudo yum install -y gcc-c++ git make wget curl

      Install Python version 2.7.16 from here

    • SLES (12.4, 15.1)

      sudo zypper install gcc-c++ git-core make wget curl python
    • Ubuntu (16.04, 18.04, 19.10)

      sudo apt-get install -y gcc g++ git make wget python curl
  • Install node

    nodejs and npm packages can also be installed via distribution repository. Use below instructions to install node v13.3.0 version.

    cd $SOURCE_ROOT
    wget https://nodejs.org/dist/v13.3.0/node-v13.3.0-linux-s390x.tar.xz
    chmod ugo+r node-v13.3.0-linux-s390x.tar.xz
    sudo tar -C /usr/local -xf node-v13.3.0-linux-s390x.tar.xz
    export PATH=$PATH:/usr/local/node-v13.3.0-linux-s390x/bin

Method 1: Build from source

The following command can be used to build from source when installing the package from npm:

npm install --build-from-source --unsafe-perm

The --build-from-source option will work even when installing another package that depends on grpc. To build only grpc from source, you can use the argument --build-from-source=grpc.

Method 2: Build in GIT repository

  • Step 1: Download source code

    git clone https://github.com/grpc/grpc-node.git
    cd grpc-node/
    git checkout [email protected]
    git submodule update --init --recursive
  • Step 2: Build source code

    cd packages/grpc-native-core/
    npm install --build-from-source --unsafe-perm
    npm install --save-dev [email protected] (For RHEL 7.6 and Ubuntu 19.10 only)
  • Step 3: Testing (Optional)

    • The node 11.x binary throws an error node: /lib64/libstdc++.so.6: version 'GLIBCXX_3.4.20' not found when installed gcc version is 4.8.5 or less. This is the case for RHEL 7.x distributions. For removing support to node version 11, Edit /<source_root>/grpc-node/run-tests.sh (For RHEL 7.5, 7.6, 7.7 Only):

      diff --git a/run-tests.sh b/run-tests.sh
      index 01e6741..37a8bfd 100755
      --- a/run-tests.sh
      +++ b/run-tests.sh
      @@ -26,7 +26,7 @@ set -ex
      cd $ROOT
      
      if [ ! -n "$node_versions" ] ; then
      -  node_versions="6 7 8 9 10 11 12"
      +  node_versions="6 7 8 9 10 12"
      fi
               
      set +ex
      
    • Execute the test suite:

      cd /<source_root>/grpc-node/
      ./run-tests.sh
    • Execute scenario test:

      gRPC Node Quick Start

Reference

Clone this wiki locally