Bug 27076

Summary: RPM COPR builds for Mageia: /usr/bin/ld: cannot find -lsystemd
Product: Mageia Reporter: Graham Leggett <minfrin>
Component: RPM PackagesAssignee: All Packagers <pkg-bugs>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Normal CC: doktor5000, lewyssmith, marja11
Version: Cauldron   
Target Milestone: ---   
Hardware: All   
OS: Linux   
URL: https://copr.fedorainfracloud.org/coprs/minfrin/mod_magick/build/1601152/
Whiteboard:
Source RPM: https://github.com/minfrin/mod_magick/releases/download/mod_magick-1.0.0/mod_magick-1.0.0-1.el8.src.rpm CVE:
Status comment:

Description Graham Leggett 2020-08-10 22:26:19 CEST
Description of problem:

While trying to build an Apache httpd module on Mageia Cauldron, the build fails complaining that the library -lsystemd is missing.

The mod_magick SRPM makes no reference to systemd. It looks like either Apache httpd, APR, APR-util or GraphicsMagick is pulling in systemd as a dependency, but this is not being declared by the RPM dependencies, and so the COPR build fails.

This is a guess though, no idea why systemd is being brought in, and no idea why systemd is missing.

This package builds error free at OpenSUSE, Fedora and EPEL.

Version-Release number of selected component (if applicable):


How reproducible:

Always

Steps to Reproduce:
1. Build mod_magick v1.0.0 from https://github.com/minfrin/mod_magick at COPR at https://copr.fedorainfracloud.org/coprs/minfrin/mod_magick/.
2. See build succeed for all Fedora and EPEL.
3. See build fail for Mageia Caudron.

Full build log is here:

https://download.copr.fedorainfracloud.org/results/minfrin/mod_magick/mageia-cauldron-x86_64/01601152-mod_magick/builder-live.log.gz

Full failure is as follows:

/usr/bin/make  all-am
make[1]: Entering directory '/builddir/build/BUILD/mod_magick-1.0.0'
apxs "-Wc,-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fasynchronous-unwind-tables -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/apr-1  -I/usr/include/apr-1 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread  -I/usr/include/GraphicsMagick  -I/usr/include/GraphicsMagick " -c -c  -Wc,"-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fasynchronous-unwind-tables -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/apr-1  -I/usr/include/apr-1 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread  -I/usr/include/GraphicsMagick  -I/usr/include/GraphicsMagick " -Wc,"" -Wl,"-Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags    " -Wl,"" -lGraphicsMagickWand -lGraphicsMagick  -lapr-1 -lpthread -ldl  -laprutil-1 -lldap -llber -lexpat -lcrypt -lapr-1 -lpthread -ldl  -lGraphicsMagick  -lGraphicsMagickWand -lGraphicsMagick  ./mod_magick.c
make[1]: Leaving directory '/builddir/build/BUILD/mod_magick-1.0.0'
/usr/lib64/apr-1/build/libtool --silent --mode=compile x86_64-mageia-linux-gnu-gcc -prefer-pic -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fstack-protector-all -fasynchronous-unwind-tables  -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1 -I/usr/include -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fasynchronous-unwind-tables -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/apr-1  -I/usr/include/apr-1 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread  -I/usr/include/GraphicsMagick  -I/usr/include/GraphicsMagick  -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fasynchronous-unwind-tables -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/apr-1  -I/usr/include/apr-1 -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread  -I/usr/include/GraphicsMagick  -I/usr/include/GraphicsMagick    -c -o ./mod_magick.lo ./mod_magick.c && touch ./mod_magick.slo
/usr/lib64/apr-1/build/libtool --silent --mode=link x86_64-mageia-linux-gnu-gcc -lsystemd -Wl,-z,relro,-z,now   -o ./mod_magick.la -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags       -lGraphicsMagickWand -lGraphicsMagick -lapr-1 -lpthread -ldl -laprutil-1 -lldap -llber -lexpat -lcrypt -lapr-1 -lpthread -ldl -lGraphicsMagick -lGraphicsMagickWand -lGraphicsMagick -rpath /usr/lib64/httpd/modules -module -avoid-version    ./mod_magick.lo
/usr/bin/ld: cannot find -lsystemd
collect2: error: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make[1]: *** [Makefile:665: all-local] Error 1
make: *** [Makefile:263: all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.g9Vavx (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.g9Vavx (%build)
Finish: rpmbuild mod_magick-1.0.0-1.mga8.src.rpm
Comment 1 Lewis Smith 2020-08-12 21:21:26 CEST
See also bug 27075.

I was tempted to say that this is not a Mageia problem; but COPR rang a bell, we do have a Wiki about it: https://wiki.mageia.org/en/Fedora_COPR and a package 'copr-cli'.

Assigning globally, CC'ing Marja who knows about this, and myself to find out.

FWIW:
 $ urpmq --requires-recursive apache | grep systemd
lib64systemd0
systemd

Assignee: bugsquad => pkg-bugs
CC: (none) => lewyssmith, marja11

Comment 2 Graham Leggett 2020-08-13 00:23:27 CEST
I'm suspecting that the root of the issue is that httpd is linked to systemd, but the apxs tool isn't telling any of the module builds about it, or the RPM packaging itself isn't pulling in systemd as a dependency. When COPR installs all the deps, systemd is missed, build fails.

If there are any patches you're applying to make httpd work, can you contribute those patches upstream to us (Apache httpd) or if you've already done so, highlight the PRs so I can get them integrated? Keen to make sure all the distros are using the same codebase.
Comment 3 Graham Leggett 2022-02-14 11:49:15 CET
Just hit this bug again.

This prevents third party httpd modules being built for Mageia.
Comment 4 Florian Hubold 2022-02-14 17:43:01 CET
(In reply to Graham Leggett from comment #2)

> If there are any patches you're applying to make httpd work, can you
> contribute those patches upstream to us (Apache httpd) or if you've already
> done so, highlight the PRs so I can get them integrated? Keen to make sure
> all the distros are using the same codebase.

You may want to have a look at the httpd spec, it has a BuildRequires on systemd, probably due to the upstream patch for added systemd support: http://svnweb.mageia.org/packages/cauldron/apache/current/SPECS/apache.spec?view=markup

This is probably what you're missing in the copr build: BuildRequires:  pkgconfig(systemd)

I guess that's for this patch:

# http://marc.info/?l=apache-httpd-dev&m=134867223818085&w=2
Patch29: httpd-2.4.27-systemd.patch


HTH

CC: (none) => doktor5000

Comment 5 David Walser 2022-02-14 22:56:19 CET
Actually for Cauldron you need to do pkgconfig(libsystemd) now.