gcc fatal error: '-fuse-linker-plugin', but liblto_plug - Page 1
Forum section: electronics / general

author: DiTBho
author_rank: Super Contributor
timestamp: January 02, 2023, 04:35:39 pm
content: I'm trying to build a custom toolchain, more or less, except this oneCode:elf-gcc: fatal error: '-fuse-linker-plugin', but liblto_plugin.so not founddoes anyone by any chance know what is this error related to? and how to workaround it?

author: DiTBho
author_rank: Super Contributor
timestamp: January 02, 2023, 04:37:17 pm
content: gcc-v9.3.0baremetal

author: DiTBho
author_rank: Super Contributor
timestamp: January 02, 2023, 05:07:32 pm
content: it appears that one of these flags is causing the errorCode:gcc-elf \-fleading-underscore \-Wa,--register-prefix-optional \-fno-reorder-functions \-DELF_TOOLCHAIN \-fomit-frame-pointer \-fno-common \-Wall \-Werror=undef \-Werror=missing-prototypes \-Werror=strict-prototypes \-Werror=implicit-function-declaration \-Werror=format \-Werror=redundant-decls \-Werror=format-extra-args \-Werror=old-style-definition \-Werror=type-limits \-DWITH_AES=1 \-DWITH_CLI=1 \....interesting

author: grumpydoc
author_rank: Super Contributor
timestamp: January 02, 2023, 05:11:30 pm
content: Previously (though briefly) discussed:https://www.eevblog.com/forum/microcontrollers/arm-none-eabi-g-error-fuse-linker-plugin-but-liblto_plugin-so-not-found/Possible gcc installation problem?

author: DiTBho
author_rank: Super Contributor
timestamp: January 02, 2023, 05:27:25 pm
content: Quote from: grumpydoc on January 02, 2023, 05:11:30 pmI am making a custom minimal toolchain builderCode:C3750 /projects/devchain-baremetal-2023/mybuilder# ./mybuild info allBC success: m6811-elf, binutils v2.23, gcc v3.3.6-s12x, mini modeBC success: m68k-elf, binutils v2.34, gcc v9.3.0, mini modeBC success: m88k-coff, binutils v2.16.1, gcc v3.1.1, mini modeBC success: mips-elf, binutils v2.24, gcc v9.3.0, mini modeBC success: mips64-elf, binutils v2.24, gcc v9.3.0, mini modeBC success: powerpc-elf, binutils v2.24, gcc v9.3.0, mini modeBC success: powerpc-eabi, binutils v2.24, gcc v9.3.0, mini modeBC success: arm-eabi, binutils v2.24, gcc v9.3.0, mini modeBC success: sh2-elf, binutils v2.24, gcc v9.3.0, mini modeBC success: riscv32-elf, binutils v2.39, gcc v9.3.0, mini modeBC success: hppa-unknown-linux-gnu, binutils v2.24, gcc v9.3.0, mini modemini mode means that only these files are installedCode:/usr/idp/bin/$arch-addr2line/usr/idp/bin/$arch-ar/usr/idp/bin/$arch-as/usr/idp/bin/$arch-cc1/usr/idp/bin/$arch-cpp/usr/idp/bin/$arch-gcc/usr/idp/bin/$arch-gcov/usr/idp/bin/$arch-ld/usr/idp/bin/$arch-nm/usr/idp/bin/$arch-objcopy/usr/idp/bin/$arch-objdump/usr/idp/bin/$arch-protoize/usr/idp/bin/$arch-ranlib/usr/idp/bin/$arch-readelf/usr/idp/bin/$arch-size/usr/idp/bin/$arch-strings/usr/idp/bin/$arch-strip/usr/idp/bin/$arch-unprotoizeThe binutils and gcc sources have been hacked and patched to have cc1 in the wished place.All the minimal (gcc -S, gcc -c, link with minimal link script) test-benches passCode:C3750 /projects/devchain-baremetal-2023/mybuilder test alltesting m6811-elf-gcc ... successtesting m68k-elf-gcc ... successtesting m88k-coff-gcc ... successtesting mips-elf-gcc ... successtesting mips64-elf-gcc ... successtesting powerpc-elf-gcc ... successtesting powerpc-eabi-gcc ... successtesting arm-eabi-gcc ... successtesting sh2-elf-gcc ... successtesting riscv32-elf-gcc ... successtesting hppa-unknown-linux-gnu-gcc ... successEssentially this stuff is able to compile a simple bootloader written in C, but not a complex project like an Operating System.I still have to understand the above error, because, essentially, -fuse-linker-plugin "should be" no longer necessary.Quote(fromhere, stackoverflow.com, questions#15606993)

author: DiTBho
author_rank: Super Contributor
timestamp: January 02, 2023, 05:38:49 pm
content: Passing this flag to gcc seems to fix the problemCode:-fno-use-linker-pluginBut I feel I'd better re-configure Binutils and Gcc to disable LTOQuoteCode:C3750 /projects/devchain-baremetal-2023/mybuilder show profile/gcc/9.3.0/configure.bootstrap--without-newlib--disable-multilib--enable-languages=c--without-header--disable-shared--disable-threads--with-system-zlib--enable-tls--disable-libatomic--disable-libmudflap--disable-libssp--disable-libquadmath--disable-libgomp--disable-nls--disable-bootstrapDunno, I will try

author: DiTBho
author_rank: Super Contributor
timestamp: January 02, 2023, 05:41:55 pm
content: Code:--enable-lto--disable-ltoEnable support for link-time optimization (LTO). This is enabled by default, and may be disabled using --disable-lto.--enable-linker-plugin-configure-flags=FLAGS--enable-linker-plugin-flags=FLAGSBy default, linker plugins (such as the LTO plugin) are built for the host system architecture. For the case that the linker has a different (but run-time compatible) architecture, these flags can be specified to build plugins that are compatible to the linker. For example, if you are building GCC for a 64-bit x86_64 (‘x86_64-pc-linux-gnu’) host system, but have a 32-bit x86 GNU/Linux (‘i686-pc-linux-gnu’) linker executable (which is executable on the former system), you can configure GCC as follows for getting compatible linker plugins:% srcdir/configure \--host=x86_64-pc-linux-gnu \--enable-linker-plugin-configure-flags=--host=i686-pc-linux-gnu \--enable-linker-plugin-flags='CC=gcc\ -m32\ -Wl,-rpath,[...]/i686-pc-linux-gnu/lib'--with-plugin-ld=pathnameEnable an alternate linker to be used at link-time optimization (LTO) link time when -fuse-linker-plugin is enabled. This linker should have plugin support such as gold starting with version 2.20 or GNU ld starting with version 2.21. See -fuse-linker-plugin for details.(fromhere, Gcc configure)

author: DiTBho
author_rank: Super Contributor
timestamp: January 02, 2023, 06:52:29 pm
content: gccre-configuredre-compilednow it works