Skip to content

pkgconfig: use the -std=gnu90 flag to compile#1458

Open
06393993 wants to merge 1 commit intobazel-contrib:mainfrom
06393993:fix_pkgconfig
Open

pkgconfig: use the -std=gnu90 flag to compile#1458
06393993 wants to merge 1 commit intobazel-contrib:mainfrom
06393993:fix_pkgconfig

Conversation

@06393993
Copy link

... otherwise, the compilation of pkgconfig may fail with the following error when compiling glib:

  CC       libglib_2_0_la-goption.lo
goption.c:169:14: error: two or more data types in declaration specifiers
  169 |     gboolean bool;
      |              ^~~~

... otherwise, the compilation of pkgconfig may fail with the following
error when compiling glib:

  CC       libglib_2_0_la-goption.lo
goption.c:169:14: error: two or more data types in declaration specifiers
  169 |     gboolean bool;
      |              ^~~~
@cerisier
Copy link
Collaborator

cerisier commented Feb 3, 2026

Hey there, what is the impact of adding this flag when using newer compilers ? Do you mean that glib is still fully gnu90 ?

@06393993
Copy link
Author

06393993 commented Feb 4, 2026

Hey there, what is the impact of adding this flag when using newer compilers ?

I think this issue only happens with newer compilers, because bool becomes a keyword in C231, and is a macro defined in <stdbool.h> since C99 until C232, so it can't be used as a field name.

I will check with some new compilers I can use recently and update.

Do you mean that glib is still fully gnu90 ?

I don't know the exact C standard they use, but the glib 2.38.2 bundled with pkg-config is checked in 12 years ago3, so we do expect it uses a rather old C standard. Is that what you are asking? Or I can dig into several package manager to see how they compile and report, do you want me to do that?

Footnotes

  1. https://en.cppreference.com/w/c/keyword/bool.html

  2. https://en.cppreference.com/w/c/types.html

  3. https://gitlab.freedesktop.org/pkg-config/pkg-config/-/tree/master/glib?ref_type=heads

@06393993
Copy link
Author

06393993 commented Feb 4, 2026

Just tried the pkg-config 0.29.2 listed at https://pkgconfig.freedesktop.org/releases/, configure simply with ../configure --with-internal-glib, and build with the make command and the gcc (Debian 15.2.0-3) 15.2.0 compiler, probably released on August 8, 20251. It ends up with this exact same error:

./../../glib/glib/goption.c:169:14: error: two or more data types in declaration specifiers
  169 |     gboolean bool;
      |              ^~~~
../../../glib/glib/goption.c:169:18: warning: declaration does not declare anything
  169 |     gboolean bool;
      |                  ^
../../../glib/glib/goption.c: In function ‘free_changes_list’:
../../../glib/glib/goption.c:1603:60: error: expected identifier before ‘bool’
 1603 |               *(gboolean *)change->arg_data = change->prev.bool;
      |                                                            ^~~~

Footnotes

  1. https://gcc.gnu.org/releases.html

@06393993
Copy link
Author

06393993 commented Feb 4, 2026

As of glib itself, they get rename the field from bool to boolean in https://gitlab.gnome.org/GNOME/glib/-/commit/9e320e1c43a4770ed1532248fe5416eb0c618120. And I also look into the pkgconfig package in AUR. They don't use the bundled glib that comes with pkgconfig, and just build ToT glib, so they can build it.

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