Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
2.03k stars 578 forks source link

Issues Packing icinga 2.6.3 tar.gz to RPM #5177

Closed Esteban2812 closed 7 years ago

Esteban2812 commented 7 years ago

General summary

Scenario I'm working on it is a one where I'm no able to run RPMs because I don't have access to root user. So we provide RPMs to a team that have root access and install it without any option, I guess they simple run "rpm -i package.rpm". It is the reason why we want to build RPM from your tar gz. First of our shoot failed which consist to run with the spec is inside the tar.gz file.

Expected Behavior

As I've haven't changed anything in the spec file I expect the RPM files created without errors.

Current Behavior

It is failing during the creation of the RPM file. Giving this error ouput:

-- Found BISON: /usr/bin/bison (Required is at least version "2.3.0") -- Found FLEX: 2.5.35 (Required is at least version "2.5.31") -- MySQL Include dir: /usr/include/mysql library dir: /usr/lib64/mysql -- MySQL client libraries: mysqlclient -- Found PostgreSQL: /usr/lib64/libpq.so -- NOTE: boost::test-based targets and tests cannot be added: boost >= 1.34.0 required but not found. (found: '' want >=103400) BUILD_TESTING disabled, so continuing anyway. CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: Boost_INCLUDE_DIR (ADVANCED) used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/third-party/mmatch used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/third-party/yajl/src used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/third-party/execvpe used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/third-party/socketpair used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/tools/mkclass used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/tools/mkembedconfig used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/tools/mkunity used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/base used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/cli used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/config used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/remote used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/remote used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/icinga used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/methods used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/checker used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/compat used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/db_ido used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/db_ido used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/db_ido_mysql used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/db_ido_pgsql used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/livestatus used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/notification used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/lib/perfdata used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/icinga-app used as include directory in directory /root/rpmbuild/BUILD/icinga2-2.6.3/icinga-app

-- Configuring incomplete, errors occurred! See also "/root/rpmbuild/BUILD/icinga2-2.6.3/CMakeFiles/CMakeOutput.log". See also "/root/rpmbuild/BUILD/icinga2-2.6.3/CMakeFiles/CMakeError.log". error: Bad exit status from /var/tmp/rpm-tmp.2IxdGR (%build)

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

Steps to Reproduce (for bugs)

  1. Creating RPM

cat >/etc/yum.repos.d/devtools-2.repo <<REPO [testing-devtools-2-centos-\$releasever] name=testing 2 devtools for CentOS $releasever baseurl=http://people.centos.org/tru/devtools-2/\$releasever/\$basearch/RPMS gpgcheck=0 REPO

change repo link

https://superuser.com/questions/866420/why-doesnt-the-centos-devtools-repo-work-on-redhat

[testing-devtools-2-centos-$releasever] name=testing 2 devtools for CentOS baseurl=http://people.centos.org/tru/devtools-2/6/$basearch/RPMS gpgcheck=0 End Step 1

  1. Install requirements

            yum -y install libedit-devel
    
            yum -y install ncurses-devel
    
            yum -y install openssl-devel 
    
            yum -y install cmake
    
            yum -y install     boost-devel       
    
            yum -y install mysql-devel
    
            yum -y install postgresql-devel
    
            yum -y install httpd

yum install -y gcc-c++

yum install -y flex

yum install -y bison

yum install -y libstdc++-devel

yum install -y devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils

yum -y install rpmdevtools

yum -y install boost-devel

  1. Creating rpm tree

rpmdev-setuptree

mkdir ~/tar; cd ~/tar; wget https://github.com/Icinga/icinga2/archive/v2.6.3.tar.gz cd ~/tar; tar -xvzf v2.6.3.tar.gz cp ~/tar/icinga2-2.6.3/icinga2.spec ~/rpmbuild/SPECS cp ~/tar/v2.6.3.tar.gz ~/rpmbuild/SOURCES

  1. Configuration

export LD_LIBRARY_PATH=/opt/rh/devtoolset-2/root/usr/lib:$LD_LIBRARY_PATH export PATH=/opt/rh/devtoolset-2/root/usr/bin:$PATH ln -sf /opt/rh/devtoolset-2/root/usr/bin/ld.bfd /opt/rh/devtoolset-2/root/usr/bin/ld for file in find /opt/rh/devtoolset-2/root/usr/include/c++ -name c++config.h; do echo '#define _GLIBCXX__PTHREADS' >> $file done

  1. Building RPM

cd ~/rpmbuild/SPECS rpmbuild -ba icinga2.spec

Context

I'm trying to create RPM file from tar.gz

This is rpmbuild tree: ├── BUILD │ └── icinga2-2.6.3 ├── BUILDROOT ├── RPMS ├── SOURCES │ └── v2.6.3.tar.gz ├── SPECS │ └── icinga2.spec └── SRPMS I'm following this link to create rpm.

Your Environment

lazyfrosch commented 7 years ago

So just to clarify, you are on RHEL6?

dnsmichi commented 7 years ago

Can you please add the entire build log, starting with the call to rpmbuild and everything until the error occurs?

Esteban2812 commented 7 years ago

Sure, logs are enclosed:

Esteban2812 commented 7 years ago

It is run in RedHat distribution.

cat /proc/version Linux version 2.6.32-642.3.1.el6.x86_64 (mockbuild@x86-029.build.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) #1 SMP Sun Jun 26 18:16:44 EDT 2016

dnsmichi commented 7 years ago

Well. The boost headers are not installed and as such cmake fails.

CMake Error at /usr/share/cmake/Modules/FindBoost.cmake:1138 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.
Call Stack (most recent call first):
  CMakeLists.txt:119 (find_package)
lazyfrosch commented 7 years ago

Unfortunately, the actual problem are our build dependencies on newer Boost.

There are two parts in the spec file that cause you problems.

Choice 1 - Use Boost 153 (we ship it in our repo)

This is set here: https://github.com/Icinga/icinga2/blob/e630614c79690cdf5dc1e95e899e40bf869da39e/icinga2.spec#L112

Choice 2 - Fix deps for Boost 143 (EPEL)

We set the actual include path of boost without looking for -Dbuild_icinga_org

https://github.com/Icinga/icinga2/blob/e630614c79690cdf5dc1e95e899e40bf869da39e/icinga2.spec#L296

lazyfrosch commented 7 years ago

We are going to clean up the dependencies, please see #5189