在 Ubuntu 20.04 上安装 Jekyll 时出错(无法构建 gem 本机扩展)

发布于 2025-01-18 12:20:10 字数 3867 浏览 0 评论 0原文

问题

我目前无法在运行 Ubuntu 20.04.4 的 DigitalOcean Dokku Droplet 上成功安装 Jekyll。

尝试安装 Jekyll 后,我得到以下输出:

root@dokku:~# gem install jekyll bundler
Building native extensions. This could take a while...
ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.

    current directory: /root/gems/gems/sassc-2.4.0/ext
/usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20220401-970781-mkakxz.rb extconf.rb
creating Makefile

current directory: /root/gems/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /root/gems/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/memory/allocator.cpp
compiling ./libsass/src/ast.cpp
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make: *** [Makefile:237: ast.o] Error 1

make failed, exit code 2

Gem files will remain installed in /root/gems/gems/sassc-2.4.0 for inspection.
Results logged to /root/gems/extensions/x86_64-linux/2.7.0/sassc-2.4.0/gem_make.out
Successfully installed bundler-2.3.10
Parsing documentation for bundler-2.3.10
Done installing documentation for bundler after 0 seconds
1 gem installed

故障排除

在 Droplet 上安装 Jekyll 之前,我运行了以下命令:

  1. 已安装 Ruby,按照官方 Jekyll 文档

    sudo apt-get install ruby​​-full build-essential zlib1g-dev
    
  2. 已安装 ruby-dev,如此 GitHub问题上的建议线程与我有类似的问题:

    sudo apt-get install ruby​​-dev
    
  3. Installed Jekyll

    gem 安装 jekyll 捆绑程序
    

下面是 Jekyll 要求页面中列出的依赖项的版本

ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]

gem -v
3.1.2

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix

make -v
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

问题

为什么我可以Jekyll 没有成功安装?

似乎大多数人的问题在于在 Ubuntu 上安装 Jekyll 时没有 ruby​​-dev。但是,我在安装 ruby​​-dev 后安装 Jekyll 仍然失败。

Issue

I am currently unable to successfully install Jekyll on a DigitalOcean Dokku droplet running Ubuntu 20.04.4.

I get the following output after trying to install Jekyll:

root@dokku:~# gem install jekyll bundler
Building native extensions. This could take a while...
ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.

    current directory: /root/gems/gems/sassc-2.4.0/ext
/usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20220401-970781-mkakxz.rb extconf.rb
creating Makefile

current directory: /root/gems/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /root/gems/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/memory/allocator.cpp
compiling ./libsass/src/ast.cpp
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make: *** [Makefile:237: ast.o] Error 1

make failed, exit code 2

Gem files will remain installed in /root/gems/gems/sassc-2.4.0 for inspection.
Results logged to /root/gems/extensions/x86_64-linux/2.7.0/sassc-2.4.0/gem_make.out
Successfully installed bundler-2.3.10
Parsing documentation for bundler-2.3.10
Done installing documentation for bundler after 0 seconds
1 gem installed

Troubleshooting

Before installing Jekyll on the droplet, I ran the following commands:

  1. Installed Ruby, as per official Jekyll documentation:

    sudo apt-get install ruby-full build-essential zlib1g-dev
    
  2. Installed ruby-dev, as suggested on this GitHub Issues thread that had as similar issue that I have:

    sudo apt-get install ruby-dev
    
  3. Installed Jekyll

    gem install jekyll bundler
    

Below are the versions of the dependencies listed in the Jekyll Requirements page

ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]

gem -v
3.1.2

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix

make -v
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Question

Why can I not successfully install Jekyll?

It seems like most people's issues lies in not having ruby-dev when installing Jekyll on Ubuntu. However, my installation of Jekyll still fails after installing ruby-dev.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文