Undefined reference error with methods of libxmlrpc-c3-dev

Bug #690779 reported by Jaime Melis
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
opennebula (Debian)
Fix Released
Undecided
Unassigned
opennebula (Ubuntu)
Fix Released
Medium
Unassigned
xmlrpc-c (Debian)
Fix Released
Unknown
xmlrpc-c (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: gcc-4.5

I'm in a natty environment (created with pbuilder in an Ubuntu maverick).

# pbuilder create --distribution natty --othermirror "deb
http://archive.ubuntu.com/ubuntu natty main restricted universe
multiverse"

# pbuilder --login

Check g++ version:
# g++ --version|head -1
g++ (Ubuntu/Linaro 4.5.1-12ubuntu1) 4.5.2

I install required dependencies:
# apt-get install libxmlrpc-c3-dev libcurl4-openssl-dev

I create a small program which uses the xmlrpc-c library:
------------------------------------------------------------------------
server.cpp
------------------------------------------------------------------------
#include <xmlrpc-c/base.hpp>
#include <xmlrpc-c/registry.hpp>

int main(int argc, char *argv[])
{
    xmlrpc_c::registry RequestManagerRegistry;
    return 0;
}
------------------------------------------------------------------------

I obtain the building libraries with xmlrpc-config:
# xmlrpc-c-config c++2 abyss-server --libs --cflags
-L/usr/lib -lxmlrpc_server_abyss++ -lxmlrpc_server++
-lxmlrpc_server_abyss -lxmlrpc_server -lxmlrpc_abyss -lpthread
-lxmlrpc++ -lxmlrpc -lxmlrpc_util -lxmlrpc_xmlparse -lxmlrpc_xmltok
-I/usr/include

I compile the program:
# g++ server.cpp `xmlrpc-c-config c++2 abyss-server --libs --cflags`
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_traceXml'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_struct_size'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_array_size'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_mem_block_free'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_env_clean'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_registry_new'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_mem_block_size'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_serialize_call'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_read_datetime_sec'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_double_new'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_mem_block_new'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_parse_response2'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_registry_free'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_read_base64'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_registry_disable_introspection'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_DECREF'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_mem_block_contents'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_env_init'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_datetime_new_str'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_string_new'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_abort_if_array_bad'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_datetime_new_sec'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_registry_process_call'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_INCREF'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_struct_read_member'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_bool_new'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_registry_add_method_w_doc'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_vasprintf'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_value_type'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_struct_new'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_strfree'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_read_bool'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_registry_set_default_method'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_array_append_item'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_struct_set_value_n'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_nil_new'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_base64_new'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_read_string_lp'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_read_int'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_read_base64_size'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_env_set_fault'
/usr/lib/libxmlrpc_server++.so: undefined reference to `xmlrpc_array_read_item'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_array_new'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_int_new'
/usr/lib/libxmlrpc++.so: undefined reference to `xmlrpc_read_double'
collect2: ld returned 1 exit status

If we look for the missing references manually we can find them:
# nm -D /usr/lib/libxmlrpc++.so|grep trace
000000000000db80 T _ZN8xmlrpc_c3xml5traceERKSsS2_
                 U xmlrpc_traceXml

This used to work with previous versions of gcc:

(in the same environment)
# apt-get install g++-4.4

Check g++ version:
# g++-4.4 --version|head -1
g++-4.4 (Ubuntu/Linaro 4.4.5-10ubuntu1) 4.4.5

# g++-4.4 server.cpp `xmlrpc-c-config c++2 abyss-server --libs --cflags`
# echo $?
0

We need to fix this in order to complete the following merge:
https://bugs.launchpad.net/ubuntu/+source/opennebula/+bug/688666

Thank you

Tags: as-needed
Revision history for this message
Stefano Rivera (stefanor) wrote :

This is not a GCC bug, it's a result of the no-add-needed linker changes.

The following works for me:

$ g++ -o server server.cpp -lxmlrpc_server++ -lxmlrpc++ -lxmlrpc -lxmlrpc_xmlparse -lxmlrpc_xmltok -lxmlrpc_server

or, as a workaround:

$ g++ -o server server.cpp -Wl,--no-as-needed `xmlrpc-c-config c++2 abyss-server --libs`

affects: gcc-4.5 (Ubuntu) → xmlrpc-c (Ubuntu)
Changed in xmlrpc-c (Ubuntu):
status: New → Confirmed
tags: added: as-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xmlrpc-c - 1.06.27-1ubuntu8

---------------
xmlrpc-c (1.06.27-1ubuntu8) natty; urgency=low

  * Resolve unresolved references in shared libraries. LP: #690779.
  * Fix build failures with ld --no-add-needed.
  * Fix build failures with ld --as-needed.
  * libxmlrpc-c3-dev: Recommend libcurl4-openssl-dev | libcurl3-openssl-dev.
    LP: #284515.
 -- Matthias Klose <email address hidden> Thu, 06 Jan 2011 16:45:44 +0100

Changed in xmlrpc-c (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Matthias Klose (doko) wrote :

the opennebula workaround needs to be reverted

Changed in opennebula (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Changed in xmlrpc-c (Debian):
status: Unknown → New
Changed in xmlrpc-c (Debian):
status: New → Fix Committed
Changed in xmlrpc-c (Debian):
status: Fix Committed → Fix Released
Revision history for this message
Dave Walker (davewalker) wrote :

Is there still a task requirement for opennebula? This issue looks to be fixed, but I am reluctant to change it myself as I am in some doubt. Can those involved please comment and possibly set the task as appropriate?

Thanks.

Revision history for this message
Damien Raude-Morvan (drazzib) wrote :

This issue have been fixed by opennebula package 2.0.1-6 and xmlrpc-dev 1.16.33-1 (both in Debian unstable/wheezey).

Changed in opennebula (Debian):
status: New → Fix Released
Revision history for this message
Damien Raude-Morvan (drazzib) wrote :

 opennebula (2.0.1-6) unstable; urgency=low
 .
   * xmlrpc-c 1.16 transition:
     - d/control: Build-Depends on libxmlrpc-c++4-dev instead of
       libxmlrpc-c3-dev.
     - d/rules: Drop --no-as-needed from DEB_LDFLAGS_APPEND.
       LP: #690779.
   * d/copyright: Upgrade to latest DEP-5 format.
   * d/patches/ldflags_build.diff: Refreshed.
   * d/patches/linking.diff: Explicit linking with libxml2 (ie. reorder LIBS).

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package opennebula - 2.0.1-6

---------------
opennebula (2.0.1-6) unstable; urgency=low

  * xmlrpc-c 1.16 transition:
    - d/control: Build-Depends on libxmlrpc-c++4-dev instead of
      libxmlrpc-c3-dev.
    - d/rules: Drop --no-as-needed from DEB_LDFLAGS_APPEND.
      LP: #690779.
  * d/copyright: Upgrade to latest DEP-5 format.
  * d/patches/ldflags_build.diff: Refreshed.
  * d/patches/linking.diff: Explicit linking with libxml2 (ie. reorder LIBS).
 -- Ubuntu Archive Auto-Sync <email address hidden> Sat, 30 Apr 2011 13:26:30 +0000

Changed in opennebula (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.