building ruby 3.3.0 rpm on amazonlinux2023 is linking to hard coded directories

57 Views Asked by At

I've been using the below ruby.spec to build RPMs on amazonlinux:2 for several versions of ruby now. Works great.

I'm working on migrating to amazonlinux:2023 and while this still produces an RPM, when I go to use ruby, and specifically, build a gem with native extensions, I get the following error:

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 is a directory that exists on the machine where I built the RPM. It doesn't exist on the machine where the rpm has been installed to. Some paths must have been hard coded into the rpm and I dont know why that would have changed between amazonlinux:2 and 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}/*
0

There are 0 best solutions below