0

I feel embarrassed to ask this, but I cannot link my small demo program to the xmlrpc-c libs. I know it should be obvious but I am stumped.

I have the same problem if I install the library via apt (Debian) or build/install from source (Debian or macOS).

xmlrpc.c:(.text+0x86): undefined reference to `xmlrpc_client_setup_global_const'
xmlrpc.c:(.text+0xba): undefined reference to `xmlrpc_client_create'
xmlrpc.c:(.text+0xf9): undefined reference to `xmlrpc_client_call2f'
xmlrpc.c:(.text+0x166): undefined reference to `xmlrpc_client_destroy'
xmlrpc.c:(.text+0x16b): undefined reference to `xmlrpc_client_teardown_global_const'

The command I used to compile link was gcc $(xmlrpc-c-config --libs --cflags client) xmlrpc.c

The output from xmlrpc-c-config is

-L/usr/lib/x86_64-linux-gnu   -lxmlrpc  -lxmlrpc_xmlparse -lxmlrpc_xmltok -lxmlrpc_util 
-I/usr/include 

This all looks good and the libraries are in the expected place.

I have tried the traditional remedy of repeating the library names on the command line e.g.

gcc $(xmlrpc-c-config --cflags client) xmlrpc.c $(xmlrpc-c-config --libs client) $(xmlrpc-c-config --libs client)

but this has had no effect. I have also reviewed the answers in Why does the order in which libraries are linked sometimes cause errors in GCC?, but that does not seem to fix anything.

I have no idea what to try next (I have googled for all I'm worth, but to no avail)

Alec the Geek
  • 1,970
  • 14
  • 14
  • Try gcc $(xmlrpc-c-config --cflags client) xmlrpc.c $(xmlrpc-c-config --libs client) changing the order of libraries – Akhil Thayyil Nov 16 '17 at 06:35
  • Thanks for this -- great suggestion. However it did not make any difference. I've updated the question to use your suggestion – Alec the Geek Nov 18 '17 at 23:42
  • Problem fixed with help from lib maintainer. I had the arguments to `xmlrpc-c-config` incorrect. The correct command is `gcc $(xmlrpc-c-config client --cflags --libs) xmlrpc.c -o xmlrpc` – Alec the Geek Nov 29 '17 at 12:51

0 Answers0