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

Include recommended glibc header instead of internal one #336

Merged
merged 1 commit into from
Nov 2, 2024

Conversation

pastalian
Copy link
Contributor

@pastalian pastalian commented Nov 1, 2024

Starting with glibc-2.32, you should only include top level headers, otherwise it will cause an error.
https://docs.gtk.org/glib/compiling.html

The recommended way of using GLib has always been to only include the toplevel headers glib.h, glib-object.h, gio.h. Starting with 2.32, GLib enforces this by generating an error when individual headers are directly included.

It seems that this issue hasn't occurred in CI because of PCH.

$ cmake -B build -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
$ cmake --build build
[  2%] Built target keychain
[  4%] Built target qrcodegen
[  5%] Building CXX object CMakeFiles/abaddon.dir/src/platform.cpp.o
In file included from /usr/lib64/glib-2.0/include/glibconfig.h:9,
                 from /home/me/abaddon/src/util.hpp:14,
                 from /home/me/abaddon/src/platform.cpp:11:
/usr/include/glib-2.0/glib/gmacros.h:35:2: error: #error "Only <glib.h> can be included directly."
   35 | #error "Only <glib.h> can be included directly."
      |  ^~~~~
gmake[2]: *** [CMakeFiles/abaddon.dir/build.make:1042: CMakeFiles/abaddon.dir/src/platform.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:103: CMakeFiles/abaddon.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

Downstream bug: https://bugs.gentoo.org/942616

Starting with glibc-2.32, you only include top level headers, otherwise
it cause an error.
https://docs.gtk.org/glib/compiling.html
@ouwou ouwou merged commit 7e04fb9 into uowuo:master Nov 2, 2024
9 checks passed
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