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

WIP: gobject-introspection: Support cross #88222

Closed

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented May 20, 2020

Motivation for this change

The idea is to build the python tools separate from the C bits, and the python tools are run natively (including C extension module, in particular), but the C bits are either the installed library, or tools that must be run with an emulator (during cross compilation) and in both cases are non-native.

I need to still need to wrap the two together for downstream consumption, and I am also debating exactly how I'd like to do that.

CC @jtojnar @samueldr

Upstream issue: https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/337
Upstream PR: https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/224

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.

@jtojnar
Copy link
Member

jtojnar commented May 20, 2020

Where do docs fit into this #87904?

@Ericson2314
Copy link
Member Author

@jtojnar Those look perfectly compatible for me :), We could build them with the python stuff or the C stuff. If you merge your PR I'll be happy to rebase mine on top.

@matthewbauer
Copy link
Member

Do all dependents of gobject-introspection need exe_wrapper?

When cross compiling nixos, I ended up having to disable gobject-introspection, vala, and gtk-docs. It ends up working pretty well, since you're already building everything from scratch, and I've never encountered a point where I need any of the 3 (matthewbauer@f33e8c3). Annoyingly there are a few things that you have to patch to disable introspection correctly.

@Ericson2314
Copy link
Member Author

The exe wrapper is sadly mandatory for anything generating typelibs (compiled gir files), but anything purely consuming them at runtime doesn't need the exe wrapper: it just links girepository like any other C library.

I would like to split up the package (different wrappers around specific outputs from the two underlying builds) to reflect this.

@matthewbauer
Copy link
Member

The exe wrapper is sadly mandatory for anything generating typelibs (compiled gir files), but anything purely consuming them at runtime doesn't need the exe wrapper: it just links girepository like any other C library.

Well I would be kind of surprised if you needed the emulator at runtime - it would be the cross compiled architecture :)

Meson could just provide exe_wrapper everywhere for consistency. qemu-user at least has few dependencies.

nixStoreDir = config.nix.storeDir or builtins.storeDir;
inherit (darwin) cctools;
};

gobject-introspection-py-tools = gobject-introspection-full-classic.override {
Copy link
Member

@Mic92 Mic92 May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the when to use what? It's not clear from the commit message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I think I'll need to make a wrapper package so this isn't actually used directly. But the idea is (whether directly or via some wrapper) than the py tools are need when generating new gir files and type libs when building some C library, and aren't needed by the programs in python etc that just consume typelibs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we should make that distinction if it’s not made by gobject introspection. IIUC things that consume gir also produce gir without much distinction.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, but we will need the wrapper anyways to combine the build platform py tools with host platform everything else.

This is from the Yocto Project, and contains maintainence to the
original work + newer cross features. (There separate brances for each
to distinguish.)
primeos added a commit to primeos/nixos-pinebook-pro that referenced this pull request Jun 26, 2020
Let's assume that NIX_PATH is already setup correctly (the channel
nixos-19.09 might not exist anyway).
Note: The cross-compilation of the full image currently depends on [0].

[0]: NixOS/nixpkgs#88222
@doronbehar doronbehar mentioned this pull request Sep 20, 2020
@worldofpeace worldofpeace mentioned this pull request Sep 26, 2020
10 tasks
@ryantm ryantm marked this pull request as draft October 23, 2020 03:00
@Ericson2314
Copy link
Member Author

I'm happy to say https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/227 was finally merged 11 months later. Hopefully https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/224, which thus became much smaller and simpler, has a chance of being merged now. Then we can finish this off.

Mindavi added a commit to Mindavi/nixpkgs that referenced this pull request May 27, 2021
See also discussion about this in the WIP PR from @Ericson2314:
- NixOS#88222

Related issue:
- NixOS#72868
sternenseemann pushed a commit that referenced this pull request May 31, 2021
See also discussion about this in the WIP PR from @Ericson2314:
- #88222

Related issue:
- #72868
fabaff pushed a commit to fabaff/nixpkgs that referenced this pull request Jun 11, 2021
See also discussion about this in the WIP PR from @Ericson2314:
- NixOS#88222

Related issue:
- NixOS#72868
@Atemu
Copy link
Member

Atemu commented Sep 23, 2021

What's the status on this?

One of the patches was merged a few months ago.

@Artturin
Copy link
Member

rebased in https://github.com/Artturin/nixpkgs/tree/gobject-introspectcross
left the source at the normal gi src

during build it fails with

gobject-introspection> substitute(): ERROR: file '/nix/store/zq92yh2l39qnjmjdn6zmiyav9ai6yb7i-gobject-introspection-hook'does not exist

What's the status on this?

One of the patches was merged a few months ago.

need this for tests https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/224

@Ericson2314
Copy link
Member Author

@Artturin @SuperSandro2000 the remaining is https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/224 is small enough that we could try to just do it downstream, and then use that to try to get the maintainer's attention.

I am pulled in many directions right now and don' feel I have the time/energy to push this, but if someone else wants to give it a shot I would be very happy to mentor them. (This also can help me be less of a chokepoint with this sort of upstream-adventure-for-better-bootstrapping stuff in general.)

@stale
Copy link

stale bot commented Apr 27, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 27, 2022
@Artturin Artturin removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 27, 2022
@FRidh FRidh added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Apr 28, 2022
@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Jun 4, 2022

Do we actually need the patch at all? Could we just build everything both times and throw away what we don't need? That would be a bit wasteful for processing power but maintaining the patch is also much work in the long run.

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

8 participants