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

Consider statically linking wslbridge-backend #26

Open
rprichard opened this issue Apr 22, 2018 · 1 comment
Open

Consider statically linking wslbridge-backend #26

rprichard opened this issue Apr 22, 2018 · 1 comment

Comments

@rprichard
Copy link
Owner

wslbridge-backend is currently distributed as a dynamic executable, which makes it dependent on the libc it's built against (most recently, glibc in the Ubuntu 14.04 WSL image). To use wslbridge with a non-glibc WSL distribution, it's necessary to rebuild wslbridge-backend. If it were instead distributed as a static binary, maybe that wouldn't be necessary.

Current issues with static linking:

  • The new call to getpwuid (for Invoke user's default shell #17) generates a linker warning:

    wslbridge-backend.cc:(.text.startup+0x116f): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    

    Maybe wslbridge could parse /etc/passwd or invoke getent passwd "$USER" if things like LDAP and NIS are relevant.

  • Linking with -static -pthread produces a binary that mostly works, but apparently attempting to join a thread causes a segfault. The fix is to build with -static -pthread -Wl,--whole-archive -lpthread -Wl,--no-whole-archive: https://stackoverflow.com/a/45271521

@Biswa96
Copy link

Biswa96 commented Apr 27, 2018

That is only a warning. g++ can compile the binary. But that also depends on /etc/passwd file. What happens if that file is not present? WSL team has added a feature in init where Linux distributions can be run without /etc/passwd. See this: microsoft/WSL#3001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants