Error while compiling with Windows GNU toolchain

Hi rustaceans.

I am trying to compile my project using the toolchain nightly-x86_64-pc-windows-gnu but I am hitting some GNU assembler errors: 'File too big' and too many sections (42346).

I am trying to compile in Windows 10 64bit, using version gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0.

Here's the relevant compilation error. Interesting part is around cargo:warning= lines.

Error
The following warnings were emitted during compilation:

warning: In file included from harfbuzz/src/harfbuzz.cc:5:
warning: harfbuzz/src/hb-buffer.cc: In member function 'bool hb_buffer_t::message_impl(hb_font_t*, const char*, va_list)':
warning: harfbuzz/src/hb-buffer.cc:2032:40: warning: function 'bool hb_buffer_t::message_impl(hb_font_t*, const char*, va_list)' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
warning:    vsnprintf (buf, sizeof (buf), fmt, ap);
warning:                                         ^
warning: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: C:\Users\mainuser\projects\mgk\target\debug\build\harfbuzz-sys-ff8cb6e08920632a\out\harfbuzz/src/harfbuzz.o: too many sections (42346)
warning: C:\Users\mainuser\AppData\Local\Temp\ccrEIUSW.s: Assembler messages:
warning: C:\Users\mainuser\AppData\Local\Temp\ccrEIUSW.s: Fatal error: can't write 47 bytes to section .text$_ZSt4ceilf of C:\Users\mainuser\projects\mgk\target\debug\build\harfbuzz-sys-ff8cb6e08920632a\out\harfbuzz/src/harfbuzz.o: 'File too big'
warning: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: C:\Users\mainuser\projects\mgk\target\debug\build\harfbuzz-sys-ff8cb6e08920632a\out\harfbuzz/src/harfbuzz.o: too many sections (42346)
warning: C:\Users\mainuser\AppData\Local\Temp\ccrEIUSW.s: Fatal error: can't close C:\Users\mainuser\projects\mgk\target\debug\build\harfbuzz-sys-ff8cb6e08920632a\out\harfbuzz/src/harfbuzz.o: File too big

error: failed to run custom build command for `harfbuzz-sys v0.3.4`

Caused by:
process didn't exit successfully: `C:\Users\mainuser\projects\mgk\target\debug\build\harfbuzz-sys-e96a8169db76b88e\build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=HARFBUZZ_SYS_NO_PKG_CONFIG
cargo:rerun-if-env-changed=HARFBUZZ_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=HARFBUZZ_STATIC
cargo:rerun-if-env-changed=HARFBUZZ_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
TARGET = Some("x86_64-pc-windows-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-pc-windows-gnu")
CXX_x86_64-pc-windows-gnu = None
CXX_x86_64_pc_windows_gnu = None
HOST_CXX = None
CXX = None
CXXFLAGS_x86_64-pc-windows-gnu = None
CXXFLAGS_x86_64_pc_windows_gnu = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,mmx,sse,sse2")
running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-std=c++11" "-o" "C:\\Users\\mainuser\\projects\\mgk\\target\\debug\\build\\harfbuzz-sys-ff8cb6e08920632a\\out\\harfbuzz/src/harfbuzz.o" "-c" "harfbuzz/src/harfbuzz.cc"
cargo:warning=In file included from harfbuzz/src/harfbuzz.cc:5:
cargo:warning=harfbuzz/src/hb-buffer.cc: In member function 'bool hb_buffer_t::message_impl(hb_font_t*, const char*, va_list)':
cargo:warning=harfbuzz/src/hb-buffer.cc:2032:40: warning: function 'bool hb_buffer_t::message_impl(hb_font_t*, const char*, va_list)' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
cargo:warning=   vsnprintf (buf, sizeof (buf), fmt, ap);
cargo:warning=                                        ^
cargo:warning=C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: C:\Users\mainuser\projects\mgk\target\debug\build\harfbuzz-sys-ff8cb6e08920632a\out\harfbuzz/src/harfbuzz.o: too many sections (42346)
cargo:warning=C:\Users\mainuser\AppData\Local\Temp\ccrEIUSW.s: Assembler messages:
cargo:warning=C:\Users\mainuser\AppData\Local\Temp\ccrEIUSW.s: Fatal error: can't write 47 bytes to section .text$_ZSt4ceilf of C:\Users\mainuser\projects\mgk\target\debug\build\harfbuzz-sys-ff8cb6e08920632a\out\harfbuzz/src/harfbuzz.o: 'File too big'
cargo:warning=C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: C:\Users\mainuser\projects\mgk\target\debug\build\harfbuzz-sys-ff8cb6e08920632a\out\harfbuzz/src/harfbuzz.o: too many sections (42346)
cargo:warning=C:\Users\mainuser\AppData\Local\Temp\ccrEIUSW.s: Fatal error: can't close C:\Users\mainuser\projects\mgk\target\debug\build\harfbuzz-sys-ff8cb6e08920632a\out\harfbuzz/src/harfbuzz.o: File too big
exit code: 1

--- stderr


error occurred: Command "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-std=c++11" "-o" "C:\\Users\\mainuser\\projects\\mgk\\target\\debug\\build\\harfbuzz-sys-ff8cb6e08920632a\\out\\harfbuzz/src/harfbuzz.o" "-c" "harfbuzz/src/harfbuzz.cc" with args "g++.exe" did not execute successfully (status code exit code: 1).



Process finished with exit code 101

Seems there's a solution available:


But no idea how to enable that option when targeting nightly-x86_64-pc-windows-gnu

How can I overcome this issue?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.