From: Petr Štetiar Date: Fri, 26 May 2023 11:08:06 +0000 (+0200) Subject: pcre2: fix host compilation of libselinux by enabling PIC X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=12494f5b8a7bb48cbf7b2fba7d17a53981173120;p=openwrt%2Fstaging%2Fhauke.git pcre2: fix host compilation of libselinux by enabling PIC libselinux-3.5 fails to compile in Fedora 38 container due to the following: cc -O2 -I/openwrt/staging_dir/host/include -I/openwrt/staging_dir/hostpkg/include -I/openwrt/staging_dir/target-x86_64_musl/host/include -I../include -D_GNU_SOURCE -DNO_ANDROID_BACKEND -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -I/openwrt/staging_dir/hostpkg/include -L/openwrt/staging_dir/host/lib -L/openwrt/staging_dir/hostpkg/lib -L/openwrt/staging_dir/target-x86_64_musl/host/lib -Wl,-rpath=/openwrt/staging_dir/hostpkg/lib -shared -o libselinux.so.1 avc.lo avc_internal.lo avc_sidtab.lo booleans.lo callbacks.lo canonicalize_context.lo checkAccess.lo check_context.lo checkreqprot.lo compute_av.lo compute_create.lo compute_member.lo compute_relabel.lo compute_user.lo context.lo deny_unknown.lo disable.lo enabled.lo fgetfilecon.lo freecon.lo freeconary.lo fsetfilecon.lo get_context_list.lo get_default_type.lo get_initial_context.lo getenforce.lo getfilecon.lo getpeercon.lo init.lo is_customizable_type.lo label.lo label_db.lo label_file.lo label_media.lo label_support.lo label_x.lo lgetfilecon.lo load_policy.lo lsetfilecon.lo mapping.lo matchmediacon.lo matchpathcon.lo policyvers.lo procattr.lo query_user_context.lo regex.lo reject_unknown.lo selinux_check_securetty_context.lo selinux_config.lo selinux_internal.lo selinux_restorecon.lo sestatus.lo setenforce.lo setexecfilecon.lo setfilecon.lo setrans_client.lo seusers.lo sha1.lo stringrep.lo validatetrans.lo -L/openwrt/staging_dir/hostpkg/lib -lpcre2-8 -lfts -ldl -Wl,-soname,libselinux.so.1,--version-script=libselinux.map,-z,defs,-z,relro /usr/bin/ld: /openwrt/staging_dir/hostpkg/lib/libpcre2-8.a(pcre2_compile.c.o): relocation R_X86_64_32S against symbol `_pcre2_ucd_stage1_8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: failed to set dynamic section sizes: bad value So lets fix it by enabling build of host static library with the position independent code option enabled. Signed-off-by: Petr Štetiar --- diff --git a/package/libs/pcre2/Makefile b/package/libs/pcre2/Makefile index d178e3cd04..fa4282cee8 100644 --- a/package/libs/pcre2/Makefile +++ b/package/libs/pcre2/Makefile @@ -66,7 +66,8 @@ CMAKE_HOST_OPTIONS += \ -DPCRE2_SUPPORT_JIT=OFF \ -DPCRE2_SHOW_REPORT=OFF \ -DPCRE2_BUILD_PCRE2GREP=OFF \ - -DPCRE2_BUILD_TESTS=OFF + -DPCRE2_BUILD_TESTS=OFF \ + -DPCRE2_STATIC_PIC=ON CMAKE_OPTIONS += \ -DBUILD_SHARED_LIBS=ON \