Skip to content

Adapt to builds with Slackware 15 #2143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 2, 2023

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Nov 1, 2023

Started as scripts/Windows/Makefile.am: limit binary builds to cases where we HAVE_WINDOWS and as such -

Closes: #2142

@jimklimov jimklimov added packaging Windows Linux Some issues are specific to Linux as a platform portability We want NUT to build and run everywhere possible impacts-release-2.8.1 Issues reported against NUT release 2.8.1 (maybe vanilla or with minor packaging tweaks) labels Nov 1, 2023
@jimklimov jimklimov added this to the 2.8.2 milestone Nov 1, 2023
…VE_WINDOWS [networkupstools#2142]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov changed the title scripts/Windows/Makefile.am: limin binary builds to cases where we HAVE_WINDOWS scripts/Windows/Makefile.am: limit binary builds to cases where we HAVE_WINDOWS Nov 1, 2023
@desertwitch
Copy link
Contributor

desertwitch commented Nov 1, 2023

Not sure if this still is in progress (and I'm too fast) but - in present state - not sure if this will suffice.

nut/configure.ac

Lines 2780 to 2789 in 2856cac

AC_CHECK_TOOL([WINDMC], [windmc], [none])
AC_CHECK_TOOL([WINDRES], [windres], [none])
if test "x$WINDMC" != "xnone" -a "x$WINDRES" != "xnone" ; then
nut_have_mingw_resgen="yes"
fi
AM_CONDITIONAL([HAVE_MINGW_RESGEN], [test "${nut_have_mingw_resgen}" = "yes"])
dnl Also define a generic AM_CONDITIONAL for general Windows compilation
AM_CONDITIONAL([HAVE_WINDOWS], [test "${nut_have_mingw_resgen}" = "yes"])

HAVE_WINDOWS seems to just be conditional on windres + windmc existing on the system (at present).
Might be worth adding a check for header file(s) such as windows.h to determination of HAVE_WINDOWS.

@desertwitch
Copy link
Contributor

On another note - should it even consider building for Windows when we don't specifically request it as a build target?

@teoberi
Copy link

teoberi commented Nov 1, 2023

That's what I looked for the first time, how you can disable building for Windows.

@jimklimov
Copy link
Member Author

Argh, right. Missed that while commuting, phone screen is just that large... :\

@jimklimov
Copy link
Member Author

Curiously - note how no other system complains, still...

@teoberi
Copy link

teoberi commented Nov 1, 2023

Curiously - note how no other system complains, still...

That's what Slackware64-current does, it quickly implements new releases, that's why I use it and it ends up creating addiction, it's hard for me to use anything else. It also creates problems now with NUT, but also other applications, for example Clamav, which has problems with the new versions of other included software.
https://distrowatch.com/table-mobile.php?distribution=slackware

… build environment

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@desertwitch
Copy link
Contributor

desertwitch commented Nov 1, 2023

Curiously - note how no other system complains, still...

That's what Slackware64-current does, it quickly implements new releases, that's why I use it and it ends up creating addiction, it's hard for me to use anything else. It also creates problems now with NUT, but also other applications, for example Clamav, which has problems with the new versions of other included software.

https://distrowatch.com/table-mobile.php?distribution=slackware

Well in all fairness to Slackware, I think their only "fault" there was not stripping the Windows binaries from GNU Binutils as probably most other distributions would do when not also shipping out MinGW. It's a "problem" with 15.0 and older versions respectively as well, but it's true Slackware does like to package as much software as possible into their distribution.

@jimklimov
Copy link
Member Author

Bumped this PR with a "reference" docs update on how I set up the Slackware environment for local tests (and it does complain about windows.h with current code).

So far one lacking bit is a modern Java which could let this VM become part of NUT CI farm. Maybe that would start with the older Java 8 and some (older?) remote or swarm plugin, but not sure OTOH.

@desertwitch
Copy link
Contributor

desertwitch commented Nov 1, 2023

For what it's worth, I use JDK11 from here: http://www.slackware.com/~alien/slackbuilds/openjdk11/pkg64/

You'd download the respective txz package and install it via 'installpkg'.

P.S. I personally also consider Sotirov's SlackPack a reputable repository: https://sotirov-bg.net/slackpack/
Which should cover most if not all of the dependencies required for NUT building (including powerman, ipmi etc.)

… build environment - clarify Alien Slack Builds

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ed header files

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…required tools and headers are in place

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
Copy link
Member Author

Well, at least now ./ci_build.sh passed without further magic :)

@desertwitch
Copy link
Contributor

Building this without any troubles now (via autogen.sh) despite windres + windmc present on Slackware 15.0 and 15.1.
Thanks for the quick fix, Jim, hope diving into Slackware didn't ruin your evening there. 😆

@jimklimov
Copy link
Member Author

Good to hear, thanks for the feedback.

Well, it was... interesting. But now I've got so many curious OSes in the zoo here, what's another?.. :)

