在 amazonlinux2023 上构建 ruby 3.3.0 rpm 链接到硬编码目录

问题描述 投票:0回答:1

我现在一直在使用下面的 ruby.spec 在 amazonlinux:2 上为多个版本的 ruby 构建 RPM。 效果很好。

我正在努力迁移到 amazonlinux: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 中,我不知道为什么 amazonlinux:2 和 amazonlinux:2023 之间会发生变化

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}/*
ruby rpm amazon-linux amazon-linux-2023
1个回答
0
投票

感谢 Red Hat bug #2043092,我能够解决这个问题。将以下行添加到您的规范文件中:

%undefine _package_note_flags            

它将从

rbconfig.rb
中删除以下违规标志:

-Wl,-dT,/home/builder/rpmbuild/BUILD/ruby-3.3.0/.package_note-ruby-3.3.0-1.amzn2023.aarch64.ld
© www.soinside.com 2019 - 2024. All rights reserved.