Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 736804 - sys-power/nut-2.7.4-r6 with USE=cgi fails to configure
Summary: sys-power/nut-2.7.4-r6 with USE=cgi fails to configure
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Robin Johnson
Keywords: PATCH
: 801502 (view as bug list)
Depends on:
Reported: 2020-08-11 21:48 UTC by Bruce Guenter
Modified: 2023-06-17 03:17 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---

Build log (sys-power:nut-2.7.4-r6:20200811-214723.log,14.30 KB, text/plain)
2020-08-11 21:53 UTC, Bruce Guenter
config.log (config.log,109.35 KB, text/plain)
2020-08-11 21:58 UTC, Bruce Guenter
Attempt to fix the libgd issues (libgd.patch,1.85 KB, patch)
2020-11-16 12:06 UTC, Norbert
Details | Diff
path for nut-2.7.4-r6 (libgd_bug.patch,1.77 KB, patch)
2020-12-28 19:43 UTC, Igor
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bruce Guenter 2020-08-11 21:48:53 UTC
When building sys-power/nut-2.7.4-r6 with USE=cgi, configure fails at:

checking for gd version via gdlib-config... none found
checking for gd include flags... 
checking for gd library flags... -L/usr/X11R6/lib -lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11
checking for gd.h... yes
checking for gdfontmb.h... yes
checking for library containing gdImagePng... no
configure: error: libgd not found, required for CGI build

Rebuilding with USE=-cgi allows the emerge to succeed.

Reproducible: Always

Portage 2.3.103 (python 3.7.8-final-0, default/linux/amd64/17.0/hardened, gcc-9.3.0, glibc-2.31-r6, 5.4.57 x86_64)
System uname: Linux-5.4.57-x86_64-Intel-R-_Xeon-R-_CPU_E5420_@_2.50GHz-with-gentoo-2.6
KiB Mem:    24682424 total,   3451888 free
KiB Swap:    2097020 total,   2096496 free
Timestamp of repository gentoo: Tue, 11 Aug 2020 12:11:56 +0000
Head commit of repository gentoo: 0d8209718aa61459a6e41d805d4b57651f420138

Timestamp of repository dotnet: Mon, 10 Aug 2020 09:13:26 +0000
Head commit of repository dotnet: a5bd503da8cb658f8f4fbf53cee1f6f644c9977d

Timestamp of repository go-overlay: Mon, 10 Aug 2020 09:13:55 +0000
Head commit of repository go-overlay: 56b684348b133aedbdb0be40bc3dd3a1fd499553

Timestamp of repository snapd: Sat, 04 Jul 2020 22:05:17 +0000
Head commit of repository snapd: d9919a7f292ff6728946abbfc6aa9cff609add90

sh dash
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
app-shells/bash:          5.0_p17::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18-r1::gentoo, 3.7.8-r2::gentoo, 3.8.4-r1::gentoo
dev-util/cmake:           3.16.5::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.33.1-r1::gentoo
sys-devel/gcc:            9.3.0-r1::gentoo
sys-devel/gcc-config:     2.3.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.31-r6::gentoo

    location: /home/share/gentoo/repos/gentoo
    sync-type: git
    priority: -1000

    location: /home/bruce/portage
    masters: gentoo
    priority: 0

    location: /home/share/gentoo/repos/dotnet
    sync-type: git
    masters: gentoo

    location: /home/share/gentoo/repos/go-overlay
    sync-type: git
    masters: gentoo

    location: /home/share/gentoo/repos/snapd
    sync-type: git
    masters: gentoo