@jimklimov
Copy link
Member Author

jimklimov commented Nov 1, 2023

So, with a patchwork from several package repos (still missing a few bits like GPIO and I2C) the ./ci_build.sh passes and collects the following config:

NUT Configuration summary:

  • configured version: 2.8.1.1 (v2.8.1-8-g0b2973f10)
  • build serial drivers: yes
  • build USB drivers: yes (libusb-1.0)
  • build neon based XML driver: yes
  • enable Avahi support: yes
  • build Powerman PDU client driver: yes
  • build Modbus driver: yes
  • build IPMI driver: yes (FreeIPMI)
  • build GPIO driver: no
  • build Mac OS X meta-driver: no
  • build i2c based drivers: no
  • enable SSL support: yes (OpenSSL)
  • enable libwrap (tcp-wrappers) support: yes
  • enable libltdl (Libtool dlopen abstraction) support: yes
  • build nut-scanner: yes
  • build CGI programs: yes
  • install NUT-Monitor desktop application: yes
  • install PyNUT binding module: yes
  • use default Python interpreter: /usr/bin/python
  • use specific Python2 interpreter: /usr/bin/python2.7
  • use specific Python3 interpreter: /usr/bin/python3
  • build and install documentation: skip
  • build specific documentation format(s): no
  • build and install the development files: yes
  • consider basic SMF support: no
  • consider basic systemd support: no
  • build with tighter systemd support: no
  • build C++11 codebase (client library, etc.): yes
  • build C++ tests with CPPUNIT: yes
  • build SNMP drivers: yes
  • build SNMP drivers with statically linked lib(net)snmp: no
  • User to run as: nobody
  • Group of user to run as: nobody

NUT Paths:

  • Default installation prefix path: /usr/local/ups
  • State file path: /var/state/ups
  • Unprivileged PID file path: /var/state/ups
  • Privileged PID file path: /run
  • Driver program path: /usr/local/ups/bin
  • CGI program path: /usr/local/ups/cgi-bin
  • HTML file path: /usr/local/ups/html
  • Config file path: /usr/local/ups/etc
  • Data file path: /usr/local/ups/share
  • Tool program path: /usr/local/ups/bin
  • System program path: /usr/local/ups/sbin
  • System library path: /usr/local/ups/lib
  • System exec-library path: /usr/local/ups/libexec

NUT Paths for third-party integrations:

  • Default Python interpreter site-packages: /usr/lib64/python2.7/site-packages
  • Specific Python2 interpreter site-packages: /usr/lib64/python2.7/site-packages
  • Specific Python3 interpreter site-packages: /usr/lib64/python3.9/site-packages
  • pkg-config *.pc directory: ${libdir}/pkgconfig => /usr/local/ups/lib/pkgconfig
  • Udev rules directory: /lib/udev

NUT Build/Target system info:

  • Compact version of C compiler: gcc (GCC) 11.2.0
  • Compact version of C++ compiler: g++ (GCC) 11.2.0
  • Compact version of C preprocessor: gcc (GCC) 11.2.0
  • host env spec we run on: x86_64-pc-linux-gnu
  • host env spec we built on: x86_64-pc-linux-gnu
  • host env spec we built for: x86_64-pc-linux-gnu
  • host OS short spec we run on: x86_64-linux-gnu
  • host OS short spec we built on: x86_64-linux-gnu
  • host OS short spec we built for: x86_64-linux-gnu

