Skip to content

Fails to build: Missing include: stdbool.h #69

Closed

Description

@es20490446e

As long as there is any CFLAGS set in the environment variables, running python -m build --wheel --no-isolation leads to:

* Getting build dependencies for wheel..                                                              
running egg_info
creating src/rtmixer.egg-info
writing src/rtmixer.egg-info/PKG-INFO
writing dependency_links to src/rtmixer.egg-info/dependency_links.txt
writing requirements to src/rtmixer.egg-info/requires.txt
writing top-level names to src/rtmixer.egg-info/top_level.txt
writing manifest file 'src/rtmixer.egg-info/SOURCES.txt'
reading manifest file 'src/rtmixer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'portaudio/index.html'
adding license file 'LICENSE'
writing manifest file 'src/rtmixer.egg-info/SOURCES.txt'
* Building wheel..
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-314
copying src/rtmixer.py -> build/lib.linux-x86_64-cpython-314
running egg_info
writing src/rtmixer.egg-info/PKG-INFO
writing dependency_links to src/rtmixer.egg-info/dependency_links.txt
writing requirements to src/rtmixer.egg-info/requires.txt
writing top-level names to src/rtmixer.egg-info/top_level.txt
reading manifest file 'src/rtmixer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'portaudio/index.html'
adding license file 'LICENSE'
writing manifest file 'src/rtmixer.egg-info/SOURCES.txt'
running build_ext
generating cffi module 'build/temp.linux-x86_64-cpython-314/_rtmixer.c'
creating build/temp.linux-x86_64-cpython-314
building '_rtmixer' extension
creating build/temp.linux-x86_64-cpython-314/build/temp.linux-x86_64-cpython-314
creating build/temp.linux-x86_64-cpython-314/portaudio/src/common
gcc -march=x86-64 -fPIC -Isrc -Iportaudio/include -I/usr/include/python3.14 -c build/temp.linux-x86_64-cpython-314/_rtmixer.c -o build/temp.linux-x86_64-cpython-314/build/temp.linux-x86_64-cpython-314/_rtmixer.o --std=c99
build/temp.linux-x86_64-cpython-314/_rtmixer.c: In function ‘get_relevant_time’:
build/temp.linux-x86_64-cpython-314/_rtmixer.c:615:13: error: ‘false’ undeclared (first use in this function)
  615 |   }} while (false)
      |             ^~~~~
build/temp.linux-x86_64-cpython-314/_rtmixer.c:702:5: note: in expansion of macro ‘CALLBACK_ASSERT’
  702 |     CALLBACK_ASSERT(action->action);
      |     ^~~~~~~~~~~~~~~
build/temp.linux-x86_64-cpython-314/_rtmixer.c:604:1: note: ‘false’ is defined in header ‘<stdbool.h>’; this is probably fixable by adding ‘#include <stdbool.h>’
  603 | #include "rtmixer.h"
  +++ |+#include <stdbool.h>
  604 | 
build/temp.linux-x86_64-cpython-314/_rtmixer.c:615:13: note: each undeclared identifier is reported only once for each function it appears in
  615 |   }} while (false)
      |             ^~~~~
build/temp.linux-x86_64-cpython-314/_rtmixer.c:702:5: note: in expansion of macro ‘CALLBACK_ASSERT’
  702 |     CALLBACK_ASSERT(action->action);
      |     ^~~~~~~~~~~~~~~
build/temp.linux-x86_64-cpython-314/_rtmixer.c: In function ‘callback’:
build/temp.linux-x86_64-cpython-314/_rtmixer.c:615:13: error: ‘false’ undeclared (first use in this function)
  615 |   }} while (false)
      |             ^~~~~
build/temp.linux-x86_64-cpython-314/_rtmixer.c:724:3: note: in expansion of macro ‘CALLBACK_ASSERT’
  724 |   CALLBACK_ASSERT(state);
      |   ^~~~~~~~~~~~~~~
build/temp.linux-x86_64-cpython-314/_rtmixer.c:615:13: note: ‘false’ is defined in header ‘<stdbool.h>’; this is probably fixable by adding ‘#include <stdbool.h>’
  615 |   }} while (false)
      |             ^~~~~
build/temp.linux-x86_64-cpython-314/_rtmixer.c:724:3: note: in expansion of macro ‘CALLBACK_ASSERT’
  724 |   CALLBACK_ASSERT(state);
      |   ^~~~~~~~~~~~~~~
error: command '/usr/bin/gcc' failed with exit code 1

This work-around works:

sed "6a#include <stdbool.h>" --in-place "src/rtmixer.c"

Activity

  1. changed the title [-]Fails to build: Missing include: stdbool.h[/-] [+]Fails to build: Missing include: `stdbool.h`[/+] on Jan 12, 2026
  2. larsoner commented on Jan 12, 2026

    @larsoner
    Collaborator

    @es20490446e would you be up for opening a PR with the suggested fix?

  3. mgeier commented on Jan 12, 2026

    @mgeier
    Member

    This has gone a bit back and forth, apparently: I've added a manual definition at 4e92be7, and then removed it again in 470f9d9, claiming that it is unneeded.

    It might be needed after all!

    There seems to have been a problem with stdbool.h in #2/#4, so it's probably better to not include it again?

  4. es20490446e commented on Jan 12, 2026

    @es20490446e
    ContributorAuthor

    To my best understanding:

    When you removed your own bool definition, you made implicit #include <stdbool.h.

    For a while that was allowed by gcc, implicitly including any header from the C standard library.

    But on recent updates they required it to be explicit. Probably because that also implicitly declares which -std= to use, which cascaded in other series of complexities and magic.

    Since the incompatibility with Visual Studio was observed 9 years ago, and it seems gone on future versions that correctly support C99 (here), I would try just including the missing header.

    Shall I make a pull request for this?

  5. mgeier commented on Jan 15, 2026

    @mgeier
    Member

    Thanks for researching this!

    Good to know that VisualStudio 2015 seems to support the correct usage.

    Shall I make a pull request for this?

    Yes, please!

  6. es20490446e commented on Jan 16, 2026

    @es20490446e
    ContributorAuthor

    Pull request #72.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions