Trying to generate rpm on RHEL8 Machine. The same rpm_build.sh script works fine on RHEL6 & RHEL7. But in RHEL 8 its failing to generate debuginfo packages.
RPM BUILD VERSION :
$ sudo yum install rpm-build
Package rpm-build-4.14.3-23.el8.x86_64 is already installed.
+ install -m 755 libclntshcore.so.12.1 /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libclntshcore.so.12.1
+ install -m 755 libnnz12.so /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libnnz12.so
/usr/lib/rpm/find-debuginfo.sh -j8 --strict-build-id -m -i --build-id-seed 23.1.3-1.el8 --unique-debug-suffix -23.1.3-1.el8.x86_64 --unique-debug-src-base my_lib-23.1.3-1.el8.x86_64 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 -S debugsourcefiles.list /home/opc/rpmbuild/BUILD/my_lib-23.1.3
extracting debug info from /home/opc/rpmbuild/BUILDROOT/my_lib23.1.3-1.el8.x86_64/usr/lib64/pam/libclntshcore.so.12.1
extracting debug info from /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libnnz12.so
gdb-add-index: No index was created for /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libons.so
gdb-add-index: [Was there no debuginfo? Was there already an index?]
gdb-add-index: No index was created for /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libclntshcore.so.12.1
gdb-add-index: [Was there no debuginfo? Was there already an index?]
My Spec.file
Name: my_lib-devel
Version: %{pkg_version}
Release: %{pkg_release}%{?dist}
Group: System Environment/Libraries
Source0: %{_sourcedir}/%{name}-%{version}.tar.gz
Requires: my_lib
%global debug_package %{nil}
%global _lib_authn_api_filename libauthn_api.so
%global _package_name my_lib
%description
developemnt package
%prep
%setup -q
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%build
%install
mkdir -p %{buildroot}/%{_includedir}/%{_package_name}
mkdir -p %{buildroot}%{_datadir}/doc/%{name}
cp *.h %{buildroot}/%{_includedir}/%{_package_name}
install -m 644 README %{buildroot}%{_datadir}/doc/%{name}/README
install -m 644 LICENCE %{buildroot}%{_datadir}/doc/%{name}/LICENCE
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
/%{_includedir}/%{_package_name}/*.h
%doc %{_datadir}/doc/%{name}/*
Not sure why it complaints while extracting debug info
When I ran it on RHEL6 / RHEL7 same thing works fine . Is something is updated in RHEL8 which I'm missing or do I need to update the specs to work on RHEL8 . I have tried couple of solution Like %global debug_package %{nil} or %define debug_package %{nil} But nothing works.
Kindly Help !
Related
I am creating my first package using RPM on ubuntu machine.But I am getting so many difficulties.I tried so many commands to install rpmdevtools using "yum" but it is giving error as There are not repos enabled.
When I try to install it using apt-get it gives error as Unable to locate the package.
Can anybody suggest the proper start to end procedure with commands to build a package using RPM?
rpmdev is mostly optional. rpm is enough. The following describes the minimum steps to package a script program into a RPM file on Debian.
Install rpmbuild:
apt-get install rpm
Create a helloworld program:
cat > helloworld <<EOF
#! /bin/bash
printf "Hello World!\n"
EOF
chmod +x helloworld
Create a minimal specification helloworld.spec:
Name: helloworld
Version: 1.0
Release: 1%{?dist}
Summary: Hello World
License: GPLv3+
BuildArch: noarch
%description
Hello World!
%prep
%build
%install
mkdir -p %{buildroot}/%{_bindir}
install -m 0755 %{name} %{buildroot}/%{_bindir}/%{name}
%files
%{_bindir}/%{name}
%changelog
Build the RPMs:
rpmbuild -ba --build-in-place --define "_topdir $(pwd)/rpm" helloworld.spec
mv rpm/SRPMS/*.rpm .
mv rpm/RPMS/*/*.rpm .
rm -rf rpm
But you will not be able to install it on Debian or Ubuntu. The installation requires Fedora or Red Hat.
I have an RPM spec file like this, I have compiled a C file and created an executable and trying to copy it to buildroot/tmp folder and trying to execute it from there,
%install
mkdir -p %{buildroot}/tmp/
install -m 755 /root/Desktop/np %{buildroot}/tmp/np
./%{buildroot}/tmp/np
%files
/tmp/np
When I try to build the RPM, I am facing an error
"/var/tmp/rpm-tmp.0HMeZn: line 35:
.//root/rpmbuild/BUILDROOT/hp-simulate-generalfailure1-1.0.0-1.x86_64/tmp/np:
No such file or directory"
Help me out to make a clean build. Thanks in advance.
Let's put aside that you are doing something very strange and executing rpmbuild as root (very nasty).
The %{buildroot} is an absolute path. See:
$ rpm --eval '%{buildroot}'
/home/msuchy/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64
If you are really trying to execute that binary, you should not put the leading ./ there. So you snippet should be:
%install
mkdir -p %{buildroot}/tmp/
install -m 755 /root/Desktop/np %{buildroot}/tmp/np
%{buildroot}/tmp/np
%files
/tmp/np
Running anything in %install section will occur only on the build machine, during rpm build process. It will not happen when you install the RPM.
To run something upon package installation, you have to make use of scriplets:
%install
mkdir -p %{buildroot}/tmp/
install -m 755 /root/Desktop/np %{buildroot}/tmp/np
%files
/tmp/np
%post
/tmp/np
In example above, /tmp/np will be executed when package is either installed for the first time, or upgraded.
I have Ubuntu 16.04 (on Docker) and wanted to connect to remote Oracle DB using Python. For that - using cx_oracle module.
Tried:
pip install cx_oracle
--> Complained about libaio1 and libaio-dev missing..
apt-get install libaio1 libaio-dev
--> Complained again:
cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "libclntsh.so: cannot open shared object file: No such file or directory"
Is there a one command to install cx_Oracle properly on Ubuntu 16.04 (or need to do all from source manually -> trying to automate all steps...)?
Thanks.
Did not find (yet) easy way but this is what I did:
This just worked for me on Ubuntu 16:
Download ('instantclient-basic-linux.x64-12.2.0.1.0.zip' and 'instantclient-sdk-linux.x64-12.2.0.1.0.zip') from Oracle web site and then do following script (you can do piece by piece and I did as a ROOT):
apt-get install -y python-dev build-essential libaio1
mkdir -p /opt/ora/
cd /opt/ora/
## Now put 2 ZIP files:
# ('instantclient-basic-linux.x64-12.2.0.1.0.zip' and 'instantclient-sdk-linux.x64-12.2.0.1.0.zip')
# into /opt/ora/ and unzip them -> both will be unzipped into 1 directory: /opt/ora/instantclient_12_2
rm -rf /etc/profile.d/oracle.sh
echo "export ORACLE_HOME=/opt/ora/instantclient_12_2" >> /etc/profile.d/oracle.sh
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME" >> /etc/profile.d/oracle.sh
chmod 777 /etc/profile.d/oracle.sh
source /etc/profile.d/oracle.sh
env | grep -i ora # This will check current ENVIRONMENT settings for Oracle
rm -rf /etc/ld.so.conf.d/oracle.conf
echo "/opt/ora/instantclient_12_2" >> /etc/ld.so.conf.d/oracle.conf
ldconfig
cd $ORACLE_HOME
ls -lrth libclntsh* # This will show which version of 'libclntsh' you have... --> needed for following line:
ln -s libclntsh.so.12.1 libclntsh.so
pip install cx_Oracle # Maybe not needed but I did it anyway (only pip install cx_Oracle without above steps did not work for me...)
Now python scripts are ready to use 'cx_Oracle'.
I'm trying to install a custom driver rpm that I custom built. I have a kickstart file bundled into a RHEL7.2 iso with a %post section. In the %post, I have a yum install of the driver rpm which seems to get installed, but I notice that depmod logs fatal errors when the driver rpm gets installed:
Installing : kmod-xnxx-1.0-1_test.x86_64
depmod: FATAL: could not load 3.10.0-327.el7.x86_64: No such file or directory
warning: %post(kmod-xnxx-1.0-1_test.x86_64) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package kmod-xnxx-1.0-1_test.x86_64
Verifying : kmod-xnxx-1.0-1_test.x86_64
Installed :
kmod-xnxx-1.0-1_test.x86_64
Complete!
As the rpm gets installed, it runs a depmod -a and dracut to rebuild the ramdisk. I'm not sure why these errors a re occurring during the anaconda post install? I've confirmed that the same kernel "3.10.0-327.el7.x86_64" is being used during the post so I have no idea why the module doesn't get installed correctly without the "depmod" errors. I recall from the past that the running kernel during the anaconda install has differences with the kernel that actually gets installed. I'm not sure if this is attributed to the issue I'm having with the post. Any suggestions on how to overcome this would be great. Thanks!
Below is the spec file that I'm using to build the kernel driver rpm(kmod) against kernel 3.10.0-327.el7.x86_64:
%define build_kernel 3.10.0-327.el7.x86_64
%define current_kernel %(uname -r)
%define destdir /lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/net/
Summary: driver
Name: kmod-xnxx
Version: 1.0
Release: 1_test
License: GPL
Group: Hardware driver
BuildArch: x86_64
BuildRoot: %{buildroot}
%description
Creating a xn4xx kernel module RPM
%prep
%install
mkdir -p %{buildroot}%{destdir}
if [ “%{build_kernel}” != “%{current_kernel}” ]; then
echo “This rpm is for %{build_kernel} kernel version. Ensure that you are using right module/kernel”
exit 1
fi
ls %{destdir} > /dev/null 2> /dev/null
if [ $? != 0 ]; then
echo “%{destdir} is not there. Unable to install the driver.”
exit 1
fi
install -m 644 %(pwd)/BUILD/xnxx.ko %{buildroot}%{destdir}xnxx.ko
%clean
rm -rf %{buildroot}
%post
/sbin/depmod -a %{current_kernel}
/sbin/dracut -v -f /boot/initramfs-%{current_kernel}.img %{current_kernel}
%files
%defattr(-,root,root)
%{destdir}xnxx.ko
%changelog
I am trying to build a rpm but unfortunately in my build machine I only have limted permission, which means the operation in %install can't be done inside the build machine. How to build the package(.rpm file) without running %install section? It looks like that no options are available for this purpose:
http://www.rpm.org/max-rpm-snapshot/ch-rpm-b-command.html
My bu.spec file:
Summary: xxxx
Name: xx
Version: 1.0
Release: 1
Group: Applications/Sound
License: Share
%description
%prep
echo "prep"
%build
%install
echo "install"
mkdir -p /opt/xcp_src/
cp scripts.tgz /opt/xcp_src/
%files
/tmp/xcp_src/scripts.tgz
%post
cd /opt/xcp_src/
tar zxvf scripts.tgz
First off, set a buildroot and use that in install, eg:
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
...
%install
mkdir -p %{buildroot}/opt/xcp_src
Second, make sure you can build without being root by moving the RPM build area.
I'd also suggest specifying an actual list of files (rather than having RPM extract a tgz file) as that would make the package cleanly removable.