qmk / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
18.02k stars 38.74k forks source link

[Bug] Building fails if lang environment variable is not `en_US.UTF-8` #9357

Closed krautcat closed 2 years ago

krautcat commented 4 years ago

Describe the Bug

I don't know whether it is documented or not, whether it is bug or not but. QMK building fails if I have LANG environment variable not set to en_US.UTF-8.

System Information

Additional Context

I have LANG envvar setted to ru_RU.UTF-8. When I try to build firmware for Iris with any keymap (even from upstream), build fails on linkage stage saying that .elf file is empty (if I build with dirty .build directory) or buffer overflow detected (clean build). Yes, it is really empty, and linkage than fails. Object files are generated. TBH, I didn't dig into build process of QMK, so I am just assuming error happens on linkage stage. Here is log with VERBOSE=True. It contains messages in Russian but they are not essential.

Log ``` Linking: .build/keebio_iris_rev2_krautcat.elf [ERRORS] | | collect2: фатальная ошибка: ld завершилась по сигналу 6 [Аварийный останов], core dumped | компиляция прервана. | *** buffer overflow detected ***: terminated | make[1]: *** [tmk_core/rules.mk:306: .build/keebio_iris_rev2_krautcat.elf] Ошибка 1 if [ -f .//.build/error_occurred ]; then printf "\033[31;01mMake finished with errors\n\033[0m" & exit 1; fi; ```

When I try to build with LANG envvar set to en_US.UTF-8, firmware is building, no linkage errors here.

If you don't have any time for investigating the possible bug or it is expected behaviour, please let me know.

rmwphd commented 4 years ago

Does it fail iff LANG is not set to en_US.UTF-8 or does it fail iff LANG is set to ru_RU.UTF-8? Did you try with other encodings?

krautcat commented 4 years ago

I haven't tried any other encodings, or, to be more correct, any other values of this environment variables. Tbh, I set it to the en_US.UTF-8 just to get more meaningful message when linkage fails but apparently this also fixed whole build process.

I will try different locales. Then I will try to unset only LANG envvar without touching the LC_* envvars (they override LANG values for different aspects of localization). Finally, I will try to build with all variables unset.

teuchezh commented 2 years ago

Same issue, command export LANG=en_US.UTF-8 before compile fix the problem.

sigprof commented 2 years ago

Most likely this is a bug in binutils that was fixed upstream back in 2017: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=1273da0414a2f2a31288749a17fe44cbef615ab5 However, Debian and Ubuntu use the Atmel/Microchip-provided version of the AVR toolchain, which has some useful changes (extra AVR-specific options to avr-size, RAM overflow check according to the selected MCU model, maybe more), but is based on some really old versions of gcc and binutils.

zvecr commented 2 years ago

This issue has been automatically closed because it has not had any recent activity. If this issue is still valid, re-open the issue and let us know.