> The compiler flags Fedora sets are not compatible with Clang without > you doing filtering. Unfortunately, Clang hasn't been very good at > implementing some of the security features that we rely on in Fedora > from the system compiler, and it also does not support the specs we > pass to force certain build and link behaviors. Finally, of course it > doesn't support annobin. > > The specific flags enabled are documented here: > https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/buildflags.md Thanks for sharing the info. I confirmed that the following commands worked by filtering %optflags. ``` optflags_clang=$(echo "%{optflags}" | sed -e 's| -fstack-clash-protection||' -e 's| -specs=[^ ]*||g') CC=clang CXX=clang++ cmake .. \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DCMAKE_C_FLAGS="${optflags_clang}" \ -DCMAKE_CXX_FLAGS="${optflags_clang}" %make_build ``` What do you think about adding the following macros in rpms/redhat-rpm-config? I think it's useful for people who want to build their RPM package not by gcc but for some reasons. rpms/ruby might be the case to build with clang near feature, because gcc's PIE is not compatible with Ruby's just-in-time (JIT) feature using pre-compiler-header (PCH) [1]. ``` %{build_clang_cflags} %{build_clang_cxxflags} %{clang_optflags} ``` [1] https://bugzilla.redhat.com/show_bug.cgi?id=1721553#c34 -- Jun | He - His - Him _______________________________________________ packaging mailing list -- packaging@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to packaging-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/packaging@xxxxxxxxxxxxxxxxxxxxxxx