Need a Compiled CFEngine Agent Package on AIX 7 and 6

33 views
Skip to first unread message

Tinu Thomas

unread,
Mar 15, 2022, 2:29:31 AM3/15/22
to help-cfengine
Any one having a compiled agent package for Aix 6,7

Xander Cage

unread,
Mar 15, 2022, 4:13:00 AM3/15/22
to help-cfengine
i am buildding cfengine rpms for years,  this is not rocket science...so just do it

Xander Cage

unread,
Mar 15, 2022, 4:15:31 AM3/15/22
to help-cfengine
root@nimvie: /root # oslevel -s
7300-00-01-2148

root@nimvie: /root # rpm -qi cfengine
Name        : cfengine
Version     : 3.18.1
Release     : itsv
Architecture: ppc
Install Date: Fri Feb  4 08:31:02 CET 2022
Group       : Applications/System
Size        : 10363182
License     : GPLv2+
Signature   : (none)
Source RPM  : cfengine-3.18.1-itsv.src.rpm
Build Date  : Fri Feb  4 08:18:36 CET 2022
Build Host  : aixbuildhostng
URL         : http://www.cfengine.org/
Summary     : A systems administration tool for networks
Description :
Cfengine, or the configuration engine is an agent/software robot and a
very high level language for building expert systems to administrate
and configure large computer networks. Cfengine uses the idea of
classes and a primitive form of intelligence to define and automate
the configuration and maintenance of system state, for small to huge
configurations. Cfengine is designed to be a part of a computer immune
system.

Tinu T Thomas

unread,
Mar 22, 2022, 10:53:16 AM3/22/22
to help-cfengine
Hi, 


I understand, I started compiling CFEngine on AIX box. Now I am getting lmdb error. Is thereany RPM available for lmdb.

Tinu T Thomas

unread,
Mar 23, 2022, 5:47:38 AM3/23/22
to help-cfengine
Can I get the output of rpm -qa from the sever?

On Tuesday, March 15, 2022 at 1:45:31 PM UTC+5:30 Xander Cage wrote:

Xander Cage

unread,
Mar 24, 2022, 9:58:22 AM3/24/22
to help-cfengine
there is no lmdb package for aix, you need to do it yourself also.

Xander Cage

unread,
Mar 24, 2022, 10:01:53 AM3/24/22
to help-cfengine
my spec file for lmdb, if this is of any help...

root@aixbuildhostng: /home/packagebuilder/rpmbuild/SPECS # cat liblmdb-0.9.29-1.spec
Name:           liblmdb
Version:        0.9.29
Release:        1
Summary:        Lightning memory-mapped database library
License:        OpenLDAP Public License
Group:          Development/Libraries/C and C++
Url:            http://symas.com/mdb


#Git-Clone:     git://git.openldap.org/openldap mdb.master
Source0:         https://github.com/LMDB/lmdb/archive/LMDB_%version.tar.gz

BuildRoot:      %{_tmppath}/%name-%version-%release-build


Provides: liblmdb.a(liblmdb.so)
Provides: liblmdb.so

%define _libdir64 %{_prefix}/lib64

%description
The OpenLDAP's Lightning Memory-Mapped Database (LMDB)
LMDB is an ultra-fast, ultra-compact key-value data store developed by Symas for
the OpenLDAP Project. It uses memory-mapped files, so it has the read performance
of a pure in-memory database while still offering the persistence of standard
disk-based databases, and is only limited to the size of the virtual address space,
(it is not limited to the size of physical RAM).

The library is available as 32-bit and 64-bit.

%package -n %name-%version
Summary:        Shared library for Lightning Memory-Mapped Database (LMDB)
Group:          System/Libraries

%description -n %name-%version
LMDB is a Btree-based database management library with an API similar
to BerkeleyDB. The library is thread-aware and supports concurrent
read/write access from multiple processes and threads. The DB
structure is multi-versioned, and data pages use a copy-on-write
strategy, which also provides resistance to corruption and eliminates
the need for any recovery procedures. The database is exposed in a
memory map, requiring no page cache layer of its own.


