You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Amazon Linux 2023构建Ruby 3.3.0 RPM时出现硬编码路径链接问题

在Amazon Linux 2023中构建Ruby RPM后,安装原生扩展gem时出现链接器脚本路径错误

我此前在Amazon Linux 2上使用以下ruby.spec文件构建多个版本的Ruby RPM,运行状态良好。迁移至Amazon Linux 2023后,尽管仍能生成RPM,但在使用Ruby构建带有原生扩展的gem时,出现如下错误:

linking shared-object redcarpet.so
/usr/bin/ld: cannot open linker script file /home/builder/rpmbuild/BUILD/ruby-3.3.0/.package_note-ruby-3.3.0-1.amzn2023.aarch64.ld: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:265: redcarpet.so] Error 1

/home/builder是构建RPM的机器上存在的目录,但在安装该RPM的机器上并不存在。推测RPM中被硬编码了路径,但不清楚为何在Amazon Linux 2与2023之间出现该变化。附使用的ruby.spec文件内容:

Name: ruby
Version: 3.3.0
Release: 1%{?dist}
License: Ruby License/GPL - see COPYING
URL: http://www.ruby-lang.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
AutoReqProv: no
Requires: readline ncurses gdbm glibc openssl libyaml libffi zlib
BuildRequires: readline-devel ncurses-devel gdbm-devel glibc-devel gcc openssl-devel make libyaml-devel libffi-devel zlib-devel rust
Source0: https://cache.ruby-lang.org/pub/ruby/3.3/ruby-%{version}.tar.gz
Summary: An interpreter of object-oriented scripting language
Group: Development/Languages
Provides: ruby(abi) = 3.0
Provides: ruby-irb
Provides: ruby-rdoc
Provides: ruby-libs
Provides: ruby-devel
Provides: rubygems
Obsoletes: ruby < %{version}
Obsoletes: ruby-devel < %{version}
Obsoletes: ruby-irb < %{version}
Obsoletes: ruby-libs < %{version}
Obsoletes: rubygem-bigdecimal
Obsoletes: rubygem-io-console
Obsoletes: rubygem-json
Obsoletes: rubygem-psych
Obsoletes: rubygem-rdoc
Obsoletes: rubygems

%description
Ruby is the interpreted scripting language for quick and easy
object-oriented programming.  It has many features to process text
files and to do system management tasks (as in Perl).  It is simple,
straight-forward, and extensible.

%prep
%setup -n ruby-%{version}

%build
export CFLAGS="$RPM_OPT_FLAGS -Wall -fno-strict-aliasing -std=gnu99"

%configure \
  --enable-yjit \
  --with-jemalloc \
  --enable-shared \
  --disable-rpath \
  --without-X11 \
  --includedir=%{_includedir}/ruby \
  --libdir=%{_libdir}

make %{?_smp_mflags}

%install
make install DESTDIR=$RPM_BUILD_ROOT
rm -rf $RPM_BUILD_ROOT/usr/src

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
%{_bindir}/*
%{_includedir}/*
%{_datadir}/*
%{_libdir}/*

内容的提问来源于stack exchange,提问作者jsharpe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 02:28:17