Static build does not work for libmnl (-lmnl)

Bug #1971523 reported by Lars Ekman
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libmnl (Debian)
Fix Committed
Unknown
libmnl (Ubuntu)
Fix Released
Undecided
Michał Małoszewski
Jammy
Won't Fix
Undecided
Unassigned

Bug Description

[Test Case]
$ cat > /tmp/hello.c <<EOF
#include <stdio.h>

int main() {
    printf("Hello world! (and LP: #1971523)\n");
}
EOF
$ gcc -o /tmp/hello /tmp/hello.c -lmnl
(dynamic libs work)
$ gcc -static -o /tmp/hello /tmp/hello.c -lmnl
/usr/bin/ld: cannot find -lmnl: No such file or directory

[Original Report]
My program uses both -lmnl and -lnetfilter_queue and in Ubuntu 20.04 the -lnetfilter_queue did not work and -lmnl worked for static builds. In Ubuntu 22.04 the problem is reversed, -lnetfilter_queue works but -lmnl doesn't for static builds. This is very awkward during the transition 20.04->22.04 when both should be supported.

I compensated in Ubuntu 20.04 by building netfilter_queue locally;
https://github.com/Nordix/nfqueue-loadbalancer#build

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: libmnl0:amd64 1.0.4-3build2
ProcVersionSignature: Ubuntu 5.15.0-27.28-generic 5.15.30
Uname: Linux 5.15.0-27-generic x86_64
ApportVersion: 2.20.11-0ubuntu82
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: XFCE
Date: Wed May 4 07:33:26 2022
InstallationDate: Installed on 2018-09-07 (1334 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: libmnl
UpgradeStatus: Upgraded to jammy on 2022-05-01 (2 days ago)

Related branches

Revision history for this message
Lars Ekman (uablrek) wrote :
Revision history for this message
Paride Legovini (paride) wrote :

Hello Lars and thanks for this bug report. I can confirm this: libmnl-dev 1.0.4-2 installs

  /usr/lib/x86_64-linux-gnu/libmnl.a

while libmnl-dev 1.0.4-3 does not. I tracked this down to this Debian packaging change (see the debian/libmnl-dev.install diff):

https://salsa.debian.org/pkg-netfilter-team/pkg-libmnl/-/commit/3526970e4dfb5598a9023496211c908e9ab7c9dc

Dropping the .a file looks like unintentional to me, at least by reading the commit message. Ideally this should be fixed in Debian, to make Debian benefit from the fix and keep the packages in sync, lowering the maintenance work from the Ubuntu side.

Do you you think you can file a bug in Debian against the libmnl source package and report it back here? This would speed up things. Thanks!

tags: added: server-todo
Changed in libmnl (Ubuntu):
status: New → Triaged
Revision history for this message
Lars Ekman (uablrek) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thank you Lars,
Debian maintainer confirmed the issue and agreed on making the necessary changes which is great as we do not have to deviate. They didn't land yet, but once they do (which will update the now linked Debian bug).

From there we can then consider SRUs - I added bug tasks for these.

Changed in libmnl (Ubuntu Impish):
status: New → Triaged
Changed in libmnl (Ubuntu Jammy):
status: New → Triaged
Changed in libmnl (Debian):
status: Unknown → Fix Committed
Revision history for this message
Bryce Harrington (bryce) wrote :

It appears this was fixed in Debian VCS with this commit:

# https://salsa.debian.org/pkg-netfilter-team/pkg-libmnl/-/commit/e2a70f23660d5550a23966bef385042bf2f706da
commit e2a70f23660d5550a23966bef385042bf2f706da
Author: Jeremy Sowden <email address hidden>
Date: Fri May 6 15:48:27 2022 +0100

    d/rules, d/libmnl-dev.install: build and install static library (closes: #1010616)

    Signed-off-by: Jeremy Sowden <email address hidden>

It looks like that will be included in 1.0.5-1, but Debian hasn't posted that release yet. However, the change itself looks quite straightforward if it needed to be cherrypicked (which will h ave to be done anyway for SRU).

Bryce Harrington (bryce)
description: updated
tags: added: bitesize
Changed in libmnl (Ubuntu):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
no longer affects: libmnl (Ubuntu Impish)
Changed in libmnl (Ubuntu Jammy):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Work in progress on MP.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

@Michal
Sponsored for Kinetic, once complete there please have a look at considering an SRU.

This might be on the brink between fix and feature depending on someones POV.

Make your own decision and add some arguments for it to the SRU template (if that is what you go for). Or explain why you decided against it here on the bug and set the Jammy task to Won't Fix.

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Sure. I am ready to deeply investigate it to make a proper decision.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libmnl - 1.0.4-3ubuntu1

---------------
libmnl (1.0.4-3ubuntu1) kinetic; urgency=medium

  * Static build does not work for libmnl (-lmnl) (LP: #1971523)

 -- Michal Maloszewski <email address hidden> Thu, 21 Jul 2022 14:02:16 +0200

Changed in libmnl (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Hi Lars,

As you probably know, that bug has been fixed in kinetic. Therefore, I might prepare backporting and upload changes into Jammy.
The bug heat measure is low and I need additional data whether there are others affected by that bug. The process of backporting (SRU) bears the risk so impact on users is the additional factor which might convince the SRU team to backport it. So the more people affected by it, the better.

I would like to ask you then to test the changes that would be made by backporting fix according to the steps mentioned in the SRU bug report that would be prepared.

Revision history for this message
Lars Ekman (uablrek) wrote :

Hi,

Thanks for your effort.

I build libmnl locally from source as a work-around and it works fine. This problem is not stopping, but the instructions for building my sw becomes awkward (download libmnl source... etc.). I don't want to require people to upgrade to Kinetic to build it so I stick with LTE and local build. I can live with that.

As mentioned, in Ubuntu 20 it was libnetfilter_queue that did not contain a static build but I did not report it. This time I did, to get it fixed eventually, but it's not urgent for me.

Best Regards,
Lars Ekman

Changed in libmnl (Ubuntu Jammy):
status: Triaged → Won't Fix
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote (last edit ):

Set it as a 'Won't Fix' and assigning the Jammy part of the bug to Nobody.

I think there is no urgent case to take care of it now, if there exists a real workaround.
In any trouble and in case of problem which will be still felt, please reach out to me
and I will continue with the SRU, but if there is anyone who wants and can take this up and want to fix it properly, we will help them get the fix into Jammy.

Changed in libmnl (Ubuntu Jammy):
assignee: Michał Małoszewski (michal-maloszewski99) → nobody
tags: removed: server-todo
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.