无法在Alpine Linux上运行node-gdal:“ __printf_chk:找不到符号” [英] Unable to run node-gdal on Alpine Linux: "__printf_chk: symbol not found"

查看:651
本文介绍了无法在Alpine Linux上运行node-gdal:“ __printf_chk:找不到符号”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用 node-gdal 为我的项目添加Gitlab CI(节点 GDAL 的.js绑定)。由于性能原因,配置项配置基于Alpine Linux docker映像,但我无法使其正常运行。 Gitlab CI作业在运行需要 node-gdal 的Node.js脚本时失败,并出现以下错误:

I'm trying to add Gitlab CI for my project using node-gdal (Node.js bindings for GDAL). CI configuration is based on Alpine Linux docker image due to performance reasons but I'm unable to get it working. Gitlab CI job fails while running Node.js script that requires node-gdal with the following error:

internal/modules/cjs/loader.js:718
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: Error relocating /builds/project-0/node_modules/gdal/lib/binding/node-v64-linux-x64/gdal.node: __printf_chk: symbol not found
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/builds/project-0/node_modules/gdal/lib/gdal.js:12:29)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)

试图安装 glibc for Alpine ,但仍然没有运气。

Tried to install glibc for Alpine but still with no luck.

.gitlab-ci.yml

image: node:lts-alpine

stages:
  - test

test:
  stage: test
  before_script:
    - apk add --no-cache bash ca-certificates wget
    - wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
    - wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk
    - apk add glibc-2.29-r0.apk
  script:
    - yarn
    - node index.js

这是回购重现了此问题,这是链接到失败的工作

This is a repo reproducing the issue and this is a link to failed job.

在Alpine上使用库是否有解决方案?

Is there any solution to use the library on Alpine?

推荐答案

感谢这与相关的问题和答案,我可以使用

c来建立 node-gdal 链接到Alpine上的共享GDAL库。遵循以下CI配置(链接到通过的作业):

Thanks to this and this related questions and answers, I was able to build node-gdal linking against shared GDAL library on Alpine with the following CI configuration (link to passed job):

.gitlab-ci.yml

image: node:lts-alpine

stages:
  - test

test:
  stage: test
  before_script:
    - apk add --no-cache bash make gcc g++ python linux-headers udev --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing --repository http://dl-cdn.alpinelinux.org/alpine/edge/main gdal gdal-dev
  script:
    - npm install gdal --build-from-source --shared_gdal
    - node index.js

这篇关于无法在Alpine Linux上运行node-gdal:“ __printf_chk:找不到符号”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