I'm using an old RHEL5 system and trying to install davfs from source. I don't have the option of upgrading the entire system to a newer version, so I am stuck with what I have.
This is what I have tried so far:
Setup rpmbuild environment following the instructions at https://wiki.centos.org/HowTos/SetupRpmBuildEnvironment. Works fine, I can use rpmbuild without needing sudo.
Located the closest match for davfs srpm I could find for the system I am using: http://rpm.pbone.net/index.php3/stat/26/dist/74/size/455789/name/davfs2-1.4.7-8.el6.src.rpm
Downloaded and installed the srpm
$ wget ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/6/SRPMS/davfs2-1.4.7-8.el6.src.rpm
$ rpm -i davfs2-1.4.7-8.el6.src.rpm
Patched the source using included patch files
$ cd ~/rpmbuild/SPECS
$ rpmbuild -bp davfs2.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.fxF37X
+ umask 022
+ cd /home/myusername/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/myusername/rpmbuild/BUILD
+ rm -rf davfs2-1.4.7
+ /usr/bin/gzip -dc /home/myusername/rpmbuild/SOURCES/davfs2-1.4.7.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd davfs2-1.4.7
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ echo 'Patch #1 (davfs2-1.4.7-neon-0.30.patch):'
Patch #1 (davfs2-1.4.7-neon-0.30.patch):
+ /bin/cat /home/myusername/rpmbuild/SOURCES/davfs2-1.4.7-neon-0.30.patch
+ /usr/bin/patch -p1
patching file configure
+ echo 'Patch #2 (davfs2-1.4.7-system.patch):'
Patch #2 (davfs2-1.4.7-system.patch):
+ /bin/cat /home/myusername/rpmbuild/SOURCES/davfs2-1.4.7-system.patch
+ /usr/bin/patch -p1
patching file ChangeLog
patching file src/kernel_interface.c
patching file src/mount_davfs.c
+ exit 0
Now when I try to build the patched source, I get the error below:
$ rpmbuild -ba davfs2.spec
...
configure: incompatible neon library version 0.30.0: wanted 0.25 26 27 28 29 30
configure: error: could not find neon
error: Bad exit status from /var/tmp/rpm-tmp.AFBGNB (%build)
I found a patchfile which indicates this has been fixed and it should build with neon 0.30.0: https://lists.fedoraproject.org/pipermail/scm-commits/Week-of-Mon-20130916/1115037.html. These 2 lines from that page are interesting:
# Add support for neon 0.30.0
-%patch1
This is where I am stuck. I tried looking at the .patch files included under ~/rpmbuild/SOURCES/davfs2-1.4.7, but couldn't figure out if the patch shown on 1115037.html was included in the srpm. If it was not, how do I update the patch and build it successfully?
I have tried installing davfs binary. It installs fine, but mount fails with SSL handshake error or SSL version mismatch error due to old SSL libraries. This is why I am trying to build from source.
That line means take the %patch1 line out of the specfile. But if you look lower in the patch, it re-adds it with the -p1 parameter. That patch edits the first patch file and the specfile:
davfs2-1.4.7-neon-0.30.patch | 47 ++++++++++++++++++++++++++++++-----------
davfs2.spec | 8 +------
So you need to try applying ALL the patches in that email.
Related
I am running a program (OpenModelica OMEdit 1.18.0~dev-109-ged8ef0a) which requires gmake for one of its operations. gmake is not installed on my Mac (Big Sur 11.5.2) but make is. I tried to symlink gmake to point at make but it does not work:
➜ where make
/usr/bin/make
➜ make -v | HEAD -n 1
GNU Make 3.81
➜ pwd
/opt/openmodelica/bin
➜ sudo ln -s /usr/bin/make /opt/openmodelica/bin/gmake
➜ ls -lh gmake
lrwxr-xr-x 1 root wheel 13B 13 Dec 09:15 gmake -> /usr/bin/make
➜ /opt/openmodelica/bin/gmake -v
gmake: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find gmake 2> /dev/null' failed with exit code 17664: (null) (errno=Invalid argument)
xcode-select: Failed to locate 'gmake', requesting installation of command line developer tools.
It prompts each time to install the XCode command line developer tools which I have already done. From the error message it looks like it is trying to find gmake despite pointing at the make executable? (Why is it erroring?) Is there a way to get this to work as I was expecting or do I have to install gmake using brew then symlink to that?
Command line tools version:
➜ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 12.5.1.0.1.1623191612
volume: /
location: /
install-time: 1639360537
groups: com.apple.FindSystemFiles.pkg-group
** edit **
I'm using zsh 5.8 (x86_64-apple-darwin20.0), I don't know if that's a factor in the gmake symlink to make not working correctly?
I don't understand why this works but from #Holger Just's comment:
➜ brew install make
This will add a symlink:
➜ ls -lh /usr/local/bin/gmake
/usr/local/bin/gmake# -> ../Cellar/make/4.3/bin/gmake
And then symlinking to that instead:
➜ sudo ln -s /usr/local/bin/gmake /opt/openmodelica/bin/gmake
... works as expected:
➜ /opt/openmodelica/bin/gmake -v | head -n 1
GNU Make 4.3
I'm trying to write my first formula, for the Rserve package in R: https://www.rforge.net/Rserve/ .
So far I have this:
# Documentation: https://docs.brew.sh/Formula-Cookbook
# https://www.rubydoc.info/github/Homebrew/brew/master/Formula
class Rserve < Formula
desc "Rserve acts as a socket server (TCP/IP or local sockets) which allows binary requests to be sent to R."
homepage "http://www.rforge.net/Rserve/"
url "https://cran.r-project.org/src/contrib/Rserve_1.7-3.tar.gz"
sha256 "f6d636c736c3f16487d9987e54554fe0c55257b9bc0671b43e536d832e513027"
depends_on "r"
depends_on "gettext"
def install
system("whoami")
system("#{HOMEBREW_PREFIX}/bin/R CMD install --configure-args=\"CPPFLAGS=-L#{HOMEBREW_PREFIX}/opt/gettext/lib LDFLAGS=-I#{HOMEBREW_PREFIX}/opt/gettext/include\" .")
end
test do
# `test do` will create, run in and delete a temporary directory.
#
# This test will fail and we won't accept that! For Homebrew/homebrew-core
# this will need to be a test that verifies the functionality of the
# software. Run the test with `brew test Rserve`. Options passed
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
#
# The installed folder is not in the path, so use the entire path to any
# executables being tested: `system "#{bin}/program", "do", "something"`.
system "false"
end
end
The error I get is:
==> Downloading https://cran.r-project.org/src/contrib/Rserve_1.7-3.tar.gz
Already downloaded: /Users/kwilliams/Library/Caches/Homebrew/downloads/690e0934dcba3770ba80b743f7b2c9cee0250434ed17cc7949bc1eee74d5b170--Rserve_1.7-3.tar.gz
==> Verifying 690e0934dcba3770ba80b743f7b2c9cee0250434ed17cc7949bc1eee74d5b170--Rserve_1.7-3.tar.gz checksum
tar xf /Users/kwilliams/Library/Caches/Homebrew/downloads/690e0934dcba3770ba80b743f7b2c9cee0250434ed17cc7949bc1eee74d5b170--Rserve_1.7-3.tar.gz -C /private/tmp/d20190114-99089-11isfza
cp -pR /private/tmp/d20190114-99089-11isfza/Rserve/. /private/tmp/rserve-20190114-99089-b57ji6/Rserve
chmod -Rf +w /private/tmp/d20190114-99089-11isfza
==> whoami
kwilliams
==> /usr/local/bin/R CMD install --configure-args="CPPFLAGS=-L/usr/local/opt/gettext/lib LDFLAGS=-I/usr/local/opt/gettext/include" .
* installing to library ‘/usr/local/lib/R/3.5/site-library’
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/3.5/site-library’
==> Formula
Path: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/rserve.rb
==> Configuration
HOMEBREW_VERSION: 1.9.2-5-g44f4f36
ORIGIN: https://github.com/Homebrew/brew
HEAD: 44f4f36c0db693000410fe664b250a90325f4e32
Last commit: 4 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: de1ecc1d981de9d5165ea9e96242c32023d14d7c
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION: 1
HOMEBREW_LOGS: /Users/kwilliams/Library/Logs/Homebrew
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 11.0.1, 1.8.0_192
macOS: 10.13.6-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
XQuartz: 2.7.11 => /opt/X11
The permissions on /usr/local/lib/R/3.5/site-library should allow me to install there, though:
% ls -al /usr/local/lib/R/3.5/site-library
total 0
drwxr-xr-x 2 kwilliams admin 64 Jan 14 13:38 ./
drwxr-xr-x 3 kwilliams admin 96 Jan 14 13:38 ../
If I put myself in a directory where the Rserve tarball has been freshly expanded, then manually run the command /usr/local/bin/R CMD install --configure-args="CPPFLAGS=-L/usr/local/opt/gettext/lib LDFLAGS=-I/usr/local/opt/gettext/include" ., I don't get the error about "no permission to install to directory".
What's different about the environment that Homebrew is running that command, compared to me running it in a shell, that causes it to fail when run automatically?
My brew doctor output is clean, except for a warning that my docker keg is unlinked, which I assume is unrelated.
Figured it out - there's a sandbox (sandbox-exec, I think) in place that restricts writing to the filesystem outside the prefix directory:
https://discourse.brew.sh/t/potential-permission-issues-in-a-formula-im-writing/3707
I'll need to figure out the correct way to write files to /usr/local/lib/R/3.5/site-library, or symlink them to there from the Cellar directory, or whatever it is.
ERROR:
[root#localhost SPECS]# rpmbuild -ba libguestfs.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.xxzZTr
+ umask 022
+ cd /root/rpmbuild/BUILD
++ mktemp -d
+ tmphome=/tmp/tmp.BAJzdrk0ne
+ gpgv2 --homedir /tmp/tmp.BAJzdrk0ne --keyring
/root/rpmbuild/SOURCES/libguestfs.keyring /root/rpmbuild/SOURCES/libguestfs-
1.36.3.tar.gz.sig /root/rpmbuild/SOURCES/libguestfs-1.36.3.tar.gz
gpgv: keyblock resource `/root/rpmbuild/SOURCES/libguestfs.keyring': No such
file or directory
gpgv: Signature made Fri Mar 24 16:46:40 2017 EDT using RSA key ID E1B768A0
gpgv: Can't check signature: No public key
error: Bad exit status from /var/tmp/rpm-tmp.xxzZTr (%prep)
I do not have /root/rpmbuild/SOURCES/**libguestfs.keyring** file
and I want to know how it came?
Are you trying to build the RHEL 7.4 libguestfs package? The keyring file should be included in the source RPM. If you deleted it somehow then you can get it from the Fedora package here: https://src.fedoraproject.org/rpms/libguestfs/tree/master
You can also try the RHEL 7.5 preview packages (which include source) here: https://www.redhat.com/archives/libguestfs/2017-November/msg00006.html
I tried to build binaries in RHEL6 using rpmbuild command.It throws file not found error during rpmbuild command execution. But In RHEL5 the same rpmbuild command is working fine.
RHEL5 execution result:
*Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.77266
umask 022
cd /usr/src/redhat/BUILD
LANG=C
export LANG
unset DISPLAY*
RHEL6 execution result:
*Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.BeMhyH
umask 022
cd //rpmbuild/BUILD
'[' //rpmbuild/BUILDROOT/ '!=' / ']'
rm -rf //rpmbuild/BUILDROOT/
++ dirname //rpmbuild/BUILDROOT/
mkdir -p //rpmbuild/BUILDROOT
mkdir //rpmbuild/BUILDROOT/
LANG=C
export LANG
unset DISPLAY
/usr/lib/rpm/check-buildroot*
I am not able to find any %install changes between the spec files. Any one please help me to understand what am i doing wrong?
Thanks in Advance..!
The only problem that is clear from the snippets provided is that $HOME is not defined in your rpmbuild environment. $HOME/rpmbuild is the default build root for 'rpmbuild' in RHEL6, instead of /usr/src/redhat as in RHEL5.
Things to consider:
Is there an '~/.rpmmacros' file that is altering the rpmbuild
directives.
The temporary %install script will not be deleted on
error-exit. Inspecting it directly might tell you more about why it failed.
Ex:
[user#host rpmbuild]$ rpmbuild -bb nano
<snip>
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.2uw1tZ (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.2uw1tZ (%install)
[user#host rpmbuild]$ cat /var/tmp/rpm-tmp.2uw1tZ
#!/bin/sh
RPM_SOURCE_DIR="/home/user/rpmbuild/SOURCES"
RPM_BUILD_DIR="/home/user/rpmbuild/BUILD"
...
Older recommendations were to nuke the target buildroot as the first step of %install. To help force a separation between the %build and %install steps, newer versions of rpmbuild strictly enforce it by doing it for you for the first step, as shown in what you pasted in.
I am assuming that your %build stage is putting one or more files into the target buildroot area, which it shouldn't be doing. It should all be in the build area only.
I want to create the binary rpm files from generated binary packages in centos 6.4 and noticed in one of my build system the ${buildroot} is created automatically, I want to know how it can be achieved.
The sample wget.spec looks like below. detail spec is in my gist https://gist.github.com/larrycai/1ffe134bce1860f1cf87
%install
tar xf ~/wget.tar.gz -C %{buildroot}/
%files
%defattr(-,root,root)
/usr/bin/wget
The wget.tar.gz can be created tar -zcvf ~/wget.tar.gz /usr/bin/wget
When I build it using rpmbuild -bb wget.spec, I got the
+ rpmbuild -bb wget.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.VNDZg4
+ umask 022
+ cd /home/larry/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.S8koPW
+ umask 022
+ cd /home/larry/rpmbuild/BUILD
+ '[' /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64 '!=' / ']'
+ rm -rf /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64
++ dirname /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64
+ mkdir -p /home/larry/rpmbuild/BUILDROOT
+ mkdir /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64
+ LANG=C
+ export LANG
+ unset DISPLAY
+ tar xf /home/larry/wget.tar.gz -C /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64/
+ /usr/lib/rpm/check-buildroot
... (it is successful)
I wonder why line mkdir /home/larry/rpmbuild/BUILDROOT/wget-1.12-1.x86_64 is executed automatically.
Are there any script or rpmmacros is enabled for this ?
The main reason is that build machines installed redhat-rpm-config package, the detail list below
This macro setting is in /usr/lib/rpm/redhat/macros
%__spec_install_pre %{___build_pre}\
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
mkdir -p `dirname "$RPM_BUILD_ROOT"`\
mkdir "$RPM_BUILD_ROOT"\
%{nil}
We can either install this package or put this macros into ~/.rpmmacros
I find it by running command rpmbuild --showrc can see that mkdir code segment is there, so I start to check whether there is special package is installed.