NUT Compiler settings:

  • CC : gcc
  • CFLAGS : -isystem /usr/local/include -g -O2 -Wno-reserved-identifier -fdiagnostics-color=always -Wno-unknown-warning-option -std=gnu99 -Wno-system-headers -Wall -Wextra -Wsign-compare -pedantic -Werror
  • CXX : g++
  • CXXFLAGS : -isystem /usr/local/include -g -O2 -Wno-reserved-identifier -fdiagnostics-color=always -Wno-unknown-warning-option -std=gnu++11 -Wno-system-headers -Wall -Wextra -Werror
  • CPP : gcc -E
  • CPPFLAGS :
  • CONFIG_FLAGS : --enable-Wcolor --enable-warnings --enable-Werror --enable-keep_nut_report_feature --with-all=auto --with-cgi=auto --with-serial=auto --with-dev=auto --with-doc=skip --with-nut_monitor=auto --with-pynut=auto --disable-force-nut-version-header --enable-check-NIT --enable-maintainer-mode --disable-silent-rules

@desertwitch
Copy link
Contributor

desertwitch commented Nov 1, 2023

Looking good, one thing to note:

--build=x86_64-slackware-linux

Essentially all build recipes are built like that on Slackware:

--build=$ARCH-slackware-linux

Never got i2c or GPIO working myself either.

@jimklimov
Copy link
Member Author

jimklimov commented Nov 1, 2023

Do you mean that's something worth providing as the configure argument? Don't see anything to that effect auto-detected, and ci_build.sh does not force that either. Probably automake/autoconf site config (/etc/something) would have provided that if it mattered?..

@jimklimov
Copy link
Member Author

jimklimov commented Nov 1, 2023

Ach jo, portability and legacy compatibility - bit us here (on another old CI system):

