Skip to content
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

Disable user name lookup in static builds against glibc #1527

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cgzones
Copy link
Member

@cgzones cgzones commented Aug 24, 2024

Static linking against glibc might crash due to usage of NSS modules, e.g. via getpwuid() (see #503).
The linker also warns about it:

warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

Static linking against glibc might crash due to usage of NSS modules,
e.g. via getpwuid() (see htop-dev#503).
The linker also warns about it:

    warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
@cgzones cgzones marked this pull request as draft August 24, 2024 19:03
@BenBE BenBE added enhancement Extension or improvement to existing feature build system 🔧 Affects the build system rather then the user experience labels Aug 24, 2024
@BenBE BenBE added this to the 3.4.0 milestone Aug 24, 2024
@BenBE
Copy link
Member

BenBE commented Sep 18, 2024

@cgzones Anything still missing here?

@cgzones
Copy link
Member Author

cgzones commented Oct 3, 2024

There might be still hidden usage of NSS modules, e.g. a static build reports:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/libsystemd.a(src_basic_user-util.c.o): in function `get_group_creds':
(.text.get_group_creds+0x84): warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/libsystemd.a(src_basic_user-util.c.o): in function `getgrgid_malloc':
(.text.getgrgid_malloc+0x80): warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/libsystemd.a(src_basic_user-util.c.o): in function `get_group_creds':
(.text.get_group_creds+0xe4): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/libsystemd.a(src_basic_user-util.c.o): in function `getgrnam_malloc':
(.text.getgrnam_malloc+0x7c): warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/libsystemd.a(src_libsystemd_sd-bus_sd-bus.c.o): in function `bus_start_address.part.0':
(.text.bus_start_address.part.0+0x962): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: Action.o: in function `Action_setUserOnly':
./Action.c:120:(.text+0x2158): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/libsystemd.a(src_basic_user-util.c.o): in function `getpwnam_malloc':
(.text.getpwnam_malloc+0x7c): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: Settings.o: in function `Settings_new':
./Settings.c:828:(.text+0x2928): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/libsystemd.a(src_basic_user-util.c.o): in function `getpwuid_malloc':
(.text.getpwuid_malloc+0x80): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

Maybe it's best to recommend not using static builds on Linux against glibc?

@BenBE
Copy link
Member

BenBE commented Oct 3, 2024

Can we check for glibc+static build in configure.ac and just issue a warning about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system 🔧 Affects the build system rather then the user experience enhancement Extension or improvement to existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants