Bug 2225287 - lvm: link against lvm2cmds library to save space
Summary: lvm: link against lvm2cmds library to save space
Keywords:
Status: NEW
Alias: None
Product: LVM and device-mapper
Classification: Community
Component: lvm2
Version: unspecified
Hardware: All
OS: All
unspecified
low
Target Milestone: ---
: ---
Assignee: LVM Team
QA Contact: cluster-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-24 21:32 UTC by Gwendal Grignou
Modified: 2023-08-10 15:40 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:
pm-rhel: lvm-technical-solution?
pm-rhel: lvm-test-coverage?


Attachments (Terms of Use)

Description Gwendal Grignou 2023-07-24 21:32:59 UTC
Description of problem:
Looking at the size of the package, in the dynamic version, lvm and lvm2cmd are about the same size:
```
ls -l /build/brya/sbin/lvm /build/brya/lib64/liblvm2cmd.so.2.03
-r-xr-xr-x 1 root root 2084640 Jul 24 13:27 /build/brya/lib64/liblvm2cmd.so.2.03
-r-xr-xr-x 1 root root 2217600 Jul 24 13:27 /build/brya/sbin/lvm
```

Looking at their Makefile.in, they both link against $OBJECTS directly (https://gitlab.com/lvmteam/lvm2/-/blob/main/tools/Makefile.in#L123), so there are a lot of code duplication:

```
lvm: $(OBJECTS) lvm.o $(LVMINTERNAL_LIBS)
...
liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
...
```

It is confirmed by lddtree, where lvm does not depend on liblvm2cmd.a
Could it be possible to link dynamic lvm against liblvm2cmd, thus saving ~2MB of space?


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

How reproducible:
Always.

Steps to Reproduce:
1. Compile lvm2 (used gentoo sys-fs/lvm2)

Actual results:
lvm and lvm2cmd are ~2MB

Expected results:
lvm should be smaller if linked against lvm2cmd.

Additional info:


Note You need to log in before you can comment on or make changes to this bug.