From 9a27792ebb8db1805dc62e433652d9b652e97b81 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Thu, 28 Nov 2019 16:09:56 +0100 Subject: [PATCH] Add -fPIC for static objects Adding the -fPIC also for static objects, so it can be used in builds with shared libraries. There's old guide (draft) for Fedora (only one I could find): https://fedoraproject.org/wiki/User:Ajax/Static_Library_PICness_Guidelines saying: Packages that install static library archives (.a files) must do exactly one of: - build them as PIC objects - document why the static libraries are not built PIC AND receive explicit approval from FESCo. - build both PIC and non-PIC libraries, with a .pc file for each for dependent packages to use If we ever want/need nonpic archive, we will go with 3rd option above, for now just enabling fPIC in libbpf.a --- libbpf.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbpf.spec b/libbpf.spec index adce2d7..27ae421 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -39,7 +39,7 @@ Requires: %{name}-devel = 2:%{version}-%{release} The %{name}-static package contains static library for developing applications that use %{name} -%global make_flags DESTDIR=%{buildroot} OBJDIR=%{_builddir} CFLAGS="%{build_cflags}" LDFLAGS="%{build_ldflags} -Wl,--no-as-needed" LIBDIR=/%{_libdir} NO_PKG_CONFIG=1 +%global make_flags DESTDIR=%{buildroot} OBJDIR=%{_builddir} CFLAGS="%{build_cflags} -fPIC" LDFLAGS="%{build_ldflags} -Wl,--no-as-needed" LIBDIR=/%{_libdir} NO_PKG_CONFIG=1 %prep %autosetup -n %{githubfull}