rpmbuild install: cannot create directory - packaging

I'm creating an RPM file but when using install I get some permission errors.
This is my spec file:
%define buildroot %{_tmppath}/nagios-1-1-root-%(%{__id_u} -n)
Summary: Nagios blabla
Name: nagios
Version: 1
Release: 1
License: PROPRIETARY
Group: Applications/Accessories
Source: nagios-1.tar.gz
Packager: Nicholas Lievens <lievens.nicholas#gmail.com>
AutoReqProv: no
Requires: gcc gcc-c++ glibc glibc-common glibc-devel gd gd-devel php53 php53-cli php53-mysql php53-gd php53-pdo graphviz httpd libdbi-dbd-mysql libdbi-devel mysql mysql-server mysql-devel git
%description
Nagios!
%prep
%setup
%build
./configure --with-init-dir=/etc/init.d --with-nagios-user=nagios --with-nagios-group=nagios
make all
%install
make install DESTDIR=${RPM_BUILD_ROOT}
make install-init DESTDIR=${RPM_BUILD_ROOT}
make install-config DESTDIR=${RPM_BUILD_ROOT}
make install-commandmode DESTDIR=${RPM_BUILD_ROOT}
make install-webconf DESTDIR=${RPM_BUILD_ROOT}
make install-devel DESTDIR=${RPM_BUILD_ROOT}
#htpasswd -b -c /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadmin
%files
%defattr(755,root,root)
/etc/init.d/nagios
%{_prefix}/var
%{_prefix}/var/spool/checkresults
%{_prefix}/var/rw
%{_prefix}/etc
%{_prefix}/bin
%{_prefix}/sbin
%{_prefix}/libexec
%{_prefix}/lib
%{_prefix}/include/nagios
%{_prefix}/share
%{_prefix}/etc
%defattr(644,root,root)
%config(noreplace) %{_prefix}/etc/*.cfg
%defattr(750,root,nagios)
/etc/nagios
/etc/nagios/objects
%defattr(755,nagios,nagios)
/var/log/nagios
/var/log/nagios/archives
%defattr(2775,nagios,nagios)
/var/spool/nagios
###%files www
%defattr(755,root,root)
%{_prefix}/sbin
%{_prefix}/sbin/*
%{_prefix}/share/nagios
%defattr(-,root,root)
%{_prefix}/share/nagios/*
%config(noreplace) /etc/httpd/conf.d/nagios.conf
%defattr(-,root,root)
%{_prefix}/include/nagios
%{_prefix}/include/nagios/locations.h
Some things are commented out just for debugging reasons.Could anyone tell why I'm getting the output:
install: cannot create directory `/var/spool/nagios': Permission
denied error: Bad exit status from /var/tmp/rpm-tmp.80635 (%install)

Are you trying to build this on RHEL 5? If so, you need to add this line somewhere in the header:
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Otherwise $RPM_BUILD_ROOT will not be populated.

Related

Conan WSL install: option 'pybind' doesn't exist

Update:
I decided to build the makefiles to build the libraries by hand. That worked. I am leaving this up in case someone has a suggestion as to how to get conan to work.
I am trying to install some libraries in WSL Linux using conan.
One of the libraries is here: https://github.com/Aquaveo/xmscore
I have installed conan, cmake, and xmsconan (see Building-Libraries below).
I am installing xmscore using these instructions:
https://github.com/Aquaveo/xmscore/wiki/Building-Libraries
When I run the command:
conan install -pr ../dev/xmsprofile_debug ..
I get the following error message:
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=gcc
compiler.version=9.4
cppstd=17
os=Linux
os_build=Linux
[options]
xmscore:pybind=False
xmscore:xms=True
[build_requires]
*: pybind11/2.10.0
[env]
ERROR: /home/stboerne/Programming/ThirdParty/xmscore/conanfile.py: Error while initializing options. option 'pybind' doesn't exist
Possible options are []
I tried some of the options from here (Cmake: using conan pybind11 package), but nothing here seems to work, and I am too much of a novice to conan.
The command:
conan search pybind11 -r=all
produces the following output:
Existing package recipes:
Remote 'conancenter':
pybind11/2.4.3
pybind11/2.5.0
pybind11/2.6.0
pybind11/2.6.1
pybind11/2.6.2
pybind11/2.7.0
pybind11/2.7.1
pybind11/2.8.1
pybind11/2.9.1
pybind11/2.9.2
pybind11/2.10.0
Any suggestions?
TIA

Missing asn1.h on httpd build from source

i have been trying to build httpd-2.4.43 from source and i included OpenSSL-fips-2.0.16.
However, i encountered an error during build process of httpd. see below;
make[2]: Entering directory `/root/httpd/httpd-2.4.43/support'
/root/httpd/httpd-2.4.43/srclib/apr/libtool --silent --mode=compile gcc -std=gnu99 -I/opt/openssl-fips-2.0.16/include -g -O2 -pthread -DLINUX -D_REENTRANT -D_GNU_SOURCE \
-I. -I/root/httpd/httpd-2.4.43/os/unix -I/root/httpd/httpd-2.4.43/include -I/root/httpd/httpd-2.4.43/srclib/apr/include -I/root/httpd/httpd-2.4.43/srclib/apr-util/include -I/usr/local/include -I/root/httpd/httpd-2.4.43/modules/aaa -I/root/httpd/httpd-2.4.43/modules/cache -I/root/httpd/httpd-2.4.43/modules/core -I/root/httpd/httpd-2.4.43/modules/database -I/root/httpd/httpd-2.4.43/modules/filters -I/root/httpd/httpd-2.4.43/modules/ldap -I/root/httpd/httpd-2.4.43/server -I/root/httpd/httpd-2.4.43/modules/loggers -I/root/httpd/httpd-2.4.43/modules/lua -I/root/httpd/httpd-2.4.43/modules/proxy -I/root/httpd/httpd-2.4.43/modules/http2 -I/root/httpd/httpd-2.4.43/modules/session -I/root/httpd/httpd-2.4.43/modules/ssl -I/root/httpd/httpd-2.4.43/modules/test -I/root/httpd/httpd-2.4.43/server -I/root/httpd/httpd-2.4.43/modules/md -I/root/httpd/httpd-2.4.43/modules/arch/unix -I/root/httpd/httpd-2.4.43/modules/dav/main -I/root/httpd/httpd-2.4.43/modules/generators -I/root/httpd/httpd-2.4.43/modules/mappers -prefer-non-pic -static -c ab.c && touch ab.lo
In file included from ab.c:161:0:
/opt/openssl-fips-2.0.16/include/openssl/rsa.h:62:26: fatal error: openssl/asn1.h: No such file or directory
#include <openssl/asn1.h>
^
compilation terminated.
make[2]: *** [ab.lo] Error 1
Above error message points to missing asn1.h.
I do not know where to find it. Maybe there is a missing procedure on building OpenSSL from source?
I feel i miss something when building OpenSSL from source.
Please do point me to the right direction for this.
Fixed it. Apprently, when i search for resources, i was finding the asn1.h problem not knowing that rsa.h part which includes asn1.h.
So it was found out that this was due to the *ssl-devel dependencies while building openssl.
So please install the *ssl-devel in your build envionrment
openssl-devel for RHEL/Fedora
libssl-devel for Debian
Then rebuild OpenSSL then httpd
You have to install OpenSSL development package, which is available in standard repositories of all modern Linux distributions.
Install OpenSSL development package on Debian, Ubuntu or their derivatives:
sudo apt-get install libssl-dev
To install OpenSSL development package on Fedora, CentOS or RHEL:
sudo yum install openssl-devel

install ncurses extensions on php7.0

I try install ncurses extensions for php7.0 but I get this error
/bin/bash /tmp/pear/download/ncurses-1.0.2/libtool --mode=compile cc -I. -I/tmp/pear/download/ncurses-1.0.2 -DPHP_ATOM_INC -I/tmp/pear/download/ncurses-1.0.2/include -I/tmp/pear/download/ncurses-1.0.2/main -I/tmp/pear/download/ncurses-1.0.2 -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/ncurses-1.0.2/ncurses.c -o ncurses.lo
libtool: compile: cc -I. -I/tmp/pear/download/ncurses-1.0.2 -DPHP_ATOM_INC -I/tmp/pear/download/ncurses-1.0.2/include -I/tmp/pear/download/ncurses-1.0.2/main -I/tmp/pear/download/ncurses-1.0.2 -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/download/ncurses-1.0.2/ncurses.c -fPIC -DPIC -o .libs/ncurses.o
/tmp/pear/download/ncurses-1.0.2/ncurses.c:36:37: error: unknown type name ‘zend_rsrc_list_entry’
static void ncurses_destruct_window(zend_rsrc_list_entry *rsrc TSRMLS_DC)
^
/tmp/pear/download/ncurses-1.0.2/ncurses.c:45:36: error: unknown type name ‘zend_rsrc_list_entry’
static void ncurses_destruct_panel(zend_rsrc_list_entry *rsrc TSRMLS_DC)
^
/tmp/pear/download/ncurses-1.0.2/ncurses.c: In function ‘zm_startup_ncurses’:
/tmp/pear/download/ncurses-1.0.2/ncurses.c:247:57: error: ‘ncurses_destruct_window’ undeclared (first use in this function)
le_ncurses_windows = zend_register_list_destructors_ex(ncurses_destruct_window, NULL, "ncurses_window", module_number);
^
/tmp/pear/download/ncurses-1.0.2/ncurses.c:247:57: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pear/download/ncurses-1.0.2/ncurses.c:249:56: error: ‘ncurses_destruct_panel’ undeclared (first use in this function)
le_ncurses_panels = zend_register_list_destructors_ex(ncurses_destruct_panel, NULL, "ncurses_panel", module_number);
^
Makefile:194: ошибка выполнения рецепта для цели «ncurses.lo»
make: *** [ncurses.lo] Ошибка 1
ошибка выполнения рецепта для цели «ncurses.lo» is like error in process run target
There is a patch which can be applied against v1.0.2 of ncurses for php to modify it for php 7. Once the patch has been applied, the extension can be built and installed.
Required packages (these are Debian package names):
php-cli
php-pear
php-dev
libncurses5-dev
ncurses-doc
libncursesw5-dev
All following commands assume the user is logged in as root. Packaging commands are specific to Debian. These have been tested under Debian Stretch.
apt-get install php-cli php-pear php-dev libncurses5-dev ncurses-doc libncursesw5-dev
Use pecl to get v1.0.2 of ncurses, and wget to get the patch (as ncurses.patch).
cd /root
pecl download ncurses
mkdir /root/ncurses
cd /root/ncurses
tar -xvzf /root/ncurses-1.0.2.tgz
wget "https://bugs.php.net/patch-display.php?bug_id=71299&patch=ncurses-php7-support-again.patch&revision=1474549490&download=1" -O ncurses.patch
Rename the ncurses-1.0.2 directory to ncurses-php5 because that is the name which the patch expects, and apply the patch.
mv ncurses-1.0.2 ncurses-php5
patch --strip=0 --verbose --ignore-whitespace <ncurses.patch
Build the ncurses extension. This will build the ncurses.so file in /root/ncurses/ncurses-php5/modules.
cd ncurses-php5
phpize
./configure
make
Install the ncurses extension. This will place the ncurses.so file in /usr/lib/php/20151012. This location may differ in other distributions.
make install
Make the ncurses.so extension available to php 7. These file locations may differ in other distributions.
cat <<'EndOfHereDoc' >/etc/php/7.0/mods-available/ncurses.ini
; configuration for php ncurses module
; priority=20
extension=ncurses.so
EndOfHereDoc
ln --symbolic /etc/php/7.0/mods-available/ncurses.ini /etc/php/7.0/cli/conf.d/20-ncurses.ini
Verify that ncurses is indeed available.
php -m | grep ncurses
Once everything is working, the /root/ncurses directory, /root/ncurses-1.0.2.tgz file, and /root/channels.xml file can be removed.
I had the same problem and stumbled upon this topic. Soluthions provided here didn't work for me, but I found another solution, whitch is available here: https://github.com/OOPS-ORG-PHP/mod_ncurses
It is patched and ready to compile.
Just sharing with others that will struggle with this as I did.

How to include mruby after installing with rbenv/ruby-build?

I'm trying to compile the "Source Code (.c)" example from this tutorial.
I have installed mruby using rbenv: rbenv install mruby-1.2.0
I get an error when trying to compile the program:
$ gcc -std=c99 -Imruby/include test_program.c -o test_program
test_program.c:1:10: fatal error: 'mruby.h' file not found
#include "mruby.h"
^
1 error generated.
How am I supposed to reference the mruby library when installing via rbenv/ruby-build?
Seems like rbenv install mruby-1.2.0 doesn't install header files of mruby(it's only a dump of build/host directory after mruby is built):
% ls $(rbenv prefix mruby-1.2.0)
LEGAL bin lib mrbgems mrblib src
You need
# get mruby's code
git clone https://github.com/mruby/mruby.git mruby
# build mruby
cd mruby && rake
# go back to directory of `test_program.c`
cd ..
before test_program.c's compilation instead.
And you need mruby/build/host/lib/libmruby.a -lm compile options too.
add -lm
in mruby is /include directory in my source is possible -I mruby_directory/include
next add ~/mruby/build/host/lib/libmruby.a

Install and configure crowd-apache connector on centos 7

1. su -c "yum -y install autoconf automake gcc httpd-devel libcurl-devel libtool libxml2-devel mod_dav_svn subversion-devel"
2. wget http://downloads.atlassian.com/software/crowd/downloads/cwdapache/mod_authnz_crowd-2.2.2.tar.gz
3. tar xzf mod_authnz_crowd-2.2.2.tar.gz
4. cd mod_authnz_crowd-2.2.2
5. autoreconf --install
6. ./configure
7. make
8. su -c "make install"
I am using CentOS 7, Crowd version is 2.9, Apache Http Server version is 2.4.
Above are the steps to install crowd-apache connector in any unix-like system.
There is no issue till the first 4 steps but from the step 5 I get the following errors respectively to the commands.
So my question is:
Is crowd-apache connector compatible to CentOS 7 or any version of CentOS higher than 6.* with Apache version 2.4?
If compatible then what are the steps to accomplish this?
Or how can I get rid of these errors and successfully build crowd-apache connector in CentOS 7
[root#localhost mod_authnz_crowd-2.2.2]# autoreconf --install
libtoolize: putting auxiliary files in .'.
libtoolize: copying file./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, m4'.
libtoolize: copying filem4/libtool.m4'
libtoolize: copying file m4/ltoptions.m4'
libtoolize: copying filem4/ltsugar.m4'
libtoolize: copying file m4/ltversion.m4'
libtoolize: copying filem4/lt~obsolete.m4'
configure.ac:4: installing './config.guess'
configure.ac:4: installing './config.sub'
configure.ac:2: installing './install-sh'
configure.ac:2: installing './missing'
automake: warnings are treated as errors
/usr/share/automake-1.13/am/ltlibrary.am: warning: 'mod_authnz_crowd.la': linking libtool libraries using a non-POSIX
/usr/share/automake-1.13/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
src/Makefile.am:3: while processing Libtool library 'mod_authnz_crowd.la'
src/Makefile.am: installing './depcomp'
src/Makefile.am:8: warning: 'CFLAGS' is a user variable, you should not override it;
src/Makefile.am:8: use 'AM_CFLAGS' instead
parallel-tests: installing './test-driver'
/usr/share/automake-1.13/am/ltlibrary.am: warning: 'mod_authz_svn_crowd.la': linking libtool libraries using a non-POSIX
/usr/share/automake-1.13/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
src/svn/Makefile.am:1: while processing Libtool library 'mod_authz_svn_crowd.la'
src/svn/Makefile.am:6: warning: 'CFLAGS' is a user variable, you should not override it;
src/svn/Makefile.am:6: use 'AM_CFLAGS' instead
autoreconf: automake failed with exit status: 1
[root#localhost mod_authnz_crowd-2.2.2]# ./configure
configure: error: Could not locate Apache apxs binary
[root#localhost mod_authnz_crowd-2.2.2]# make
make: *** No targets specified and no makefile found. Stop.
[root#localhost mod_authnz_crowd-2.2.2]# su -c "make install"
make: *** No rule to make target `install'. Stop.
Apache-Crowd integration with CentOS 7 is not possible right now for the current versions mentioned above.
Apache-Crowd connector (mod_authnz_crowd-2.2.2.tar.gz) is compatible with CentOS 6.* versions.