# RetroShare VoIP plugin undefined symbol



## glocke (Nov 2, 2012)

Hi there, 

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

```
--- plugins/VOIP/services/rsvoipitems.cc~       2012-02-26 18:13:54.000000000 +0100
+++ plugins/VOIP/services/rsvoipitems.cc        2012-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:

```
Found plugin /home/user/.retroshare/extensions/libVOIP.so
  Loading plugin...
  Loading plugin /home/user/.retroshare/extensions/libVOIP.so
    -> hashing.
    -> hash = 48a533b3f1f94124419484e866f08ed3d632b356
    -> hash authorized. Loading plugin. 
  Cannot open plugin: /home/user/.retroshare/extensions/libVOIP.so: Undefined symbol "_ZN9p3Service7receiveEP9RsRawItem"
Examined a total of 1 plugins.
```
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 ist part of the symbol table:

```
$ objdump -t work/trunk/retroshare-gui/src/RetroShare | grep _ZN9p3Service7receiveEP9RsRawItem
0000000000809580 g     F .text  00000000000000c7              _ZN9p3Service7receiveEP9RsRawItem
```
 but still to no avail. My knowledge of ELF binaries is pretty sparse, so if someone has more clues, I would appreciate sharing 

P.S. I also posted this question on the RetroShare forum

Greetings glocke


----------



## glocke (Nov 3, 2012)

*Solved*

Hi, 

turns out RetroShare uses g++ for linking, which has a slightly different options for this: -rdynamic instead of -export-dynamic.

I will try to post a patch for net-p2p/retroshare to enable plugins.
Thanks to Konstantin Belousov on the ports-list for giving the hint.


----------



## zspider (Nov 17, 2012)

Hey, good to see you're still working on that. Good work.


----------



## glocke (Nov 19, 2012)

zspider said:
			
		

> Hey, good to see you're still working on that. Good work.



Thanks 

If you want to test the VoIP plugin, I could send you a patch against the ports directory, which also builds the plugins, afaik all you need is a headset and a buddy with activated VoIP plugin to test.


----------



## zspider (Nov 20, 2012)

glocke said:
			
		

> Thanks
> 
> If you want to test the VoIP plugin, I could send you a patch against the ports directory, which also builds the plugins, afaik all you need is a headset and a buddy with activated VoIP plugin to test.



I could do that.


----------



## glocke (Nov 21, 2012)

Thanks zspider, 

attached is a new retroshare ports directory. Remember to use the new binary with the plugins, any old (compiled) binary will be missing the exports.

If you need any assistance contact me.

Thanks for testing!


----------



## zspider (Mar 10, 2013)

Since I've got a couple of people in my network now, perhaps I'll be able to test the VOIP plugin.


----------



## glocke (Mar 11, 2013)

Great!

net-p2p/retroshare was updated a couple of days ago, it now installs the plugin by default, please don't use the above patch, but the port, thank you.


----------

