Build errors on 22.11

My builds which were successful in 22.10.1 are now failing during the pjproject configure script. I assume this is related to commit 9778364 but I’m not knowledgeable enough to know if it’s something I can/should resolve in my build environment.

A log excerpt from third-party/pjproject/source/config.log is below, the full log is at asterisk 22.11 pjproject aconfigure log - Pastebin.com

aconfigure:3779: $? = 0
aconfigure:3830: result: yes
aconfigure:3834: checking for C compiler default output file name
aconfigure:3836: result: a.out
aconfigure:3842: checking for suffix of executables
aconfigure:3849: gcc -o conftest -DPJ_HAS_LINUX_EPOLL=1  -m64 -Wl,--as-needed,--library-path=/usr/lib64 -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1    -lssl -lcrypto  conftest.c  >&5
aconfigure:3853: $? = 0
aconfigure:3877: result: 
aconfigure:3901: checking whether we are cross compiling
aconfigure:3909: gcc -o conftest -DPJ_HAS_LINUX_EPOLL=1  -m64 -Wl,--as-needed,--library-path=/usr/lib64 -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1    -lssl -lcrypto  conftest.c  >&5
/usr/bin/ld: /tmp/ccZR4uFH.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
aconfigure:3913: $? = 1
aconfigure:3920: ./conftest
./aconfigure: line 3922: ./conftest: No such file or directory
aconfigure:3924: $? = 127
aconfigure:3931: error: in '/root/rpmbuild/BUILD/asterisk-22.11.0/third-party/pjproject/source':
aconfigure:3933: error: cannot run C compiled programs.
If you meant to cross compile, use '--host'.
See 'config.log' for more details

We are building from a private fork of the EPEL RPM, so most of those flags (like -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1) are getting set automatically. The contents of /usr/lib/rpm/redhat/redhat-hardened-ld look like they might be related to the error in the log:

*self_spec:
+ %{!static:%{!shared:%{!r:-pie}}}

Contents of /usr/lib/rpm/redhat/redhat-annobin-cc1 are:

*cc1_options:
+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin}

22.10 aconfigure log file is here: asterisk 22.10 pjproject aconfigure log - Pastebin.com

Big difference with the flags that are passed to gcc (wrapped for readability)

22.10:

gcc -o conftest -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe \
-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS \
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong \
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic \
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection \
-Werror-implicit-function-declaration -DLUA_COMPAT_MODULE -fPIC -fPIC \
-Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function \
-Wno-strict-aliasing -pthread -O2 -flto=auto -ffat-lto-objects -fexceptions -g \
-grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 \
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 \
-march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection \
-fcf-protection -DLUA_COMPAT_MODULE -fPIC -U_FORTIFY_SOURCE \
-D_FORTIFY_SOURCE=2 -march=native -O3 -g3 -pthread -O2 -flto=auto -ffat-lto-objects \
-fexceptions -g -grecord-gcc-switches -pipe \
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong \
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic \
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DLUA_COMPAT_MODULE \
-fPIC -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -march=native -O3   -m64 \
-Wl,--as-needed,--library-path=/usr/lib64 -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now \
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1    -lssl -lcrypto  conftest.c  >&5

22.11:

gcc -o conftest -DPJ_HAS_LINUX_EPOLL=1  -m64 -Wl,--as-needed,--library-path=/usr/lib64 \
-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1    -lssl -lcrypto  conftest.c  >&5