I was trying to upgrade Exim to 4.98 from 4.97 (with a standard "da build exim" command), and somehow the compilation on Oracle Linux 8.10 failed with the following repeated errors:
- relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
- relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
- relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
- relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
[root@myserver custom]# da build exim
download_cached: using cached '/usr/local/directadmin/custombuild/cache/exim-4.98.2.tar.gz' file
Compiling exim...
/bin/sh scripts/source_checks
>>> Creating links to source files...
>>> Creating lookups/Makefile for building dynamic modules
>>> New Makefile & lookups/Makefile installed
>>> Use "make makefile" if you need to force rebuilding of the makefile
make[1]: warning: -j4 forced in submake: resetting jobserver mode.
make[1]: Entering directory '/usr/local/directadmin/custombuild/tmp/tmp.PdNlP96QuO.exim-4.98.2.tar.gz/build-Linux-x86_64'
/bin/sh ../scripts/Configure-os.c
cc buildconfig.c
/bin/sh ../scripts/Configure-os.h
cc exim_lock.c
cc -o exim_lock
>>> exim_lock utility built
/bin/sh ../scripts/Configure-config.h "make"
make[2]: Entering directory '/usr/local/directadmin/custombuild/tmp/tmp.PdNlP96QuO.exim-4.98.2.tar.gz/build-Linux-x86_64'
make[2]: 'buildconfig' is up to date.
make[2]: Leaving directory '/usr/local/directadmin/custombuild/tmp/tmp.PdNlP96QuO.exim-4.98.2.tar.gz/build-Linux-x86_64'
Building configuration file config.h
>>> config.h built
cc -DMACRO_PREDEF macro_predef.c
cc -DMACRO_PREDEF readconf.c
cc -DMACRO_PREDEF globals.c
cc -DMACRO_PREDEF expand.c
cc -DMACRO_PREDEF route.c
cc -DMACRO_PREDEF transport.c
cc -DMACRO_PREDEF drtables.c
cc -DMACRO_PREDEF acl.c
cc -DMACRO_PREDEF tls.c
cc -DMACRO_PREDEF transports/appendfile.c
cc -DMACRO_PREDEF transports/autoreply.c
cc -DMACRO_PREDEF transports/lmtp.c
cc -DMACRO_PREDEF transports/pipe.c
cc -DMACRO_PREDEF transports/queuefile.c
cc -DMACRO_PREDEF transports/smtp.c
cc -DMACRO_PREDEF routers/accept.c
cc -DMACRO_PREDEF routers/dnslookup.c
cc -DMACRO_PREDEF routers/ipliteral.c
cc -DMACRO_PREDEF routers/iplookup.c
cc -DMACRO_PREDEF routers/manualroute.c
cc -DMACRO_PREDEF routers/queryprogram.c
cc -DMACRO_PREDEF routers/redirect.c
cc -DMACRO_PREDEF auths/auth-spa.c
cc -DMACRO_PREDEF auths/cram_md5.c
cc -DMACRO_PREDEF auths/cyrus_sasl.c
cc -DMACRO_PREDEF auths/dovecot.c
cc -DMACRO_PREDEF auths/gsasl_exim.c
cc -DMACRO_PREDEF auths/heimdal_gssapi.c
cc -DMACRO_PREDEF auths/plaintext.c
cc -DMACRO_PREDEF auths/spa.c
cc -DMACRO_PREDEF auths/tls.c
cc -DMACRO_PREDEF auths/external.c
cc -DMACRO_PREDEF dkim.c
cc -DMACRO_PREDEF malware.c
cc -DMACRO_PREDEF pdkim/signing.c
cc exim_dbmbuild.c
....
....
cc lookups/lf_sqlperform.c
cc local_scan.c
ar cq transports.a
ranlib transports.a
make[2]: Leaving directory '/usr/local/directadmin/custombuild/tmp/tmp.PdNlP96QuO.exim-4.98.2.tar.gz/build-Linux-x86_64/transports'
cc -o exim
/usr/bin/ld: acl.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: base64.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: child.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: crypt16.o: relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: daemon.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: dbfn.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: debug.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: deliver.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: directory.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: dns.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: drtables.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: enq.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: exim.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: expand.o: relocation R_X86_64_32S against undefined symbol `expand_nstring' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: filter.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: filtertest.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: dkim.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: dkim_transport.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: dnsbl.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: hash.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: header.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: host.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ip.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: log.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lss.o: relocation R_X86_64_32 against symbol `domainlist_anchor' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: match.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: moan.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: os.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: parse.o: relocation R_X86_64_32S against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: priv.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: queue.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: rda.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: readconf.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: receive.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: retry.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: rewrite.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: rfc2047.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: regex_cache.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: route.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: search.o: relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: sieve.o: relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: smtp_in.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: smtp_out.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: spool_in.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: spool_out.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: std-crypto.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: store.o: relocation R_X86_64_32 against undefined symbol `paired_pools' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: string.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: tls.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: tod.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: transport.o: relocation R_X86_64_32S against symbol `optionlist_transports' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: tree.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: verify.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: environment.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lookups/lf_quote.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lookups/lf_check_file.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lookups/lf_sqlperform.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: malware.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: mime.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: regex.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: spam.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: spool_mbox.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: dane.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: spf.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: version.o: relocation R_X86_64_32S against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(accept.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(dnslookup.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(ipliteral.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(manualroute.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(queryprogram.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(redirect.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(rf_change_domain.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(rf_expand_data.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(rf_get_errors_address.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(rf_get_munge_headers.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(rf_get_transport.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(rf_get_ugid.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(rf_lookup_hostlist.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(rf_queue_add.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: routers/routers.a(rf_self_action.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: transports/transports.a(appendfile.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: transports/transports.a(autoreply.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: transports/transports.a(lmtp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: transports/transports.a(pipe.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: transports/transports.a(smtp.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: transports/transports.a(tf_maildir.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lookups/lookups.a(cdb.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lookups/lookups.a(dbmdb.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lookups/lookups.a(dnsdb.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lookups/lookups.a(lsearch.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lookups/lookups.a(spf.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: lookups/lookups.a(readsock.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(cram_md5.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(dovecot.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(get_data.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(get_no64_data.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(plaintext.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(spa.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(xtextdecode.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(xtextencode.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(auth-spa.o): relocation R_X86_64_32S against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: auths/auths.a(check_serv_cond.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: pdkim/pdkim.a(pdkim.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: pdkim/pdkim.a(signing.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:687: exim] Error 1
make[1]: Leaving directory '/usr/local/directadmin/custombuild/tmp/tmp.PdNlP96QuO.exim-4.98.2.tar.gz/build-Linux-x86_64'
make: *** [Makefile:37: all] Error 2
doExim: failed to compile '/usr/local/directadmin/custombuild/cache/exim-4.98.2.tar.gz' inside '/usr/local/directadmin/custombuild/tmp/tmp.PdNlP96QuO.exim-4.98.2.tar.gz'
failed to compile exim 4.98.2
The solution is to customize the Makefile as per ">https://docs.directadmin.com/other-hosting-services/exim/configuring-exim.html#how-to-compile-exim-from-source
cd /usr/local/directadmin/custombuild
mkdir -p custom/exim/
cp configure/exim/Makefile custom/exim/Makefile
then edit the Makefile in /usr/local/directadmin/custombuild/custom/exim
[root@myserver exim]# pwd
/usr/local/directadmin/custombuild/custom/exim
[root@server1 exim]# ls -la
total 76
drwxr-xr-x 2 root root 4096 Apr 17 12:06 .
drwxr-xr-x 5 root root 4096 Apr 17 11:41 ..
-rw-r--r-- 1 root root 69414 Apr 17 11:44 Makefile
Add the following line "CFLAGS += -fstack-protector-strong -fPIC" to the Makefile:
...
...
# DISABLE_CLIENT_CMD_LOG=yes
# End of EDITME for Exim 4.
CFLAGS += -fstack-protector-strong -fPIC
then re-run "da build exim" and you should be good :)