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

Cannot detect kernel during native build on Debian GNU/Hurd #13740

Open
smcv opened this issue Oct 2, 2024 · 1 comment
Open

Cannot detect kernel during native build on Debian GNU/Hurd #13740

smcv opened this issue Oct 2, 2024 · 1 comment

Comments

@smcv
Copy link
Contributor

smcv commented Oct 2, 2024

Describe the bug
Using host_machine.kernel() during a native build on Debian GNU/Hurd causes setup to fail.

The wider context for this is that if meson env2mfile is asked to generate a cross-file to build GNU/Hurd binaries based on dpkg-architecture -ahurd-i386, it has kernel='linux', which is certainly wrong. To fix that bug (see #13722) I would like it to have its kernel set to whatever happens in native builds, but right now, what happens in native builds is an error, which doesn't seem like what anyone wants either.

To Reproduce

project('test')
message('system is @0@'.format(host_machine.system()))
message('subsystem is @0@'.format(host_machine.subsystem()))
message('kernel is @0@'.format(host_machine.kernel()))

outputs:

The Meson build system
Version: 1.5.2
Source dir: /home/smcv/meson
Build dir: /home/smcv/meson/_build
Build type: native build
Project name: test
Project version: undefined
Host machine cpu family: x86
Host machine cpu: i686-at386
Message: system is gnu
Message: subsystem is gnu

meson.build:4:43: ERROR: Kernel not defined or could not be autodetected.

Expected behavior
I expected host_machine.kernel() to have some reasonable value, probably either gnu, hurd or mach.

Whatever value is chosen, adding 'gnu': <the chosen value> to KERNEL_MAPPINGS in mesonbuild/environment.py would probably be sufficient to resolve this bug.

If I understand correctly, the kernel of a Hurd system is technically the GNU Mach microkernel, but that's an implementation detail that ordinary Unixy software is not expected to interact with? For what it's worth, uname -s (uname --kernel-name) outputs GNU on this system.

system parameters

  • Is this a cross build? no
  • what operating system? Debian unstable
  • what Python version? 3.12.6
  • what meson --version? 1.5.2
  • what ninja --version if it's a Ninja build? irrelevant, I don't get that far
@smcv
Copy link
Contributor Author

smcv commented Oct 2, 2024

I've opened a downstream bug in Debian, cc'ing the Hurd porting team, to ask what they think kernel() should report.

smcv added a commit to smcv/meson that referenced this issue Oct 2, 2024
All official Debian release architectures use the Linux kernel, but
unofficial ports like hurd-i386 and kfreebsd-amd64 use the Hurd and
FreeBSD kernel, respectively.

Map Linux to 'linux' and kFreeBSD ports to 'freebsd' as per the
reference tables in Meson's documentation. For now, use the Debian
system name such as 'hurd' for anything else (see mesonbuild#13740 for the
question of whether Hurd should identify its kernel differently).

Signed-off-by: Simon McVittie <[email protected]>
smcv added a commit to smcv/meson that referenced this issue Oct 2, 2024
All official Debian release architectures use the Linux kernel, but
unofficial ports like hurd-i386 and kfreebsd-amd64 use the Hurd and
FreeBSD kernel, respectively.

Map Linux to 'linux' and kFreeBSD ports to 'freebsd' as per the
reference tables in Meson's documentation. For now, use the Debian
system name such as 'hurd' for anything else (see mesonbuild#13740 for the
question of whether Hurd should identify its kernel differently).

Signed-off-by: Simon McVittie <[email protected]>
jpakkane pushed a commit that referenced this issue Oct 2, 2024
All official Debian release architectures use the Linux kernel, but
unofficial ports like hurd-i386 and kfreebsd-amd64 use the Hurd and
FreeBSD kernel, respectively.

Map Linux to 'linux' and kFreeBSD ports to 'freebsd' as per the
reference tables in Meson's documentation. For now, use the Debian
system name such as 'hurd' for anything else (see #13740 for the
question of whether Hurd should identify its kernel differently).

Signed-off-by: Simon McVittie <[email protected]>
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

1 participant