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

C sshnpd binary (from c0.1.8 release) won't run on Ubuntu 20.04 due to missing glibc dependency #1220

Closed
cpswan opened this issue Jul 25, 2024 · 6 comments · Fixed by #1245
Closed
Assignees
Labels
bug Something isn't working

Comments

@cpswan
Copy link
Member

cpswan commented Jul 25, 2024

Describe the bug

Running ./sshnpd returns:

./sshnpd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./sshnpd)
./sshnpd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./sshnpd)

Steps to reproduce

  1. First I downloaded the sshnp-linux-x64.tgz tarball from the c0.1.8 release
  2. Then I extracted the binary: tar -xvf sshnp-linux-x64.tgz sshnpd
  3. And then I run the binary ./sshnpd

Expected behavior

Daemon shows help

Additional context

uname -a

Linux DB4 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

ldd --version

ldd (Ubuntu GLIBC 2.31-0ubuntu9.16) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
@cpswan cpswan added the bug Something isn't working label Jul 25, 2024
@XavierChanth
Copy link
Member

@cpswan This should hopefully solve this problem:
#1221

If not, then I will investigate further.

@cpswan
Copy link
Member Author

cpswan commented Jul 26, 2024

@XavierChanth I've tried the binaries for your manual test build and the c0.1.9-rc1 release and they both still fail to run for the same reason as before

@cpswan
Copy link
Member Author

cpswan commented Jul 26, 2024

This may deserve its own ticket, but I just had a go at building locally, and that's failing:

[ 50%] Linking C executable sshnpd
/usr/bin/ld: CMakeFiles/sshnpd.dir/src/main.c.o: in function `main':
main.c:(.text+0x8f2): undefined reference to `pthread_create'
/usr/bin/ld: main.c:(.text+0xcf2): undefined reference to `pthread_join'
/usr/bin/ld: _deps/srv-lib-build/libsrv-lib.a(srv.c.o): in function `run_srv_daemon_side_multi':
srv.c:(.text+0x8ee): undefined reference to `pthread_create'
/usr/bin/ld: srv.c:(.text+0x960): undefined reference to `pthread_detach'
/usr/bin/ld: _deps/srv-lib-build/libsrv-lib.a(srv.c.o): in function `socket_to_socket':
srv.c:(.text+0xdf9): undefined reference to `pthread_create'
/usr/bin/ld: srv.c:(.text+0xe63): undefined reference to `pthread_create'
/usr/bin/ld: srv.c:(.text+0xf3b): undefined reference to `pthread_join'
/usr/bin/ld: srv.c:(.text+0xfb1): undefined reference to `pthread_cancel'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sshnpd.dir/build.make:113: sshnpd] Error 1
make[1]: *** [CMakeFiles/Makefile2:751: CMakeFiles/sshnpd.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

My CMake line was:

cmake -B build -S . -DBUILD_SHARED_LIBS=off -DCMAKE_C_COMPILER=gcc -DCMAKE_C_FLAGS="-Wno-calloc-transposed-args -Wno-error -pthread -lrt"

@cpswan
Copy link
Member Author

cpswan commented Jul 30, 2024

https://github.com/wheybags/glibc_version_header may help here

https://stackoverflow.com/a/76085075 also suggests using the zig compiler, which would tie into #1208

@cpswan
Copy link
Member Author

cpswan commented Aug 2, 2024

With Zig ruled out as an approach I'll take a look at the glibc_version_header way of dealing with things.

@cpswan
Copy link
Member Author

cpswan commented Aug 5, 2024

Alpine Linux: Effortless static linking and portable applications for C/C++ provides a good overview of the issue we're facing with glibc.

I've already spent some time getting a linux-x64/arm64 build working inside of Debian 10 (glibc 2.28.0) in Docker. Unfortunately doing the same for armv7 is challenging as both CMake and Clang aren't available.

Will also take a look at what we can do with musl (building inside Alpine).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants