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

xorg.libX11: fix static build #103278

Closed
wants to merge 1 commit into from

Conversation

expipiplus1
Copy link
Contributor

Fix the incorrect linking of the build tool makekeys during the build
process as described here #103195

Note: I have not tested this

CC @symphorien

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Fix the incorrect linking of the build tool `makekeys` during the build
process as described here NixOS#103195
@expipiplus1
Copy link
Contributor Author

Although this allows libX11 to build, I don't think it's built correctly. Things fail to link against libX11, missing some xcb symbols, for example in this test to detect X11: https://gist.github.com/expipiplus1/87201bd0f57325541a365ebf378415cc#file-gistfile1-txt-L5-L36

@symphorien
Copy link
Member

I had the same problem here:

xauth = xorgsuper.xauth.overrideAttrs (attrs: {
# missing transitive dependencies
preConfigure = attrs.preConfigure or "" + ''
export NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -lxcb -lXau -lXdmcp"
'';

libx11 depends on libxcb, but the dependency is automatically followed by the linker only with shared libraries. With static linking, -lX11 is not enough, -lxcb is also required. If I understand correctly, things which use pkg-config do work, because pkg-config knows about the additional required flag when passed --static, but things which just probe whether -lx11 works with ./configure just fail.

@expipiplus1
Copy link
Contributor Author

hmm, is there a good fix for this aside from just patching downstream packages?

@symphorien
Copy link
Member

I'm not sure, maybe there is a way to merge libX11.a and libxcb.a into only one archive ?

@symphorien
Copy link
Member

Or maybe we can have a look at what other static-only distros do ?

@expipiplus1
Copy link
Contributor Author

The output of this derivation is correct, I think it would be quite weird to link libxcb in with libX11, likewise it would be pretty hacky to trick consumers of libX11 to link with libxcb using NIX_LDFLAGS or whatever. sadly I think that this is just a bug in dbus which should be fixed.

Knowing what other distros do would be good, I'll have a quick look.

@expipiplus1 expipiplus1 marked this pull request as ready for review November 12, 2020 01:01
@expipiplus1
Copy link
Contributor Author

Is it possible to merge this please as the above problem seems to be one with dbus's build system and not libX11

@expipiplus1
Copy link
Contributor Author

ping?

@symphorien
Copy link
Member

Hmm I forgot about this and the file completely changed on master.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Mar 25, 2021

On master pkgstStatic.xorg.libX11 builds. The particular change proposed here has been already applied.

@expipiplus1
Copy link
Contributor Author

expipiplus1 commented Mar 25, 2021 via email

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

Successfully merging this pull request may close these issues.

None yet

4 participants