Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling perl Net::Interface module on CentOS 8.1 fails

Tags:

perl

centos8

I download the sources and manually tried to compile the perl Net::Interface module. Using CPAN to install the module gives the same error.

wget http://search.cpan.org/CPAN/authors/id/M/MI/MIKER/Net-Interface-1.016.tar.gz
tar xvfz Net-Interface-1.016.tar.gz
cd Net-Interface-1.016
perl Makefile.PL

Now this fails with the below error

checking for getnameinfo... yes
checking whether byte ordering is bigendian... no
checking for uint8_t... yes
checking size of uint8_t... configure: error: cannot compute sizeof (uint8_t)
See `config.log' for more details.
could not open config.h

config.log shows the below error

configure:10128: result: yes
configure:10135: checking size of uint8_t
configure:10437: gcc -o conftest -g -O2  -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -L/usr/local/lib  conftest.c  >&5
/usr/bin/ld: /tmp/ccXH6miX.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: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
configure:10440: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""

How can I fix this error? config.log seems to suggest to pass "-fPIC" flag but I am not sure how?

Thanks.

like image 497
sthustfo Avatar asked May 08 '26 11:05

sthustfo


1 Answers

/usr/bin/ld: /tmp/ccXH6miX.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: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

The configure script needs to be run with --enable-shared for some reason (it is not necessary on Ubuntu). The following worked for me in a docker container with CentOS 8:

./configure --enable-shared
perl -I. Makefile.PL
make
sudo make install
like image 70
Håkon Hægland Avatar answered May 11 '26 16:05

Håkon Hægland



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!