Definite's Extractor

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

Tag Archives: rpm SPEC

Oneliner to extract CentOS Stream package source in dist-git repo

-While investigating the sources of RHEL and Fedora packages, firstly I switch to corresponding branch, then do either rhpkg prep or fedpkg prep to extract source.

Recently, I am interested in CentOS Stream 9, and wish to investigate the source. However, I am too lazy to find the fedpkg or rhpkg equivalent for CentOS Stream, and found the following command useful:

/bin/spectool -g $(basename $PWD).spec; /bin/rpmbuild --nodeps --define "_sourcedir $PWD" --define "_builddir $PWD" --define "_buildrootdir $PWD" -bp $(basename $PWD).spec

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.