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

Port abseil to GNU/Hurd. #1829

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

crupest
Copy link

@crupest crupest commented Feb 9, 2025

This pr is to port abseil to GNU/Hurd. It might be a little hard for you to thoroughly review and test the patch on GNU/Hurd manually. But feel free to talk about any problems on it. I'm here willing to explain as much as I can. Here are some info that might be helpful.

  • I have succeeded to package it to .deb on GNU/Hurd Debian distribution. One step of the .deb packaging process is to run the unit tests, just like Debian on other platforms. And they passed.

  • I have recently submitted a patch to libgav1, which is the av1 decoder used in Chromium (maybe), and depends on abseil. I fixed its compiling failure on GNU/Hurd and built it with ported abseil. It works well and I can use it to decode real av1 videos.

  • This patch was firstly posted to GNU/Hurd Debian mailing list for review, and some of the maintainers of GNU/Hurd have checked it. Some discussions also took place on irc channel. If you are interested, check here [1] [2] [3].

Following is the commit message. Most platform technical details are described on it.


abseil has failed to build on GNU/Hurd for a long time. Now let's make it work! :)

Note that __GNU__ is the macro for detecting GNU/Hurd. And __MACH__ is also defined there besides on Apple platform. They are both "mach" but with different implementation and platform details. Here are the works,

  • Mark platform features (not) supported by GNU/Hurd.

    • Supports mmap and write.

    • Not supports vdso. It's specific to Linux.

    • Not supports ELF_SYMBOLIZE for now. GNU/Hurd uses ELF as the binary format. But symbolizing in abseil relies on reading object file path from /proc/self/task/<pid>/maps (Linux specific) or /proc/self/maps. GNU/Hurd does have the latter. However, due to its micro-kernel design, it's currently unable to get the file path info there.

    • Disable stack consumption measurement. The problem behind it is that GNU/Hurd uses a very different way to implement signal handling. Due to compiler behavior, it is impossible to get a stable, valid and reliable statictic data. In my test environment, it's 96 bytes (< 100) for current codes.

  • GNU/Hurd uses different errno and messages than Linux. So related things are adjusted accordingly.

  • Fix a misuse of __MACH__, which should actually be __APPLE__.

  • Fix a missing including of signal.h for using SIGABRT. Otherwise compilation will fail with undefined symbol error on GNU/Hurd.

abseil has failed to build on GNU/Hurd for a long time. Now
let's make it work! :)

Note that `__GNU__` is the macro for detecting GNU/Hurd. And
`__MACH__` is also defined there besides on Apple platform.
They are both "mach" but with different implementation and
platform details. Here are the works,

* Mark platform features (not) supported by GNU/Hurd.

  * Supports `mmap` and `write`.

  * Not supports `vdso`. It's specific to Linux.

  * Not supports `ELF_SYMBOLIZE` for now. GNU/Hurd uses ELF as
    the binary format. But symbolizing in abseil relies on
    reading object file path from `/proc/self/task/<pid>/maps`
    (Linux specific) or `/proc/self/maps`. GNU/Hurd does have
    the latter. However, due to its micro-kernel design, it's
    currently unable to get the file path info there.

  * Disable stack consumption measurement. The problem behind
    it is that GNU/Hurd uses a very different way to implement
    signal handling. Due to compiler behavior, it is
    impossible to get a stable, valid and reliable statictic
    data. In my test environment, it's 96 bytes (< 100) for
    current codes.

* GNU/Hurd uses different errno and messages than Linux. So
  related things are adjusted accordingly.

* Fix a misuse of `__MACH__`, which should actually be
  `__APPLE__`.

* Fix a missing including of `signal.h` for using `SIGABRT`.
  Otherwise compilation will fail with undefined symbol error
  on GNU/Hurd.

Signed-off-by: Yuqian Yang <[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

Successfully merging this pull request may close these issues.

1 participant