I was trying to compile latest version of ‘tar‘ (version 1.28) from source. The ./configure script exited with an error message as “error: you should not run configure as root“. As suggested in the error, I quit from ‘root‘ user and executed the configure script as unprivileged user. The error went off, but during ‘make‘, the build exited with an error message as ‘Dwarf Error: found dwarf version ‘4’, this reader only handles version 2 information‘. I did googled around for the solution, but nothing worked.
Below is the complete error message:
# ./configure
The above command went through without any error. Below is the error message during ‘make’.
# make :::::::::::::::::::: /usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information. ../gnu/libgnu.a(argp-fmtstream.o): In function `realpath': argp-fmtstream.c:(.text+0x0): multiple definition of `realpath' rmt.o:rmt.c:(.text+0x5d0): first defined here ../gnu/libgnu.a(argp-fmtstream.o): In function `ptsname_r': argp-fmtstream.c:(.text+0x10): multiple definition of `ptsname_r' rmt.o:rmt.c:(.text+0x5e0): first defined here ../gnu/libgnu.a(argp-fmtstream.o): In function `wctomb': argp-fmtstream.c:(.text+0x20): multiple definition of `wctomb' rmt.o:rmt.c:(.text+0x5f0): first defined here ../gnu/libgnu.a(argp-fmtstream.o): In function `mbstowcs': argp-fmtstream.c:(.text+0x30): multiple definition of `mbstowcs' rmt.o:rmt.c:(.text+0x600): first defined here ::::::::::::::::::::::::::::
Can you help me to solve this error?
Solution:
You can tell the compiler via CFLAGS to not emit DWARF4 info with ‘-gdwarf-2 -gstrict-dwarf‘
Set CFLAGS as below:
# export CFLAGS='-gdwarf-2 -gstrict-dwarf'
Make clean the previous build as below:
# make clean
Execute ./configure script again:
# ./ configure
Make:
# make
Install:
# sudo make install
$ /usr/local/bin/tar --version tar (GNU tar) 1.28
Now the ‘tar’ is installed successfully.