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

Add Nix flake #1854

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Add Nix flake #1854

wants to merge 2 commits into from

Conversation

svenssonaxel
Copy link

After much failure trying to follow BUILDING.txt instructions, I only managed to build using Nix. Contributing a flake.nix in case others have similar trouble.

  • Supports one-line build for
    • linux x86_64
    • linux aarch64 (not tested)
    • darwin x86_64 (not tested)
    • darwin aarch_64 (not tested)
    • java
    • windows 64-bit
    • windows 32-bit

Marking as draft due to a couple of questions:

  • NLS support for Windows (separate commit) creates a vncviewer.exe with a hard-coded path pointing to gettext language support files. Not sure why.
  • Not sure if we want to support release builds using Nix.
  • Windows builds are almost entirely static, using no *.dll files except for wm_hooks.dll. Do we want the other builds to also be static?

@CendioOssman
Copy link
Member

I'm not too keen on another build script to maintain. So first I'd like to explore where you got stuck, and see if we can ease that hurdle?

@svenssonaxel
Copy link
Author

svenssonaxel commented Oct 22, 2024

Sure. I've already provided a Dockerfile explaining where I get stuck. Attached again here:

Dockerfile-debian.txt

Run it as docker build -f Dockerfile-debian.txt .. If you can edit this file so that building works, perhaps even simplify it, I think you'll have produced better documentation already.

I suppose my point is that this PR is not "another build script"; it's not an alternative to CMakeLists.txt. It is more like an executable description of dependencies, something that currently does not exist at all. The Dockerfile fulfills (or would, if fixed) the same function, in a less pure but perhaps more accessible way.

@CendioOssman
Copy link
Member

The Dockerfile is based on Debian, which does explain a lot of the difficulties. Unfortunately, they don't have a good MinGW environment to use. So you have to set up one from scratch, with all the difficulties that entails.

Using Arch or Fedora makes the process much easier as you can just install all the needed tools and libraries from their repositories.

MXE is available for Debian/Ubuntu, though, which could make things easier.

The main issue with the given Dockerfile seems to be that pkg-config isn't properly used. Which is how the build system finds most things. Usually, you specify the cross-compiler pkg-config to CMake (just like you specify the cross-compiler). But since there isn't one, you'll need to use the normal pkg-config with a different search path:

RUN cd tigervnc && \
    mkdir build && \
    cd build && \
    PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/lib/pkgconfig:/usr/x86_64-w64-mingw32/share/pkgconfig \
    $CMAKE -G "Unix Makefiles" \
        ..

At this point it works much better. It still fails for me because we apparently have a bug on master if GnuTLS is missing. And we have #949 if gettext is missing. If those two are added, then I would assume things build just fine.

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

Successfully merging this pull request may close these issues.

2 participants