%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries
Requires:       %name = %version
Provides:       liblmdb.so

%description devel
The %name-devel package contains header files for developing
applications that use %name.


%prep
%setup -qn lmdb-LMDB_%version
cd libraries/liblmdb
mkdir ../32bit
mv * ../32bit
mv ../32bit .
mkdir 64bit
cd 32bit && tar cf - . | (cd ../64bit ; tar xpf -)

%build
export CONFIG_SHELL=/usr/bin/ksh
export CONFIG_ENV_ARGS=/usr/bin/ksh

export CFLAGS="-DSYSV -D_AIX -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include -DMDB_USE_ROBUST=0 -Wl,-lpthread -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib"
export CXXFLAGS="${CFLAGS}"



cd libraries/liblmdb/64bit
# first build the 64-bit version
export OBJECT_MODE=64
export AR="/usr/bin/ar -X64"
export RANLIB="/usr/bin/ranlib -X64"
export NM="/usr/bin/nm -X64"
export CC="gcc -maix64"
export CXX="g++ -maix64"
export LD="/usr/bin/ld -b64"

/opt/freeware/bin/sed -i 's?libdir = $(exec_prefix)/lib?libdir = $(exec_prefix)/lib64?' Makefile

gmake %{?_smp_mflags} CC="${CC}" CXX="${CXX}" CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" LD="${LD}"  AR="${AR}" RANLIB="${RANLIB}" NM="${NM}"
rm liblmdb.a
$AR -q liblmdb.a liblmdb.so*

cd ../32bit
# now build the 32-bit version
export OBJECT_MODE=32
export AR="/usr/bin/ar -X32"
export RANLIB="/usr/bin/ranlib -X32"
export NM="/usr/bin/nm -X32"
export CC="gcc -maix32"
export CXX="g++ -maix32"
export LD="/usr/bin/ld -b32"

gmake %{?_smp_mflags} CC="${CC}" CXX="${CXX}" CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" LD="${LD}"  AR="${AR}" RANLIB="${RANLIB}" NM="${NM}"
rm liblmdb.a
$AR -q liblmdb.a liblmdb.so*

%install
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}

cd libraries/liblmdb/64bit
export OBJECT_MODE=64
export AR="/usr/bin/ar -X64"
export RANLIB="/usr/bin/ranlib -X64"
export NM="/usr/bin/nm -X64"
export CC="gcc -maix64"
export CXX="g++ -maix64"
export LD="/usr/bin/ld -b64"

gmake install DESTDIR=${RPM_BUILD_ROOT} CC="${CC}" CXX="${CXX}" CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" LD="${LD}"  AR="${AR}" RANLIB="${RANLIB}" NM="${NM}" \
      prefix=%{_prefix}

(
  cd ${RPM_BUILD_ROOT}%{_bindir}
  for f in * ; do
    mv -f ${f} ${f}_64
  done
)

cd ../32bit
export OBJECT_MODE=32
export AR="/usr/bin/ar -X32"
export RANLIB="/usr/bin/ranlib -X32"
export NM="/usr/bin/nm -X32"
export CC="gcc -maix32"
export CXX="g++ -maix32"
export LD="/usr/bin/ld -b32"

gmake install DESTDIR=${RPM_BUILD_ROOT} CC="${CC}" CXX="${CXX}" CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" LD="${LD}"  AR="${AR}" RANLIB="${RANLIB}" NM="${NM}" \
      prefix=%{_prefix}

(
  cd ${RPM_BUILD_ROOT}%{_libdir64}
  for f in *.a ; do
    /usr/bin/ar -X64 -x ${f}
  done

  cd ${RPM_BUILD_ROOT}%{_libdir}
  for f in *.a ; do
    /usr/bin/ar -X32 -x ${f}
  done
)

# add the 64-bit shared objects to the shared libraries containing already the
# 32-bit shared objects
/usr/bin/ar -X64 -q ${RPM_BUILD_ROOT}%{_libdir}/liblmdb.a ${RPM_BUILD_ROOT}%{_libdir64}/liblmdb.so*


%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,system,-)
%doc libraries/liblmdb/64bit/CHANGES
%doc libraries/liblmdb/64bit/COPYRIGHT
%doc libraries/liblmdb/64bit/LICENSE
%_libdir/*.a
%_libdir/*.so*
%_libdir64/*.so*
%_libdir64/*a*


%files devel
%defattr(-,root,system,-)
%_includedir/*


%changelog

Xander Cage

unread,
Mar 24, 2022, 10:05:20 AM3/24/22
to help-cfengine
spec file for my cfengine builds...

root@aixbuildhostng: /home/packagebuilder/rpmbuild/SPECS # cat cfengine-3.18.1-itsv.spec

Summary: A systems administration tool for networks
Name: cfengine
Version: 3.18.1
Release: itsv
License: GPLv2+
Group: Applications/System
Source0: https://cfengine-package-repos.s3.amazonaws.com/tarballs/%{name}-%{version}.tar.gz
Source1: cfengine_startup.sh
Source2: cfengine3-vendor-init-script
URL: http://www.cfengine.org/
# recent versions of rpm wont honour setting custom BuildRoot.
#BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires: AIX-rpm >= 5.2.0.0
BuildRequires: bison, flex, m4, make, gcc
BuildRequires: curl-devel >= 7.75.0-1
BuildRequires: pcre-devel >= 8.44-1
BuildRequires: libxml2-devel >= 2.9.10-1
BuildRequires: liblmdb-devel >= 0.9.29-1
BuildRequires: openldap-devel >= 2.4.58-1
BuildRequires: libyaml-devel >= 0.2.2-1
BuildRequires: libssh2-devel
BuildRequires: cyrus-sasl-devel
BuildRequires: xz-devel

Requires: AIX-rpm >= 5.2.0.0
Requires: libgcc
Requires: libstdc++
Requires: curl >= 7.75.0-1
Requires: pcre >= 8.44-1
Requires: libxml2 >= 2.9.10-1
Requires: liblmdb >= 0.9.29-1
Requires: libyaml >= 0.2.2-1
Requires: openldap >= 2.4.58-1
Requires: xz-libs
Requires: libssh2
Requires: cyrus-sasl
Conflicts: cfengine < %{version}

%description

Cfengine, or the configuration engine is an agent/software robot and a
very high level language for building expert systems to administrate
and configure large computer networks. Cfengine uses the idea of
classes and a primitive form of intelligence to define and automate
the configuration and maintenance of system state, for small to huge
configurations. Cfengine is designed to be a part of a computer immune
system.


%prep
%setup -q


%build
export CONFIG_SHELL=/usr/bin/ksh
export CONFIG_ENV_ARGS=/usr/bin/ksh

export OBJECT_MODE=64
export AR="/usr/bin/ar -X64"
export RANLIB="/usr/bin/ranlib -X64"
export NM="/usr/bin/nm -X64"
export YACC="/opt/freeware/bin/yacc_64"

export LT_SYS_LIBRARY_PATH="/var/cfengine/lib:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib"


export CC="gcc -maix64"
export CXX="g++ -maix64"
export CFLAGS="-DSYSV -D_AIX -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include"
export CXXFLAGS=$CFLAGS
export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/var/cfengine/lib:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib"


./configure \
             --prefix=/var/cfengine \
             --sbindir=/var/cfengine/bin \
             --localstatedir=/var/cfengine \
             --with-workdir=/var/cfengine \
             --without-postgresql \
             --without-mysql \
             --with-openssl=/usr/lib \
             --with-lmdb=/opt/freeware \
             --with-pcre=/opt/freeware \
             --with-libcurl=/opt/freeware \
             --with-libyaml=/opt/freeware \
             --with-libxml2=/opt/freeware

# fix runtime linking, long live fucking LIBTOOL
/opt/freeware/bin/sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool

gmake %{?_smp_mflags}


%install

[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
gmake install DESTDIR=${RPM_BUILD_ROOT}

/usr/bin/strip -X64 ${RPM_BUILD_ROOT}/var/cfengine/bin/* || :

rm -rf ${RPM_BUILD_ROOT}/var/cfengine/share

cp %{SOURCE1} ${RPM_BUILD_ROOT}/var/cfengine/bin/startup.sh

mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/init.d

cp %{SOURCE2} ${RPM_BUILD_ROOT}/etc/rc.d/init.d/cfengine3


%post
/usr/sbin/rmitab cfengine || :
/usr/sbin/mkitab "cfengine:2:once:/var/cfengine/bin/startup.sh start > /dev/console 2>&1" || :

if [ $1 -lt 2 ]; then
        /var/cfengine/bin/cf-key >/dev/null || :
        chmod 700 /var/cfengine/ppkeys
fi
/var/cfengine/bin/startup.sh restart


%postun
if [ $1 -eq 0 ]; then
# clean up  on removal, but not on policy server
[ ! -e /var/cfengine/state/am_policy_hub ] && rm -rf /var/cfengine/*
/usr/sbin/rmitab cfengine || :

for line in `ps -ef | grep '/var/cfengine/bin/cf[-]' | awk '{print $2}'`; do
            kill $line
        done
fi


%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,system,-)
/var/cfengine/bin/*
/var/cfengine/inputs
/var/cfengine/lib/*
/var/cfengine/modules
/var/cfengine/outputs
/var/cfengine/plugins
/var/cfengine/ppkeys
%attr(755,root,system) /etc/rc.d/init.d/cfengine3




%changelog

Nick Anderson

unread,
Mar 25, 2022, 10:13:20 AM3/25/22
to Tinu Thomas, help-c...@googlegroups.com

Tinu T Thomas

unread,
Mar 28, 2022, 3:05:27 AM3/28/22
to help-cfengine
@Xender Cage

Try to do rpm build but getting below error. Any idea about this error?
AIX OS Version : 7.2.00

ld: 0711-317 ERROR: Undefined symbol: .mdb_env_create

ld: 0711-317 ERROR: Undefined symbol: .mdb_env_set_maxdbs

ld: 0711-317 ERROR: Undefined symbol: .mdb_env_open

ld: 0711-317 ERROR: Undefined symbol: .mdb_reader_list

ld: 0711-317 ERROR: Undefined symbol: .mdb_reader_check

ld: 0711-317 ERROR: Undefined symbol: .mdb_env_close

ld: 0711-317 ERROR: Undefined symbol: .mdb_txn_begin

ld: 0711-317 ERROR: Undefined symbol: .mdb_cursor_open

ld: 0711-317 ERROR: Undefined symbol: .mdb_stat

ld: 0711-317 ERROR: Undefined symbol: .mdb_cursor_get

ld: 0711-317 ERROR: Undefined symbol: .mdb_cursor_close

ld: 0711-317 ERROR: Undefined symbol: .mdb_dbi_open

ld: 0711-317 ERROR: Undefined symbol: .mdb_dbi_close

ld: 0711-317 ERROR: Undefined symbol: .mdb_txn_abort

ld: 0711-317 ERROR: Undefined symbol: .mdb_strerror

ld: 0711-317 ERROR: Undefined symbol: .mdb_env_stat

ld: 0711-317 ERROR: Undefined symbol: .mdb_env_info


@Nick, I would like to compile CFEngine from Source for AIX. I am trying to make it.

Xander Cage

unread,
Mar 28, 2022, 3:24:08 AM3/28/22
to help-cfengine
these linker error are useally coming up if required symbols are not found. are you shure lmdb  + devel package is installed and if installed built correctly beforehand?
Reply all
Reply to author
Forward
0 new messages