net-p2p/retroshare VoIP plugin: Undefined symbol

2012-11-03 Thread Peter Klett


Hi All,

I'm currently trying to get the VoIP plugin from RetroShare to work 
under FreeBSD.

After this patch I was able to build it:

--- plugins/VOIP/services/rsvoipitems.cc~   2012-02-26 
18:13:54.0 +0100
+++ plugins/VOIP/services/rsvoipitems.cc2012-10-29 
12:53:56.650925587 +0100

@@ -182,7 +182,7 @@
ok = setRawUInt32(data, tlvsize, offset, flags);
ok = setRawUInt32(data, tlvsize, offset, data_size);
 std::cerr  data_size :   data_size  std::endl;
-memcpy(data+offset,voip_data,data_size) ;
+memcpy(((uint8_t*)data)[offset],voip_data,data_size) ;
offset += data_size ;

if (offset != tlvsize)

But I can't get RetroShare to load it:

Cannot open plugin: /home/user/.retroshare/extensions/libVOIP.so: 
Undefined symbol _ZN9p3Service7receiveEP9RsRawItem


Now the symbol is part of the RetroShare binary:

$ grep _ZN9p3Service7receiveEP9RsRawItem 
work/trunk/retroshare-gui/src/RetroShare

Binary file work/trunk/retroshare-gui/src/RetroShare matches

but somehow the symbols from the main binary do not get exported to the 
plugin.

The FreeBSD man page for dlopen(3) states in the NOTES section

ELF executables need to be linked using the -export-dynamic option to
ld(1) for symbols defined in the executable to become visible to 
dlsym().



So I rebuilt RetroShare with the -export-dynamic option, and the symbol 
is part of the symbol table:


$ objdump -t work/trunk/retroshare-gui/src/RetroShare | grep 
_ZN9p3Service7receiveEP9RsRawItem
00809580 g F .text  00c7  
_ZN9p3Service7receiveEP9RsRawItem


but still to no avail (same undefined symbol error).
My knowledge of ELF binaries is pretty sparse, so if someone has more 
clues, I would appreciate sharing :)


Thanks Peter



___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: net-p2p/retroshare VoIP plugin: Undefined symbol

2012-11-03 Thread Konstantin Belousov
On Sat, Nov 03, 2012 at 01:59:18PM +0100, Peter Klett wrote:
 
 Hi All,
 
 I'm currently trying to get the VoIP plugin from RetroShare to work 
 under FreeBSD.
 After this patch I was able to build it:
 
 --- plugins/VOIP/services/rsvoipitems.cc~   2012-02-26 
 18:13:54.0 +0100
 +++ plugins/VOIP/services/rsvoipitems.cc2012-10-29 
 12:53:56.650925587 +0100
 @@ -182,7 +182,7 @@
  ok = setRawUInt32(data, tlvsize, offset, flags);
  ok = setRawUInt32(data, tlvsize, offset, data_size);
   std::cerr  data_size :   data_size  std::endl;
 -memcpy(data+offset,voip_data,data_size) ;
 +memcpy(((uint8_t*)data)[offset],voip_data,data_size) ;
  offset += data_size ;
 
  if (offset != tlvsize)
 
 But I can't get RetroShare to load it:
 
 Cannot open plugin: /home/user/.retroshare/extensions/libVOIP.so: 
 Undefined symbol _ZN9p3Service7receiveEP9RsRawItem
 
 Now the symbol is part of the RetroShare binary:
 
 $ grep _ZN9p3Service7receiveEP9RsRawItem 
 work/trunk/retroshare-gui/src/RetroShare
 Binary file work/trunk/retroshare-gui/src/RetroShare matches
 
 but somehow the symbols from the main binary do not get exported to the 
 plugin.
 The FreeBSD man page for dlopen(3) states in the NOTES section
 
 ELF executables need to be linked using the -export-dynamic option to
 ld(1) for symbols defined in the executable to become visible to 
 dlsym().
 
 
 So I rebuilt RetroShare with the -export-dynamic option, and the symbol 
 is part of the symbol table:
 
 $ objdump -t work/trunk/retroshare-gui/src/RetroShare | grep 
 _ZN9p3Service7receiveEP9RsRawItem
 00809580 g F .text  00c7  
 _ZN9p3Service7receiveEP9RsRawItem
 
 but still to no avail (same undefined symbol error).
 My knowledge of ELF binaries is pretty sparse, so if someone has more 
 clues, I would appreciate sharing :)

The objdump -t dumps wrong table. You want to examine the output of -T
AKA --dynamic-syms.


pgpPoCweZVYHj.pgp
Description: PGP signature


Re: net-p2p/retroshare VoIP plugin: Undefined symbol

2012-11-03 Thread Peter Klett

Perfect,
that clue just did it, turns out RetroShare uses g++ for linking
which has a slightly different parameter -rdynamic instead of
-export-dynamic.
Setting this option while linking the RetroShare binary brings
the symbol in the dynamic exported table and lets the binary
finally load the plugin.

Thanks Konstantin for your input.

Am 2012-11-03 15:53, schrieb Konstantin Belousov:

On Sat, Nov 03, 2012 at 01:59:18PM +0100, Peter Klett wrote:


Hi All,

I'm currently trying to get the VoIP plugin from RetroShare to work
under FreeBSD.
After this patch I was able to build it:

--- plugins/VOIP/services/rsvoipitems.cc~   2012-02-26
18:13:54.0 +0100
+++ plugins/VOIP/services/rsvoipitems.cc2012-10-29
12:53:56.650925587 +0100
@@ -182,7 +182,7 @@
 ok = setRawUInt32(data, tlvsize, offset, flags);
 ok = setRawUInt32(data, tlvsize, offset, data_size);
  std::cerr  data_size :   data_size  std::endl;
-memcpy(data+offset,voip_data,data_size) ;
+memcpy(((uint8_t*)data)[offset],voip_data,data_size) ;
 offset += data_size ;

 if (offset != tlvsize)

But I can't get RetroShare to load it:

Cannot open plugin: /home/user/.retroshare/extensions/libVOIP.so:
Undefined symbol _ZN9p3Service7receiveEP9RsRawItem

Now the symbol is part of the RetroShare binary:

$ grep _ZN9p3Service7receiveEP9RsRawItem
work/trunk/retroshare-gui/src/RetroShare
Binary file work/trunk/retroshare-gui/src/RetroShare matches

but somehow the symbols from the main binary do not get exported to 
the

plugin.
The FreeBSD man page for dlopen(3) states in the NOTES section

ELF executables need to be linked using the -export-dynamic option 
to

ld(1) for symbols defined in the executable to become visible to
dlsym().


So I rebuilt RetroShare with the -export-dynamic option, and the 
symbol

is part of the symbol table:

$ objdump -t work/trunk/retroshare-gui/src/RetroShare | grep
_ZN9p3Service7receiveEP9RsRawItem
00809580 g F .text  00c7
_ZN9p3Service7receiveEP9RsRawItem

but still to no avail (same undefined symbol error).
My knowledge of ELF binaries is pretty sparse, so if someone has 
more

clues, I would appreciate sharing :)


The objdump -t dumps wrong table. You want to examine the output of 
-T

AKA --dynamic-syms.


--
netkey information technology gmbh
amalienstrasse 68/6 | a-1130 vienna | austria
t +43 1 888 49 93 -21 | f dw -25
e pe...@netkey.at | i www.netkey.at
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org