Build issue with dbench
Facing error while building dbench stating "dbench.c:(.text+0x1cf5): undefined reference to `smb_ops'"
Steps to recreate the issue:-
NOTE: These steps are working fine as per older version. @sahlberg could you please validate these steps and feel free to add/modify the same, against the latest version of dbench that is after the changes got introduced in 8972faf6ea29b52ecd1664d315fdeed80aa50f60
`
cp -a loadfiles/.txt /usr/local/share/ ./autogen.sh ./configure CFLAGS=$(pkg-config --cflags smbclient) sed -i '/#include "nfs.h/a #include <stdint.h>' libnfs.c [[ -e '/usr/include/rpc/rpc.h' ]] || cp /usr/include/tirpc/ /usr/include/ -rf sed -i '/^LIBS=/ s/$/ -ltirpc/' Makefile make dbench `
following those above steps lead to this error below
`
/usr/bin/ld: dbench.o: warning: relocation against smb_ops' in read-only section .text'
/usr/bin/ld: dbench.o: in function main': dbench.c:(.text+0x1cf5): undefined reference to smb_ops'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make: *** [Makefile:390: dbench] Error 1
==> ERROR: A failure occurred in build().
Aborting...
Install dbench failed
`
My inference from further investigation for the root cause of this issue is that,
- The structure smb_ops was declared globally in smb.c file, but I see that smb.c is not included in the list of dbench dependencies in the Makefile for compilation.
- smb_ops is getting instantiated in dbench.c with appropiate extern keyword but still since smb.c was not compiled and linked (smb.o was missing), the linker could not find a reference to it while linking dbench.o