Ad Widget

Collapse

Building sources from scratch in CentOS 3.7 environment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whyjack
    Junior Member
    • Jun 2006
    • 4

    #1

    Building sources from scratch in CentOS 3.7 environment

    Hi,

    I tried to build rpm files from your stable release of Zabbix 1.1.
    The zabbix.spec file is not good enough to do that without modifications.

    Could you care about the fact that a release should contain all stable files to build it from scratch ?
    It is not the first time I have to do some work to enable a zabbix compilation for a stable release.

    Right now, even if I have successfully modified your zabbix.spec, I have some difficulties to build the Zabbix 1.1 release under CentOS.
    FYI : CentOS is the free version of RedHat Enterprise Linux series. I am using CentOS 3.7 (after upgrade) that should match a RHEL3.7 OS.

    The error I have is the following one :
    make[4]: Leaving directory `/usr/src/redhat/BUILD/zabbix-1.1/src/zabbix_server/trapper'
    make[3]: Leaving directory `/usr/src/redhat/BUILD/zabbix-1.1/src/zabbix_server/trapper'
    make[3]: Entering directory `/usr/src/redhat/BUILD/zabbix-1.1/src/zabbix_server'
    gcc -g -O2 -lresolv -o zabbix_server -L/usr/lib/mysql -L/usr/lib ../libs/zbxsysinfo/libzbxsysinfo.a ../libs/zbxsysinfo/linux/libzbxsysinfo2.a ../libs/zbxlog/libzbxlog.a ../libs/zbxpid/libzbxpid.a ../libs/zbxconf/libzbxconf.a ../libs/zbxcrypto/libzbxcrypto.a ../libs/zbxnet/libzbxnet.a pinger/libzbxpinger.a poller/libzbxpoller.a housekeeper/libzbxhousekeeper.a alerter/libzbxalerter.a timer/libzbxtimer.a trapper/libzbxtrapper.a ../libs/zbxemail/libzbxemail.a ../libs/zbxsms/libzbxsms.a ../libs/zbxdbhigh/libzbxdbhigh.a ../libs/zbxcommon/libzbxcommon.a /usr/lib/libresolv.a -lmysqlclient -lm -lz -lnetsnmp -lcrypto
    /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/../../../crt1.o(.text+0x18): In function `_start':
    : undefined reference to `main'
    collect2: ld returned 1 exit status
    make[3]: *** [zabbix_server] Error 1
    make[3]: Leaving directory `/usr/src/redhat/BUILD/zabbix-1.1/src/zabbix_server'
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory `/usr/src/redhat/BUILD/zabbix-1.1/src/zabbix_server'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/usr/src/redhat/BUILD/zabbix-1.1/src'
    make: *** [all-recursive] Error 1
    error: Bad exit status from /var/tmp/rpm-tmp.93994 (%build)


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


    Could you help me ? I really need the Zabbix 1.1 release to implement monitoring in my enterprise.

    I followed this post to correct the few first bugs :


    Thank you a lot.
    Last edited by whyjack; 16-06-2006, 12:06.
  • whyjack
    Junior Member
    • Jun 2006
    • 4

    #2
    Below you will find a zabbix.spec usable to create rpms files from the sources of zabbix 1.1 stable release (without errors).

    Could someone test it to confirm me it is working fine ?

    ---

    %define apxs /usr/sbin/apxs
    %define apache_datadir %(%{apxs} -q DATADIR)
    %define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)

    Name: zabbix
    Version: 1.1
    Release: 1
    Group: System Environment/Daemons
    License: GPL
    Source: %{name}-%{version}.tar.gz
    BuildRoot: %{_tmppath}/%{name}-root
    BuildPrereq: mysql-client, mysql-devel, net-snmp-devel
    Requires: mysql-client, net-snmp-devel
    Summary: A network monitor.

    %define zabbix_prefix /usr
    %define zabbix_bindir %{zabbix_prefix}/bin
    %define zabbix_libdir %{zabbix_prefix}/lib
    %define zabbix_confdir %{_sysconfdir}/%{name}
    %define zabbix_initdir %{_sysconfdir}/init.d
    %define zabbix_phpfrontend %{zabbix_prefix}/frontends/php

    %description
    zabbix is a network monitor.

    %package agent
    Summary: Zabbix agent
    Group: System Environment/Daemons

    %description agent
    the zabbix network monitor agent.

    %package phpfrontend
    Summary: Zabbix web frontend (php).
    Group: System Environment/Daemons
    Requires: php

    %description phpfrontend
    a php frontend for zabbix.

    %prep
    %setup -q

    %build
    %configure --with-mysql --with-net-snmp --enable-server --enable-agent --enable-static

    #Added CFLAGS="-g -O2" LDFLAGS=-lresolv to resolve compilation problem with static libraries
    make CFLAGS="-g -O2" LDFLAGS=-lresolv

    # adjust in several files /home/zabbix
    #for zabbixfile in misc/conf/* misc/init.d/suse/*/zabbix_agentd src/zabbix_server/{alerter,server}.c; do for zabbixfile in misc/conf/* misc/init.d/suse/*/zabbix_agentd src/zabbix_server/alerter src/zabbix_server/server.c; do
    sed -i -e "s#/home/zabbix/bin#%{zabbix_bindir}#g" \
    -e "s#PidFile=/var/tmp#PidFile=%{_localstatedir}/run#g" \
    -e "s#LogFile=/tmp#LogFile=%{_localstatedir}/log#g" \
    -e "s#/home/zabbix/lock#%{_localstatedir}/lock#g" $zabbixfile done

    # adjust /home/zabbix to /usr/share/doc/packages/ #sed -i -e "s#/home/zabbix#%{_defaultdocdir}#g" create/data/images.sql

    %pre
    if [ -z "`grep zabbix etc/group`" ]; then
    usr/sbin/groupadd zabbix >/dev/null 2>&1 fi if [ -z "`grep zabbix etc/passwd`" ]; then
    usr/sbin/useradd -g zabbix zabbix >/dev/null 2>&1 fi

    %pre agent
    if [ -z "`grep zabbix etc/group`" ]; then
    usr/sbin/groupadd zabbix >/dev/null 2>&1 fi if [ -z "`grep zabbix etc/passwd`" ]; then
    usr/sbin/useradd -g zabbix zabbix >/dev/null 2>&1 fi

    %post agent
    %{fillup_and_insserv -f zabbix_agentd}

    if [ -z "`grep zabbix_agent etc/services`" ]; then
    cat >>etc/services <<EOF
    zabbix_agent 10050/tcp
    EOF
    fi

    if [ -z "`grep zabbix_trap etc/services`" ]; then
    cat >>etc/services <<EOF
    zabbix_trap 10051/tcp
    EOF
    fi

    %postun agent
    %{insserv_cleanup}

    %clean
    rm -fr $RPM_BUILD_ROOT

    %install
    rm -fr $RPM_BUILD_ROOT
    make install DESTDIR=$RPM_BUILD_ROOT
    rm -fr %{buildroot}%{zabbix_libdir}

    # create directory structure
    install -d %{buildroot}%{zabbix_bindir}
    install -d %{buildroot}%{zabbix_confdir} install -d %{buildroot}%{_sysconfdir}/init.d install -d %{buildroot}%{apache_sysconfdir}/conf.d

    # copy binaries
    #install -m 755 bin/zabbix_* %{buildroot}%{zabbix_bindir}

    # copy conf files
    install -m 755 misc/conf/zabbix_*.conf %{buildroot}%{zabbix_confdir}

    # copy frontends
    cp -r frontends %{buildroot}%{zabbix_prefix}

    # apache2 config
    cat >zabbix.conf <<EOF
    Alias /%{name} %{zabbix_phpfrontend}

    <Directory "%{zabbix_phpfrontend}">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
    EOF

    install -m 644 zabbix.conf %{buildroot}%{apache_sysconfdir}/conf.d

    # SuSE Start Scripts
    install -m 755 misc/init.d/suse/9.1/zabbix_* %{buildroot}%{_sysconfdir}/init.d/

    %files
    %defattr(-,root,root)
    %doc AUTHORS COPYING NEWS README INSTALL create upgrades %dir %attr(0755,root,root) %{zabbix_confdir}
    %attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_server.conf
    %attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_trapper.conf
    %config(noreplace) %{zabbix_initdir}/zabbix_suckerd %dir %attr(0755,root,root) %{zabbix_prefix} %dir %attr(0755,root,root) %{zabbix_bindir}
    %attr(0755,root,root) %{zabbix_bindir}/zabbix_server
    %attr(0755,root,root) %{zabbix_bindir}/zabbix_get

    %files agent
    %defattr(-,root,root)
    %dir %attr(0755,root,root) %{zabbix_confdir}
    %attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_agent.conf
    %attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_agentd.conf
    %config(noreplace) %{zabbix_initdir}/zabbix_agentd %dir %attr(0755,root,root) %{zabbix_prefix} %dir %attr(0755,root,root) %{zabbix_bindir}
    %attr(0755,root,root) %{zabbix_bindir}/zabbix_agent
    %attr(0755,root,root) %{zabbix_bindir}/zabbix_agentd
    %attr(0755,root,root) %{zabbix_bindir}/zabbix_sender

    %files phpfrontend
    %defattr(-,root,root)
    %attr(0644,root,root) %config(noreplace) %{apache_sysconfdir}/conf.d/zabbix.conf
    %dir %attr(0755,root,root) %{zabbix_prefix} %dir %attr(0755,root,root) %{zabbix_prefix}/frontends
    %attr(0755,root,root) %{zabbix_phpfrontend}

    %changelog
    * Fri Jan 29 2005 Dirk Datzert <[email protected]>
    - update to 1.1aplha6

    * Tue Jun 01 2003 Alexei Vladishev <[email protected]>
    - update to 1.0beta10

    * Tue Jun 01 2003 Harald Holzer <[email protected]>
    - update to 1.0beta9
    - move phpfrontend config to /etc/zabbix

    * Tue May 23 2003 Harald Holzer <[email protected]>
    - split the php frontend in a extra package

    * Tue May 20 2003 Harald Holzer <[email protected]>
    - 1.0beta8
    - initial packaging

    ---

    Thx

    Comment

    • Eugene
      Member
      • Feb 2006
      • 57

      #3
      What about specs from directory "./misc/specs/"?

      Comment

      • whyjack
        Junior Member
        • Jun 2006
        • 4

        #4
        The problem I have is that the spec file describe a compilation for beta release and suse 9.1 OS instead of redhat.
        Moreover, I need a global spec file to compile all zabbix packages and not spec files describing beta release for each daemon as in the misc directory (zabbix-agentd-1.1beta2.spec zabbix-frontend-1.1beta2.spec zabbix-server-1.1beta2.spec)

        I try to fix all bugs and redirect the compilation to redhat but I am not sure of what I do for everything. It is why I posted my previous spec file.

        Actually, I am not sure if zabbix 1.1 need "zabbix_trapper.conf" file which is copied from sources and packaged by the zabbix.spec file.
        - Is the trapper daemon always in standalone mode or embedded in zabbix_server ?
        - Why don't I found the trapper executable if it is still apart from the zabbix_server binary ?
        - Could you help me on these points ?

        Other problems are related to init.d directory which doesn't include script file to run zabbix_server but zabbix_suckerd.
        Moreover, the zabbix_suckerd is developped for redhat 8.0.

        So, I duplicate zabbix_suckerd script and replace the prog variable string with "zabbix_server".
        Is that a right way to do ?

        A second point in zabbix_suckerd is that the progdir variable is not updated with the spec file at compilation time. I fixed this bug but I need to test my fix.

        Finally, it seem that the spec file produces some error after compilation when I install the rpms.
        I have to investigate further on this point and will do a post when I am sure of me.

        I let you know my conclusions...

        Comment

        • whyjack
          Junior Member
          • Jun 2006
          • 4

          #5
          Nobody has information to help me ???
          Long time, no answer...

          Comment

          Working...