Repository navigation
bug: Build fails due to macro redefined error #6173
Copy link
Copy link
Closed
Milestone
Description
Building any Flet application suddenly fails.
This can be reproduced with:
flet create
flet build linux
The build fails with the following error:
[16:04:05] Created app shell ✅
[16:04:19] Packaged Python app ✅
[16:04:25] Customized app icons ✅
[16:04:29] Generated app icons ✅
[16:05:37] Resolving dependencies...
Downloading packages...
characters 1.4.0 (1.4.1 available)
! flet 0.80.5 (overridden)
flutter_lints 2.0.3 (6.0.0 available)
flutter_native_splash 2.4.6 (2.4.7 available)
lints 2.1.1 (6.1.0 available)
material_color_utilities 0.11.1 (0.13.0 available)
meta 1.17.0 (1.18.1 available)
! package_info_plus 9.0.0 (overridden)
petitparser 6.1.0 (7.0.2 available)
shared_preferences 2.5.3 (2.5.4 available)
toml 0.15.0 (0.18.0 available)
! wakelock_plus 1.4.0 (overridden)
xml 6.5.0 (6.6.1 available)
Got dependencies!
10 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Building Linux application...
/home/work/flet-build-test/build/flutter/build/linux/x64/release/python/include/python3.12/pyconfig.h:1877:
9: error: '_POSIX_C_SOURCE' macro redefined [-Werror,-Wmacro-redefined]
/home/work/flet-build-test/build/flutter/build/linux/x64/release/python/include/python3.12/pyconfig.h:1898:
9: error: '_XOPEN_SOURCE' macro redefined [-Werror,-Wmacro-redefined]
Build process failed
[16:05:38] Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.38.7, on Arch Linux 6.18.9-zen1-2-zen, locale en_US.UTF-8)
! The flutter binary is not on your path. Consider adding /home/work/flutter/3.38.7/bin to your path.
! The dart binary is not on your path. Consider adding /home/work/flutter/3.38.7/bin to your path.
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/linux-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
! Unable to access driver information using 'eglinfo'.
It is likely available from your distribution (e.g.: apt install mesa-utils)
[✓] Connected device (1 available)
[✓] Network resources
! Doctor found issues in 3 categories.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Error building Flet app - see the log of failed command above. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Operating system: Arch Linux
Flet version:
$ flet --version
Flet: 0.80.5
Flutter: 3.38.7
Pyodide: 0.27.7
I have been able to build successfully with Flet 0.80.* series before, but not sure if I tested on 0.80.5 specifically.
I attempted to build with Flet 0.80.4, but that failed with a different error:
Different build error on 0.80.4
$ flet build linux
[16:15:34] Created app shell ✅
[16:15:50] Running build hooks...Running build hooks...Running package command
Extra PyPi indexes:
Creating asset directory: /home/work/flet-build-test/build/flutter/app
Created temp directory: /tmp/serious_python_tempNWOXWK
Copying Python app from /home/work/flet-build-test/src to a temp directory
Configured Linux/ platform with sitecustomize.py
Installing with pip command to /home/work/flet-build-test/build/site-packages
Downloading Python distributive from
https://github.com/astral-sh/python-build-standalone/releases/download/20250205/cpython-3.12.9+20250205-x86
_64-unknown-linux-gnu-install_only_stripped.tar.gz to a build directory
Extracting Python distributive
ERROR: Exception:
Traceback (most recent call last):
File
"/home/work/flet-build-test/build/flutter/build/build_python_3.12.9/python/lib/python3.12/shutil.py", line
847, in move
os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/tmp/pip-target-pe5rfkmx/lib/python/flet-0.80.5.dist-info'
-> '/home/work/flet-build-test/build/site-packages/flet-0.80.5.dist-info'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File
"/home/work/flet-build-test/build/flutter/build/build_python_3.12.9/python/lib/python3.12/site-packages/pip
/_internal/cli/base_command.py", line 105, in _run_wrapper
status = _inner_run()
^^^^^^^^^^^^
File
"/home/work/flet-build-test/build/flutter/build/build_python_3.12.9/python/lib/python3.12/site-packages/pip
/_internal/cli/base_command.py", line 96, in _inner_run
return self.run(options, args)
^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/work/flet-build-test/build/flutter/build/build_python_3.12.9/python/lib/python3.12/site-packages/pip
/_internal/cli/req_command.py", line 67, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/work/flet-build-test/build/flutter/build/build_python_3.12.9/python/lib/python3.12/site-packages/pip
/_internal/commands/install.py", line 519, in run
self._handle_target_dir(
File
"/home/work/flet-build-test/build/flutter/build/build_python_3.12.9/python/lib/python3.12/site-packages/pip
/_internal/commands/install.py", line 578, in _handle_target_dir
shutil.move(os.path.join(lib_dir, item), target_item_dir)
File
"/home/work/flet-build-test/build/flutter/build/build_python_3.12.9/python/lib/python3.12/shutil.py", line
863, in move
copytree(src, real_dst, copy_function=copy_function,
File
"/home/work/flet-build-test/build/flutter/build/build_python_3.12.9/python/lib/python3.12/shutil.py", line
600, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/home/work/flet-build-test/build/flutter/build/build_python_3.12.9/python/lib/python3.12/shutil.py", line
498, in _copytree
os.makedirs(dst, exist_ok=dirs_exist_ok)
File "<frozen os>", line 225, in makedirs
OSError: [Errno 28] No space left on device:
'/home/work/flet-build-test/build/site-packages/flet-0.80.5.dist-info'
[16:15:51] Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.38.7, on Arch Linux 6.18.9-zen1-2-zen, locale en_US.UTF-8)
! The flutter binary is not on your path. Consider adding /home/work/flutter/3.38.7/bin to your path.
! The dart binary is not on your path. Consider adding /home/work/flutter/3.38.7/bin to your path.
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/linux-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
! Unable to access driver information using 'eglinfo'.
It is likely available from your distribution (e.g.: apt install mesa-utils)
[✓] Connected device (1 available)
[✓] Network resources
! Doctor found issues in 3 categories.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Error building Flet app - see the log of failed command above. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fields✅ Done
Activity
bekemax commentedon Jul 4, 2026
Same issue, Ubuntu 26.04, Flet 0.85.3, Flutter 3.41.7
jnsh commentedon Jul 6, 2026
As a workaround, you can patch the build files with this:
Run
flet build linuxonce to generate the build files and apply the patch once the build fails. After that re-building works for me.FeodorFitsner commentedon Jul 6, 2026
Flet 0.86.0 doesn't have this bug as Python runtime management moved to a separate library.
ndonkoHenri commentedon Sep 12, 2026
Closing — this was fixed in Flet 0.86.0.
Why it appeared out of nowhere
The trigger wasn't Flet, it was glibc 2.43.
pyconfig.hdefines_POSIX_C_SOURCEand_XOPEN_SOURCEunguarded, and up to glibc 2.42 it defined them to exactly the values glibc's ownfeatures.huses — so the redefinition was token-identical and the preprocessor said nothing. glibc 2.43 raised them:_POSIX_C_SOURCE_XOPEN_SOURCE200809L700202405L800(glibc commit
a5cc3018f31a, "Add feature test macros for POSIX.1-2024".)From that point the redefinition genuinely differs,
-Wmacro-redefinedfires, and the-Werrorin the Flutter Linux runner turns it into a build failure. It's-Werrordoing the promoting, not clang specifically — GCC fails the same way.That also explains the timing and who was hit. @jnsh — Arch shipped
glibc 2.43+r5on 2026-02-09, one week before you filed this, and the package before it (26 Jan) still had the old values. That matches your "I have been able to build successfully with Flet 0.80.* series before": same Flet, new glibc. @bekemax — Ubuntu 26.04 also ships 2.43. Anyone on glibc ≤ 2.42 (Ubuntu 24.04, our CI) never saw it, which is why this looked so sporadic.The Flet-side precondition was
serious_python_linux <= 2.0.0: its GTK plugin did#include <Python.h>after<gtk/gtk.h>had already pulled infeatures.h, with the extracted CPython headers on the include path — hencebuild/linux/x64/release/python/include/python3.12/pyconfig.hin the error.What fixed it
flet-dev/serious-python#209 removed both the
#include <Python.h>and the CPython include directory from the Linux plugin — the Python lifecycle now lives in a prebuiltlibdart_bridge.so. That shipped asserious_python_linux3.0.0 and reached Flet in #6601.Nothing in a stock
flet build linuxcompiles against CPython headers any more, so the header is never reached on any glibc. The released pins go straight fromserious_python1.0.1 (v0.85.3, affected) to 4.3.2 (v0.86.0, clean), which makes 0.86.0 a clean boundary. Confirmed by inspection on 0.86.5, 1.0.0.dev2 andmain.If you're on 0.85.3 or older
The fix can't be backported — those releases resolve their build template by version, and their
serious_pythonconstraint can't reach the fixed release. Locally, either:export CXXFLAGS="-Wno-macro-redefined", thenflet cleanand rebuild (CMake caches the flags at first configure, so the clean matters). This is what @lepolvonopticon suggested and @Sarwarhridoy4 confirmed in bug: Linux build fails in Flet 0.85.0 due to embedded Python 3.12 (-Werror macro redefinition) #6495, which was the same bug.#ifndefpatch above.One caveat worth recording
The fix is that nothing compiles the header any more, not that the header was fixed.
pyconfig.hstill ships with the unguarded defines and the Linux template still applies-Werrorto every plugin target, so a third-party Flet extension whose Linux plugin embeds CPython can still hit this on glibc ≥ 2.43 —-Wno-macro-redefinedis the answer there too.Thanks @jnsh for the precise patch, and @bekemax for the second data point. If anyone still sees this on 0.86.5+ after a
flet clean, comment here and I'll reopen.