ACCEPT_LICENSE="@FREE intel-ucode freedist DCC all-rights-reserved unRAR"
CFLAGS="-O3 -pipe -march=core2 -mtune=native -fstack-protector-all"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/share/gnupg/qualified.txt /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.4/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -pipe -march=core2 -mtune=native -fstack-protector-all"
EMERGE_DEFAULT_OPTS="--quiet-build --jobs=8"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg compress-build-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync metadata-transfer multilib-strict network-sandbox news notitles parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="--jobs=8 --load-average=8.99"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="16bit acl adns amd64 apache2 berkdb blksha1 bpf btrfs bzip2 cdr cgi chroot cli cpdflib crypt css ctype curl curlwrappers dbus dep deprecated e2fsprogs edl encode erandom ethereal evo expat extensions fastcgi fcgi filters foomatic fpm ftconv gd geoip git gmp gpg gpgme guile gzip hardened hardenedphp hbci http iconv icu imap initramfs innodb intl ipv6 jpeg json justify kerberos lcms libevent libtirpc lmdb lxc lz4 lzma maildir mbox mdev memlimit mime mmx mudflap mysql mysqli ncurses nettle networking nfs nfsv3 nfsv4 nls nptl nptlonly ntfsprogs ocamlopt openrc overlay pam pcre pcre2 pcre32 pdo perl php pic pie png posix postgres ptpax python qmail readline redis regex rpc sanitize seccomp sendfile server session shared slang small-scale smime soap sockets split-usr sqlite sqlite3 sse sse2 ssl ssp subversion suexec suhosin symlink tabs tcpd threads threadsafe tls tools truetype udev unicode urandom usb utf8 vtv webdav-neon xattr xml xml2 xmlreader xmlwriter xtpax zeroconf zip zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="access_compat actions alias auth_basic auth_digest authn_anon authn_core authn_dbd authn_dbm authn_default authn_file authz_core authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif so socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias proxy proxy_fcgi proxy_http" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3" CURL_SSL="gnutls" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4" POSTGRES_TARGETS="postgres9_3 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 1 Bruce Guenter 2020-08-11 21:53:14 UTC
Created attachment 654230 [details]
Build log
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-08-11 21:54:19 UTC
Can you include the config.log it suggests too? Thanks.
Comment 3 Bruce Guenter 2020-08-11 21:58:44 UTC
Created attachment 654232 [details]
Comment 4 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2020-08-11 22:44:13 UTC
cgi? ( >=media-libs/gd-2[png] )

do you have gd installed?  it seems to be a requirement (you seem to require cgi as well, which should pull it in.
Comment 5 Bruce Guenter 2020-08-11 23:41:32 UTC
I do have media-libs/gd installed with the png use flag:

*  media-libs/gdmedia-libs/gd-2.3.0::gentoo was built with the following:
USE="jpeg png tiff truetype webp zlib -fontconfig -static-libs -test -xpm" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="sse"
CFLAGS="-O3 -pipe -march=core2 -mtune=native -fstack-protector-all -msse -mfpmath=sse"
FEATURES="unmerge-orphans merge-sync binpkg-docompress assume-digests usersandbox qa-unresolved-soname-deps userpriv news pid-sandbox compress-build-logs protect-owned unknown-features-warn ebuild-locks distlocks usersync parallel-fetch network-sandbox userfetch metadata-transfer strict config-protect-if-modified binpkg-logs fixlafiles notitles sandbox sfperms multilib-strict preserve-libs unmerge-logs ipc-sandbox xattr buildpkg binpkg-dostrip"
Comment 6 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2020-08-11 23:48:38 UTC
maybe it needs fonntconfig as well
Comment 7 Bruce Guenter 2020-08-12 00:02:12 UTC
Same issue when running the following:

USE=fontconfig emerge -1 media-libs/gd sys-power/nut
Comment 8 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2020-08-12 00:16:13 UTC
not sure if that would emerge both at once or not, but if it did not (if it merged gd before starting on nut), then I don't know why it can't find gd
Comment 9 Bruce Guenter 2020-08-12 00:17:56 UTC
It did merge them separately.

>>> Verifying ebuild manifests
>>> Emerging (1 of 2) media-libs/gd-2.3.0::gentoo
>>> Installing (1 of 2) media-libs/gd-2.3.0::gentoo
>>> Emerging (2 of 2) sys-power/nut-2.7.4-r6::gentoo
>>> Failed to emerge sys-power/nut-2.7.4-r6, Log file:
Comment 10 Bruce Guenter 2020-08-12 17:03:08 UTC
From what I can tell, the problem is that media-libs/gd does not install gdlib-config. nut is using that program to check for the libraries. When it is not present, it uses a default setting for LIBS when building the test program. The default libs includes -lXpm -lX11. This system doesn't have X installed (it's a server), so the test source fails to link.

I am looking into a patch that can use pkg-config to determine those libs flags.
Comment 11 Zsolt Dénes 2020-10-20 09:19:25 UTC
Is there any solution for this bug?
Comment 12 Norbert 2020-11-16 12:05:19 UTC
I had the same issue and based on the information from Bruce, I tinkered around with a patch until I got it to compile, and so far it's running without issue on my server.

DISCLAIMER: I'm not a C or C++ developer and I'm not fully aware what I was doing while messing with the files.

I tried to replace as good as I can gdlib-config with pkg-config and removed the check for gdImagePng and some other flags.

Maybe someone can use my attempt to fix this for a proper patch.
Comment 13 Norbert 2020-11-16 12:06:07 UTC
Created attachment 671620 [details, diff]
Attempt to fix the libgd issues
Comment 14 Igor 2020-12-28 19:39:27 UTC
confirm this bug for sys-power/nut-2.7.4-r6
patch from  Norbert not work whith nut-2.7.4-r6
Comment 15 Igor 2020-12-28 19:43:10 UTC
Created attachment 680110 [details, diff]
path for nut-2.7.4-r6

add patch for nut-2.7.4-r6
Comment 16 Igor 2020-12-28 19:52:01 UTC
> patch from  Norbert not work whith nut-2.7.4-r6
Hmm... I do not see different in my and Norbert diff, but on my system not apply correct.
I manual change source from Norbert patch, and create diff.
Sorry for my english :(
Comment 17 Toralf Förster gentoo-dev 2021-02-15 11:45:53 UTC
happened here at the tinderbox too:

checking for library containing gdImagePng... no
configure: error: libgd not found, required for CGI build

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/sys-power/nut-2.7.4-r6/work/nut-2.7.4/config.log
 * ERROR: sys-power/nut-2.7.4-r6::gentoo failed (configure phase):
 *   econf failed
Comment 18 Toralf Förster gentoo-dev 2021-07-10 19:52:28 UTC
*** Bug 801502 has been marked as a duplicate of this bug. ***
Comment 19 Fog_Watch 2021-08-01 08:02:04 UTC
I put "path for nut-2.7.4-r6" in /etc/portage/patches/sys-power/nut-2.7.4-r7/bug.patch and successfully emerged sys-power/nut-2.7.4-r7.
Comment 20 Larry the Git Cow gentoo-dev 2023-06-17 03:15:31 UTC
The bug has been closed via the following commit(s):

commit aea0f99f970c391e3daf4f98d0b6a2dc58fc039b
Author:     Francisco Javier Félix <>
AuthorDate: 2023-06-16 16:14:55 +0000
Commit:     Sam James <>
CommitDate: 2023-06-17 03:13:49 +0000

    sys-power/nut: add 2.8.0, various enhancements
    I've recently made a comprehensive update to the ebuild of sys-power/nut:
    The way drivers are activated has been altered - instead of using a driver list, which
    can be hard to maintain when new ones are added, we now activate them based on the
    connection type (serial, USB, XML, IPMI, Modbus, etc).
    This simplification not only streamlines the installation process but also resolves
    dependency issues associated with activating a driver and its corresponding unactivated connection.
    The updates align with the latest Gentoo specifications and are summarized below:
    *    Removed unused libnsl
    *    Removed outdated hotplug
    *    Utilized EAPI=8
    *    Default use of libusb-1
    *    Added connections for GPIO, i2c, and Modbus
    *    Configuration parameters required per connection type
    *    Fixed the creation of PID in /run/nut
    *    Removed configurations no longer necessary for nut-2.8.0 or newer
    *    Creation of man pages
    *    Added a flag for documentation
    *    Utilized tmpfile for creating temporary directories
    *    Added Q5t5 monitor (nut-9999)
    *    Disabled Python2
    *    Added Python3 library
    *    Message for the optional function of sys-apps/util-linux[logger, tty-helpers]
    *    Added configuration for Avahi
    *    Added a flag for systemd (nut-9999)
    TODO: (in next version)
    *    nut-scanner is not working
    *    /etc/init.d/upslog requires parameters of SAI and log file
    Please note that I have tested different SAI drivers, but only with USB and SNMP connections.
    Any feedback or further testing on these updates would be highly appreciated.
    Package-Manager: Portage-, pkgcheck-0.10.24
    Signed-off-by: Fco Javier Felix <>
    Signed-off-by: Sam James <>

 sys-power/nut/Manifest                             |   1 +
 sys-power/nut/files/nut-2.6.5-init.d-upsmon        |   2 +-
 .../files/nut-2.8.0-fix-man-page-generation.patch  |  64 +++++
 sys-power/nut/files/nut-2.8.0-init.d-upsd          |  37 +++
 sys-power/nut/files/nut.powerfail.initd            |   1 -
 sys-power/nut/files/systemd_notify.path            |  50 ++++
 sys-power/nut/metadata.xml                         |  14 +-
 sys-power/nut/nut-2.8.0.ebuild                     | 222 +++++++++++++++++
 sys-power/nut/nut-9999.ebuild                      | 266 +++++++++++++++++++++
 9 files changed, 654 insertions(+), 3 deletions(-)