Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Monthly Archives: February 2022

Fedora Packaging: resolving /usr/bin/../bin/../lib/bfd-plugins/LLVMgold.so: wrong ELF class: ELFCLASS32

When I provide an update to barrier-2.4.0, I encountered:

/usr/bin/../bin/../lib/bfd-plugins/LLVMgold.so: wrong ELF class: ELFCLASS32

Barrier uses CMake to build. It called ar and ranlib during the build, however, wrong plugins was invoked and caused the above error.

While the above error can be avoided by adding option --plugin , however, CMake does not have an easy way to do that. Fortunately, gcc provides gcc-ar and gcc-ranlib wrappers that point to the correct plugins. So I inserted the commands that point to gcc-ar and gcc-ranlib in the section %prep with:

sed -i.use-gcc-ar -e '/include (CheckIncludeFiles)/ i set(CMAKE_AR "/usr/bin/gcc-ar")' CMakeLists.txt
sed -i.use-gcc-ranlib -e '/include (CheckIncludeFiles)/ i set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")' CMakeLists.txt

The build worked.