[OpenSIPS-Devel] [OpenSIPS/opensips] 97baf8: Explicitly add fPIC and DPIC for gcc

Peter Lemenkov noreply at github.com
Tue Apr 12 07:19:11 UTC 2022


  Branch: refs/heads/3.1
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 97baf8192ed960f477f4fc9aa150992b22226118
      https://github.com/OpenSIPS/opensips/commit/97baf8192ed960f477f4fc9aa150992b22226118
  Author: Peter Lemenkov <lemenkov at gmail.com>
  Date:   2022-04-12 (Tue, 12 Apr 2022)

  Changed paths:
    M Makefile.defs

  Log Message:
  -----------
  Explicitly add fPIC and DPIC for gcc

This addresses linking on Fedora 34 and later with gcc 11:

```
gcc -shared -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld  -Wl,-O2 -Wl,-E   alarm_checks.o hashTable.o interprocess_buffer.o openserMIBNotifications.o openserObjects.o openserSIPCommonObjects.o openserSIPContactTable.o openserSIPMethodSupportedTable.o openserSIPPortTable.o openserSIPRegUserLookupTable.o openserSIPRegUserTable.o openserSIPServerObjects.o openserSIPStatusCodesTable.o snmpstats.o sub_agent.o utilities.o  -L/usr/lib64 -lnetsnmpmibs -lnetsnmpagent -lnetsnmp -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -lm -lsensors -ldl -lm -lrpm -lrpmio -Wl,--enable-new-dtags -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -lm -lssl -lssl -lcrypto  -o snmpstats.so
/usr/bin/ld: /tmp/cccfDV1K.ltrans0.ltrans.o: warning: relocation against `event_shm_threshold' in read-only section `.text'
/usr/bin/ld: /tmp/cccfDV1K.ltrans0.ltrans.o: relocation R_X86_64_PC32 against undefined symbol `ctime_buf' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[1]: Leaving directory '/builddir/build/BUILD/opensips-3.1.7/modules/snmpstats'
make[1]: *** [../../Makefile.rules:39: snmpstats.so] Error 1
make: *** [Makefile:197: modules] Error 2
```

Closes #2734.

Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>
(cherry picked from commit 0896f9a46700005a304a65ddf7e09419a3963b82)





More information about the Devel mailing list