Build rpm mapcache package

Hello

I try to build rpm package with mapcache the newest version
use this mapcache spec file

ame:           mapcache
Version:        1.14.0
Release:        0%{?dist}
Summary:        Caching server for WMS layers
Group:          Development/Tools
License:        MIT
URL:            http://mapserver.org/trunk/en/mapcache/
Source:         mapcache-%{version}.tar.gz
#Obtain source using git archive available at https://github.com/mapserver/mapcache:
#git archive --format=tar --prefix=mapcache-1.2.1/ master | gzip > mapcache-1.2.1.tar.gz
#or adjust archive available at: https://github.com/mapserver/mapcache/archive/master.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires:       webserver

BuildRequires:  httpd-devel fcgi-devel cmake libcurl-devel
BuildRequires:  geos-devel proj-devel gdal-devel libjpeg-turbo-devel
BuildRequires:  libpng-devel libtiff-devel pixman-devel sqlite-devel
BuildRequires:  libmemcached-devel

%description
MapCache is a server that implements tile caching to speed up access to WMS layers. 
The primary objectives are to be fast and easily deployable, while offering the 
essential features (and more!) expected from a tile caching solution.

%prep
%setup -q -n %{name}-%{version}

%build
%cmake -DCMAKE_INSTALL_PREFIX:PATH=%{_bindir} -DCMAKE_INSTALL_LIBDIR=%{_lib} -DWITH_MEMCACHE=1 .
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} \
    install

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc INSTALL README* LICENSE 
%{_bindir}/*

when i run rpmbuild -bb mapcache.spec

i received this error

#!/bin/sh

  RPM_SOURCE_DIR="/root/rpmbuild/SOURCES"
  RPM_BUILD_DIR="/root/rpmbuild/BUILD"
  RPM_OPT_FLAGS="-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection"
  RPM_LD_FLAGS="-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 "
  RPM_ARCH="x86_64"
  RPM_OS="linux"
  RPM_BUILD_NCPUS="4"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS RPM_BUILD_NCPUS RPM_LD_FLAGS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="mapcache"
  RPM_PACKAGE_VERSION="1.14.0"
  RPM_PACKAGE_RELEASE="0.el9"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  LANG=C
  export LANG
  unset CDPATH DISPLAY ||:
  RPM_BUILD_ROOT="/root/rpmbuild/BUILDROOT/mapcache-1.14.0-0.el9.x86_64"
  export RPM_BUILD_ROOT
  
  PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/share/pkgconfig"
  export PKG_CONFIG_PATH
  CONFIG_SITE=${CONFIG_SITE:-NONE}
  export CONFIG_SITE
  
  set -x
  umask 022
  cd "/root/rpmbuild/BUILD"
cd 'mapcache-1.14.0'

  
  CFLAGS="${CFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CFLAGS ; 
  CXXFLAGS="${CXXFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CXXFLAGS ; 
  FFLAGS="${FFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FFLAGS ; 
  FCFLAGS="${FCFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FCFLAGS ; 
  LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 }" ; export LDFLAGS ; 
  LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-/usr/lib64:}" ; export LT_SYS_LIBRARY_PATH ; 
  CC="${CC:-gcc}" ; export CC ; 
  CXX="${CXX:-g++}" ; export CXX 
  /usr/bin/cmake \
        -S "." \
        -B "redhat-linux-build" \
        -DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \
        -DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \
        -DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG" \
        -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
        -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF \
        -DCMAKE_INSTALL_PREFIX:PATH=/usr \
        -DINCLUDE_INSTALL_DIR:PATH=/usr/include \
        -DLIB_INSTALL_DIR:PATH=/usr/lib64 \
        -DSYSCONF_INSTALL_DIR:PATH=/etc \
        -DSHARE_INSTALL_PREFIX:PATH=/usr/share \
        -DLIB_SUFFIX=64 \
        -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr/bin -DCMAKE_INSTALL_LIBDIR=lib64 -DWITH_MEMCACHE=1 .
make -j4




  RPM_EC=$?
  for pid in $(jobs -p); do kill -9 ${pid} || continue; done
  exit ${RPM_EC}

– Build files have been written to: /root/rpmbuild/BUILD/mapcache-1.14.0/redhat-linux-build

  • make -j4
    make: *** No targets specified and no makefile found. Stop.
    error: Bad exit status from /var/tmp/rpm-tmp.eu9ReI (%build)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.eu9ReI (%build)

could you help me resolve this problem, i have no idea what i have done wrong

Some things look a bit wrong.
You appear to be building as root (not good).
You appear to have placed a raw ‘make’ command after using a ‘cmake’ macro, not sure that is correct?
For now, instead of using ‘bb’, try using ‘bc’ (build but don’t install).

Please use the mock command to build it, only this will give an controlled build environment.

rpmbuild -bs …
mock -r …

And rpmlint will also be your friend for verifying the SPEC and final RPM file.

rpmbuild -bc mapcache.spec

– Build files have been written to: /root/rpmbuild/BUILD/mapcache-1.14.0/redhat-linux-build

  • make -j4
    make: *** No targets specified and no makefile found. Stop.
    error: Bad exit status from /var/tmp/rpm-tmp.7Tny3j (%build)
    RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.7Tny3j (%build)

and from mock

  • /usr/bin/cmake -S . -B redhat-linux-build -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr/bin -DCMAKE_INSTALL_LIBDIR=lib64 -DWITH_MEMCACHE=1 .
    CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 2.8.12 will be removed from a future version of
    CMake.
    Update the VERSION argument value or use a … suffix to tell
    CMake that the project does not need compatibility with older versions.
    CMake Error at /usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake:49 (message):
    Could not find compiler set in environment variable CC:
    gcc.
    Call Stack (most recent call first):
    CMakeLists.txt:3 (project)
    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    – Configuring incomplete, errors occurred!
    See also “/builddir/build/BUILD/mapcache-1.14.0/redhat-linux-build/CMakeFiles/CMakeOutput.log”.
    RPM build errors:
    error: Bad exit status from /var/tmp/rpm-tmp.JVhPKQ (%build)
    Bad exit status from /var/tmp/rpm-tmp.JVhPKQ (%build)
    Finish: rpmbuild mapcache-1.14.0-0.el9.src.rpm
    Finish: build phase for mapcache-1.14.0-0.el9.src.rpm
    ERROR: Exception(/root/rpmbuild/SRPMS/mapcache-1.14.0-0.el9.src.rpm) Config(rocky+epel-9-x86_64) 5 minutes 27 seconds
    INFO: Results and/or logs in: /var/lib/mock/rocky+epel-9-x86_64/result
    ERROR: Command failed:

/usr/bin/systemd-nspawn -q -M 3ab2b29b948b4075b5f213f82f010fa2 -D /var/lib/mock/rocky+epel-9-x86_64/root -a -u mockbuild --capability=cap_ipc_lock --bind=/tmp/mock-resolv.69dzforn:/etc/resolv.conf --bind=/dev/mapper/control --bind=/dev/fuse --bind=/dev/loop-control --bind=/dev/loop0 --bind=/dev/loop1 --bind=/dev/loop2 --bind=/dev/loop3 --bind=/dev/loop4 --bind=/dev/loop5 --bind=/dev/loop6 --bind=/dev/loop7 --bind=/dev/loop8 --bind=/dev/loop9 --bind=/dev/loop10 --bind=/dev/loop11 --console=pipe --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin ‘–setenv=PROMPT_COMMAND=printf “\033]0;\007”’ '–setenv=PS1= \s-\v$ ’ --setenv=LANG=C.UTF-8 --resolv-conf=off bash --login -c ‘/usr/bin/rpmbuild -bb --noclean --target x86_64 --nodeps /builddir/build/SPECS/mapcache.spec’

I check spec file by rpmlist

Name: mapcache
Version: 1.14.0
Release: 0%{?dist}
Summary: Caching server for WMS layers
Group: Development/Tools
License: MIT
URL: http://mapserver.org/trunk/en/mapcache/
Source: https://github.com/MapServer/mapcache/releases/download/rel-1-14-0/mapcache-1.14.0.tar.gz

#Obtain source using git archive available at https://github.com/mapserver/mapcache:
#git archive --format=tar --prefix=mapcache-1.2.1/ master | gzip > mapcache-1.2.1.tar.gz
#or adjust archive available at: https://github.com/mapserver/mapcache/archive/master.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: webserver
BuildRequires: httpd-devel fcgi-devel cmake libcurl-devel
BuildRequires: geos-devel proj-devel gdal-devel libjpeg-turbo-devel
BuildRequires: libpng-devel libtiff-devel pixman-devel sqlite-devel
BuildRequires: libmemcached-devel

%description
MapCache is a server that implements tile caching to speed up access to WMS layers.
The primary objectives are to be fast and easily deployable, while offering the
essential features (and more!) expected from a tile caching solution.

%prep
%setup -q -n %{name}-%{version}

%build
%cmake -DCMAKE_INSTALL_PREFIX:PATH=%{_bindir} -DCMAKE_INSTALL_LIBDIR=%{_lib} -DWITH_MEMCACHE=1 .
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot}
install

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc INSTALL README* LICENSE
%{_bindir}/*
%{_libdir}/*

rpmlint -i mapcache.spec
0 packages and 1 specfiles checked; 0 errors, 0 warnings.

but problem still exsist the same

In your spec file you have missing the C/C++ compiler in the build requirements.

Do you think that it will be ok when i add gcc into BuildRequires?

For starting you can read the fedora documentation for packaging.

I have done some changes, could you look and check this?

%global project_owner MapServer
%global project_name mapcache

Name: mapcache
Version: 1.14.0
Release: 0%{?dist}
Summary: Caching server for WMS layers
Group: Development/Tools
%global dashver %(echo %version | sed ‘s|\.|-|g’)

License: MIT
URL: http://mapserver.org/trunk/en/mapcache/

Source: https://github.com/%{project_owner}/%{project_name}/releases/download/rel-%{dashver}/mapcache-%{version}.tar.gz

#Obtain source using git archive available at https://github.com/mapserver/mapcache:
#git archive --format=tar --prefix=mapcache-1.2.1/ master | gzip > mapcache-1.2.1.tar.gz
#or adjust archive available at: https://github.com/mapserver/mapcache/archive/master.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: webserver

BuildRequires: httpd-devel fcgi-devel cmake libcurl-devel gcc
BuildRequires: geos-devel proj-devel gdal-devel libjpeg-turbo-devel
BuildRequires: libpng-devel libtiff-devel pixman-devel sqlite-devel
BuildRequires: libmemcached-devel

%description
MapCache is a server that implements tile caching to speed up access to WMS layers.
The primary objectives are to be fast and easily deployable, while offering the
essential features (and more!) expected from a tile caching solution.

%global debug_package %{nil}

%prep
%setup -q -n %{name}-%{version}

%build
export CFLAGS=“${CFLAGS} -ldl -fPIC -fno-strict-aliasing”
export CXXFLAGS=“%{optflags} -fno-strict-aliasing”

%cmake -DCMAKE_INSTALL_PREFIX:PATH=%{_bindir} -DCMAKE_INSTALL_LIBDIR=%{_lib} -DWITH_MEMCACHE=1 .
#make %{?_smp_mflags}
%cmake_build

%install
#rm -rf %{buildroot}
#make DESTDIR=%{buildroot}
#install
%cmake_install

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
#%doc INSTALL README* LICENSE
%{_bindir}/*
%{_libdir}/*

BuildRoot and debug_package normally never needed, when you use mock.
and setup also deprecated, because it is replaced by autosetup. And why do you override the default compiler flags of the os? On RHEL-9 and newer, %cmake only are ok. You don’t need to set lib and bin dir, because it will be done by the macro. So please read the manual!! The %clean section are also unneeded, because mock will always create an clean build environment.

Hey @ElNinijo - I found this topic so I figured we can continue here.

As discussed, I made some changes to the spec file and have put it up here: rpms/mapcache - mapcache - Gitea: Git with a cup of tea

I’ve also put a copr repo together with the artifacts, so that we can test them out!

https://copr.fedorainfracloud.org/coprs/neil/mapcache/build/7113880/

All you should need to do from a rocky machine is dnf copr enable neil/mapcache, and then use dnf to install mapcache as normal.

Let me know if you can give this a test and see if it works alright :slight_smile:

OK, i am testing this package today after work, and i will write if it is ok or not

It seems that mapcache package builts correctly

Hey @ElNinijo - I’ve put a review in for mod_mapcache here: 2271315 – Review Request: mod_mapcache - Caching server for WMS layers

Can you tell me what’s steps i have to done to put this package into epel

The bit that jumps out at me is
deployable -> deplorable

Yeah those spelling errors can be silly sometimes :slight_smile:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.