LearningLocker / learninglocker

Learning Locker - The Open Source Learning Record Store. Started in 2014.
https://learningpool.com/solutions/learning-record-store-learning-locker/learning-locker-community-overview/
GNU General Public License v3.0
555 stars 276 forks source link

Installing in docker container errors while making the google-gax package #1623

Open andrei4002 opened 1 year ago

andrei4002 commented 1 year ago

What version were you using?

If you were using open source, please add the "Open Source" label to this issue. Open Source

What steps can we follow to reproduce the behaviour?

Trying to install this with docker using the following file:

FROM debian:11

RUN apt-get update \
    && apt-get install -y \
        wget \
        procps \
        curl \
        git \
        python \
        build-essential \
        xvfb \
        apt-transport-https \
        unzip \
        gettext-base \
        socat \
    && wget -qO- https://deb.nodesource.com/setup_14.x | bash \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/*

RUN npm install -g yarn

# install LL app
ENV LL_TAG=v7.1.1
RUN git clone https://github.com/LearningLocker/learninglocker.git /opt/learninglocker
RUN git clone https://github.com/LearningLocker/learninglocker.git /opt/learninglocker \
    && cd /opt/learninglocker \
    && git checkout $LL_TAG \
    && npm_config_build_from_source=true yarn install --ignore-engines \
    && yarn build-all

Creating a docker image yields an error with this output at the npm_config_build_from_source=true yarn install --ignore-engines step:

error /opt/learninglocker/node_modules/google-gax/node_modules/grpc: Command failed.
Exit code: 1
Command: ./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library
Arguments: 
Directory: /opt/learninglocker/node_modules/google-gax/node_modules/grpc
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.39
node-pre-gyp info using node@14.21.1 | linux | x64
node-pre-gyp info build requesting source compile
gyp info it worked if it ends with ok
gyp info using node-gyp@5.1.1
gyp info using node@14.21.1 | linux | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@5.1.1
gyp info using node@14.21.1 | linux | x64
gyp info find Python using Python version 2.7.18 found at "/usr/bin/python"
gyp http GET https://nodejs.org/download/release/v14.21.1/node-v14.21.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v14.21.1/node-v14.21.1-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v14.21.1/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v14.21.1/SHASUMS256.txt
gyp info spawn /usr/bin/python
gyp info spawn args [
gyp info spawn args   '/opt/learninglocker/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/opt/learninglocker/node_modules/google-gax/node_modules/grpc/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/opt/learninglocker/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.cache/node-gyp/14.21.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/14.21.1',
gyp info spawn args   '-Dnode_gyp_dir=/opt/learninglocker/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/14.21.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/opt/learninglocker/node_modules/google-gax/node_modules/grpc',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@5.1.1
gyp info using node@14.21.1 | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/opt/learninglocker/node_modules/google-gax/node_modules/grpc/build'
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_args.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_stack.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_stack_builder.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/connected_channel.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/handshaker.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/handshaker_factory.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/handshaker_registry.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/compression/compression.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/compression/message_compress.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/compression/stream_compression.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/compression/stream_compression_gzip.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/compression/stream_compression_identity.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/debug/stats.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/debug/stats_data.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/http/format_request.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/http/httpcli.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/http/parser.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/iomgr/call_combiner.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/iomgr/combiner.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/iomgr/endpoint.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/iomgr/endpoint_pair_posix.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/iomgr/endpoint_pair_uv.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/iomgr/endpoint_pair_windows.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/iomgr/error.o
In function 'void internal_add_error(grpc_error**, grpc_error*)',
    inlined from 'grpc_error* grpc_error_create(const char*, int, grpc_slice, grpc_error**, size_t)' at ../deps/grpc/src/core/lib/iomgr/error.cc:348:23:
../deps/grpc/src/core/lib/iomgr/error.cc:298:9: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
  298 |   memcpy((*err)->arena + slot, &new_last, sizeof(grpc_linked_error));
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'void internal_set_time(grpc_error**, grpc_error_times, gpr_timespec)',
    inlined from 'grpc_error* grpc_error_create(const char*, int, grpc_slice, grpc_error**, size_t)' at ../deps/grpc/src/core/lib/iomgr/error.cc:354:20:
../deps/grpc/src/core/lib/iomgr/error.cc:275:9: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
  275 |   memcpy((*err)->arena + slot, &value, sizeof(value));
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../deps/grpc/src/core/lib/iomgr/error.cc:36:
../deps/grpc/src/core/lib/iomgr/error_internal.h: In function 'grpc_error* grpc_error_create(const char*, int, grpc_slice, grpc_error**, size_t)':
../deps/grpc/src/core/lib/iomgr/error_internal.h:56:12: note: at offset 0 to object 'grpc_error::arena' with size 0 declared here
   56 |   intptr_t arena[0];
      |            ^~~~~
In function 'void internal_add_error(grpc_error**, grpc_error*)',
    inlined from 'grpc_error* grpc_error_add_child(grpc_error*, grpc_error*)' at ../deps/grpc/src/core/lib/iomgr/error.cc:508:21:
../deps/grpc/src/core/lib/iomgr/error.cc:298:9: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
  298 |   memcpy((*err)->arena + slot, &new_last, sizeof(grpc_linked_error));
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make: *** [grpc.target.mk:406: Release/obj.target/grpc/deps/grpc/src/core/lib/iomgr/error.o] Error 1
make: Leaving directory '/opt/learninglocker/node_modules/google-gax/node_modules/grpc/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/learninglocker/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Linux 5.15.49-linuxkit
gyp ERR! command "/usr/bin/node" "/opt/learninglocker/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/opt/learninglocker/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v83-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/opt/learninglocker/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v83-linux-x64-glibc"
gyp ERR! cwd /opt/learninglocker/node_modules/google-gax/node_modules/grpc
gyp ERR! node -v v14.21.1
gyp ERR! node-gyp -v v5.1.1
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /opt/learninglocker/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/opt/learninglocker/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v83-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/opt/learninglocker/node_modules/google-gax/node_modules/grpc/src/node/extension_binary/node-v83-linux-x64-glibc' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/opt/learninglocker/node_modules/google-gax/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1088:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
node-pre-gyp ERR! System Linux 5.15.49-linuxkit
node-pre-gyp ERR! command "/usr/bin/node" "/opt/learninglocker/node_modules/google-gax/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /opt/learninglocker/node_modules/google-gax/node_modules/grpc
node-pre-gyp ERR! node -v v14.21.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 

What is the actual behaviour?

If applicable, add screenshots to help explain your problem.

What is the expected behavior?

correct installation

Is there any additional information that will help us replicate/understand the problem?

LoopingRocks commented 1 year ago

Though I'm not in the same context, I also had problems with compiling gax with the current package.json in github.

I upgraded the following packages

"@google-cloud/pubsub": "^0.32.1", "node-sass": "^4.14.0",

And then yarn install and yarn build-all worked fine.

Hope it can help.

mu-zzi commented 1 year ago

This is not an issue related to docker. If you try to install LL it will break.

To fix the grpc issue, I've done two steps:

  1. remove grpc from the package.json and install @grpc/grpc-js
  2. then you I got the error "Error: The gRPC binary module was not installed." which I fixed by cd /path/to/your/learninglocker/webapp/node_modules/grpc && npm i