[2023-11-01T22:21:38.254Z] main::scan_file() called too early to check prototype at /usr/local/bin/aclocal-1.10 line 617.
[2023-11-01T22:21:38.943Z] configure.ac:2792: warning: macro `AM_COND_IF' not found in library
[2023-11-01T22:21:39.634Z] autoreconf-2.64: running: /usr/local/bin/autoconf-2.64
[2023-11-01T22:21:41.073Z] configure.ac:706: error: possibly undefined macro: AM_CONDITIONAL
[2023-11-01T22:21:41.073Z]       If this token and others are legitimate, please use m4_pattern_allow.
[2023-11-01T22:21:41.073Z]       See the Autoconf documentation.
[2023-11-01T22:21:41.073Z] configure.ac:2792: error: possibly undefined macro: AM_COND_IF
[2023-11-01T22:21:41.073Z] autoreconf-2.64: /usr/local/bin/autoconf-2.64 failed with exit status: 1
[2023-11-01T22:21:41.073Z] FAILED: did not generate an executable configure script!

@jimklimov
Copy link
Member Author

jimklimov commented Nov 2, 2023

So as long as I'm CI-testing and not packaging "cleanly", it should not matter? Or can there be some practical differences (different set of compiler default settings etc.) so that a build passing for CI with auto-guessed defaults (or common ones from ci_build.sh) might not be packageable on the same box?

@jimklimov jimklimov marked this pull request as draft November 2, 2023 00:05
@jimklimov jimklimov marked this pull request as ready for review November 2, 2023 00:05
@desertwitch
Copy link
Contributor

desertwitch commented Nov 2, 2023

So as long as I'm CI-testing and not packaging "cleanly", it should not matter? Or can there be some practical differences (different set of compiler default settings etc.) so that a build passing for CI with auto-guessed defaults (or common ones from ci_build.sh) might not be packageable on the same box?

The latter, it's the buildtype most users (and not just packagers, since Slackware is more self-building driven than some other distributions) on Slackware would likely build for and hence a defaults-passed CI might not necessarily mean it must also build/pass cleanly with the specific Slackware buildtype - I'd see it as a distro-specific precaution worth passing (if easily possible).

Another older example (for self building):
https://slackbuilds.org/slackbuilds/14.2/system/nut/nut.SlackBuild

But I'm not an expert when it comes to CI, so that's just my view as user/packager on Slackware - and with that I must say good night for now. ;-)

@jimklimov
Copy link
Member Author

Ok, thanks for clarifications. Bastardized that script a bit locally to configure similarly, but it still passes :D

#!/bin/sh

# based on https://slackbuilds.org/slackbuilds/14.2/system/nut/nut.SlackBuild

PRGNAM=nut
VERSION=${VERSION:-2.8.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

PATH="/usr/lib/ccache:$PATH"
export PATH

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i486 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc/$PRGNAM \
  --localstatedir=/var \
  --datadir=/usr/share/nut \
  --mandir=/usr/man \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --build=$ARCH-slackware-linux \
  --enable-strip \
  --disable-static \
  --with-dev \
  --with-serial \
  --with-usb \
  --with-snmp \
  --with-neon \
  --with-wrap \
  --with-cgi\
  --with-cgipath=/var/www/cgi-bin/nut \
  --with-htmlpath=/var/www/htdocs/ups \
  --with-drvpath=/usr/libexec/nut \
  --with-statepath=/var/run/nut \
  --with-pidpath=/var/run/nut \
  --with-altpidpath=/var/run/nut
make -j 20

NUT Configuration summary:

  • configured version: 2.8.1.1 (v2.8.1-9-g818615cee)
  • build serial drivers: yes
  • build USB drivers: yes (libusb-1.0)
  • build neon based XML driver: yes
  • enable Avahi support: yes
  • build Powerman PDU client driver: yes
  • build Modbus driver: yes
  • build IPMI driver: yes (FreeIPMI)
  • build GPIO driver: no
  • build Mac OS X meta-driver: no
  • build i2c based drivers: no
  • enable SSL support: yes (OpenSSL)
  • enable libwrap (tcp-wrappers) support: yes
  • enable libltdl (Libtool dlopen abstraction) support: yes
  • build nut-scanner: yes
  • build CGI programs: yes
  • install NUT-Monitor desktop application: yes
  • install PyNUT binding module: yes
  • use default Python interpreter: /usr/bin/python
  • use specific Python2 interpreter: /usr/bin/python2.7
  • use specific Python3 interpreter: /usr/bin/python3
  • build and install documentation: man=auto
  • build specific documentation format(s): no
  • build and install the development files: yes
  • consider basic SMF support: no
  • consider basic systemd support: no
  • build with tighter systemd support: no
  • build C++11 codebase (client library, etc.): yes
  • build C++ tests with CPPUNIT: yes
  • build SNMP drivers: yes
  • build SNMP drivers with statically linked lib(net)snmp: no
  • User to run as: nobody
  • Group of user to run as: nobody

NUT Paths:

  • Default installation prefix path: /usr
  • State file path: /var/run/nut
  • Unprivileged PID file path: /var/run/nut
  • Privileged PID file path: /var/run/nut
  • Driver program path: /usr/libexec/nut
  • CGI program path: /var/www/cgi-bin/nut
  • HTML file path: /var/www/htdocs/ups
  • Config file path: /etc/nut
  • Data file path: /usr/share/nut
  • Tool program path: /usr/bin
  • System program path: /usr/sbin
  • System library path: /usr/lib64
  • System exec-library path: /usr/libexec

NUT Paths for third-party integrations:

  • Default Python interpreter site-packages: /usr/lib64/python2.7/site-packages
  • Specific Python2 interpreter site-packages: /usr/lib64/python2.7/site-packages
  • Specific Python3 interpreter site-packages: /usr/lib64/python3.9/site-packages
  • pkg-config *.pc directory: ${libdir}/pkgconfig => /usr/lib64/pkgconfig
  • Udev rules directory: /lib/udev

NUT Build/Target system info:

  • Compact version of C compiler: gcc (GCC) 11.2.0
  • Compact version of C++ compiler: g++ (GCC) 11.2.0
  • Compact version of C preprocessor: gcc (GCC) 11.2.0
  • host env spec we run on: x86_64-slackware-linux-gnu
  • host env spec we built on: x86_64-slackware-linux
  • host env spec we built for: x86_64-slackware-linux-gnu
  • host OS short spec we run on: x86_64-linux-gnu
  • host OS short spec we built on: x86_64-linux-gnu
  • host OS short spec we built for: x86_64-linux-gnu

NUT Compiler settings:

  • CC : gcc
  • CFLAGS : -isystem /usr/local/include -O2 -fPIC -Wno-reserved-identifier -Wno-unknown-warning-option -std=gnu99 -s -Wno-system-headers -Wall -Wextra -Wsign-compare -pedantic -Wno-error
  • CXX : g++
  • CXXFLAGS : -isystem /usr/local/include -O2 -fPIC -Wno-reserved-identifier -Wno-unknown-warning-option -std=gnu++11 -Wno-system-headers -Wall -Wextra -Wno-error
  • CPP : gcc -E
  • CPPFLAGS :
  • CONFIG_FLAGS : --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc/nut --localstatedir=/var --datadir=/usr/share/nut --mandir=/usr/man --docdir=/usr/doc/nut-2.8.1 --build=x86_64-slackware-linux --enable-strip --disable-static --with-dev --with-serial --with-usb --with-snmp --with-neon --with-wrap --with-cgi --with-cgipath=/var/www/cgi-bin/nut --with-htmlpath=/var/www/htdocs/ups --with-drvpath=/usr/libexec/nut --with-statepath=/var/run/nut --with-pidpath=/var/run/nut --with-altpidpath=/var/run/nut

Hit one more snag though:

Making all in include
make[1]: Entering directory '/home/abuild/nut/include'
NUT_VERSION: "2.8.1-9-g818615cee"
test -f "nut_version.h" || cp "nut_version.h.tmp" "nut_version.h"
cmp -s "nut_version.h.tmp" "nut_version.h" || cp "nut_version.h.tmp" "nut_version.h"
/bin/sh: line 1: cmp: command not found
rm -f "nut_version.h.tmp"
make  all-am
...

Missed diffutils...

…seline (not in default install)

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
… ASCIIDOC_MIN_VERSION [networkupstools#2142]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
Copy link
Member Author

Oh... there is an asciidoc and a2x, but surprisingly aged, with differing version numbers, and pickier to man page standards :)

@jimklimov jimklimov changed the title scripts/Windows/Makefile.am: limit binary builds to cases where we HAVE_WINDOWS Adapt to builds with Slackware 15 Nov 2, 2023
@jimklimov jimklimov added documentation CI Entries related to continuous integration infrastructure (here CI = tools + scripts + recipes) labels Nov 2, 2023
@jimklimov
Copy link
Member Author

jimklimov commented Nov 2, 2023

Eh, github lags today... "Checking for ability to merge automatically… Hang in there while we check the branch’s status." takes a minute or so, and appveyor gives up in a second: "continuous-integration/appveyor/pr — AppVeyor was unable to build non-mergeable pull request" (but sometimes catches up de-facto without notifications)...

It is also very slow to check out. To the point of git timing out after 3 minutes :\

@jimklimov jimklimov merged commit 31fc81c into networkupstools:master Nov 2, 2023
@jimklimov jimklimov deleted the issue-2142 branch November 2, 2023 07:48
@desertwitch
Copy link
Contributor

Very happy to see this integrated into CI and building nicely on all my Slackware environments now - THANKS. 🥇

@teoberi
Copy link

teoberi commented Nov 2, 2023

lua-5.4.6 is already in Slackware-64-current so it will also be in Slackware 15.1 (current becomes stable at a certain point and then the cycle continues).

jimklimov added a commit to jimklimov/nut that referenced this pull request Nov 2, 2023
…upstools#2143 follow-up]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
Copy link
Member Author

Very happy to see this integrated into CI and building nicely on all my Slackware environments now - THANKS. 🥇

image

:)

jimklimov added a commit to jimklimov/nut that referenced this pull request Nov 2, 2023
…exec option [networkupstools#2143 follow-up]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@desertwitch
Copy link
Contributor

desertwitch commented Jun 11, 2024

For any other "slackers", you'll be delighted to hear that NUT is now a part of the default set of pre-compiled packages shipping with Slackware OS. It has since this PR been integrated into the -current branch, meaning we'll likely see it a part of the next stable of the OS in the (hopefully near) future. I'm sure this addition is in no small part thanks to @jimklimov 's efforts integrating Slackware into the CI processes and fixing the various compiler warnings for us, ensuring a smooth compilation on Slackware too.

https://mirrors.slackware.com/slackware/slackware64-current/ChangeLog.txt

Fri Apr  5 20:11:23 UTC 2024
[...]
a/nut-2.8.2-x86_64-1.txz:  Added.
  This is a package to support uninterruptible power supplies, and replaces
  the obsolete genpower package.
  Thanks to V'yacheslav Stetskevych for the original SBo script.
[...]

https://mirrors.slackware.com/slackware/slackware64-current/source/a/nut/
https://mirrors.slackware.com/slackware/slackware64-current/slackware64/a/

Many thanks, Jim!

@jimklimov
Copy link
Member Author

And thanks back to you for a lot of testing, ideas and questions - both Slackware-related and not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Entries related to continuous integration infrastructure (here CI = tools + scripts + recipes) documentation impacts-release-2.8.1 Issues reported against NUT release 2.8.1 (maybe vanilla or with minor packaging tweaks) Linux Some issues are specific to Linux as a platform packaging portability We want NUT to build and run everywhere possible Windows
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Compiling 2.8.1 from sources, windows.h fatal error (Slackware 15)
3 participants