PcapPlusPlus icon indicating copy to clipboard operation
PcapPlusPlus copied to clipboard

[Feature request]: Build shared libraries

Open lgbaldoni opened this issue 8 years ago • 8 comments

At least on Linux. Or is the API still too unstable?

lgbaldoni avatar Aug 17 '17 07:08 lgbaldoni

I tried to do it a few months back but various parts in the API assume memory allocation on both shared library and API caller sides so this separation doesn't work. Doing it will require quite a lot of work and changes in these parts in the API. Unfortunately I don't think I'll have the time for it in the near future

seladb avatar Aug 17 '17 09:08 seladb

Build shared libraries of "libCommon++.so libPacket++.so libPcap++.so" Is it possible to provide a way to switch from a static library to a dynamic library?

daoxuans avatar Jul 11 '18 07:07 daoxuans

As I explained in the comment above this is not trivial because several parts in PcapPlusPlus API assume memory allocation on both sides (shared library and caller) so this separation doesn't work out-of-the-box.

I guess this is doable but will require a significant amount of efforts which I currently don't have...

seladb avatar Jul 11 '18 20:07 seladb

Hi Could you point us to the issues & code areas which require work? Perhaps I can take it up.

bornlibra23 avatar Nov 26 '19 07:11 bornlibra23

To be honest, it's been a long time so I don't quite remember... but you can try to build the PcapPlusPlus as shared library, run the unit-tests and you'll probably bump into the issues.

seladb avatar Nov 26 '19 19:11 seladb

I have met undefined reference problem several times, like

 undefined reference to `pcpp::MacAddress::toString[abi:cxx11]() const'

and try several sequence of link libs

        pthread
        pcap
        Common++
        Pcap++
        Packet++

And now I have no idea to solve the problem, maybe the only way is choose shared libs

DinoStray avatar Sep 04 '20 08:09 DinoStray

I have met undefined reference problem several times, like

 undefined reference to `pcpp::MacAddress::toString[abi:cxx11]() const'

Are you trying to build PcapPlusPlus as a shared library?

seladb avatar Sep 04 '20 09:09 seladb

I have met undefined reference problem several times, like

 undefined reference to `pcpp::MacAddress::toString[abi:cxx11]() const'

Are you trying to build PcapPlusPlus as a shared library?

No, I just rebuild the latest PcapPlusPlus version(v20..08), then everything is OK

DinoStray avatar Sep 05 '20 08:09 DinoStray

@lgbaldoni could you retry with cmake build system it should works properly.

@seladb maybe we can close this issue no ?

clementperon avatar Jan 28 '23 23:01 clementperon

@clementperon I remember there we some problems with shared libraries, but I don't remember what they were and on which platforms. I guess we can close this issue now, but first maybe we can document how to compile PcapPlusPlus as static or shared libraries?

seladb avatar Jan 30 '23 09:01 seladb

I'll close the issue now as building shared libraries is now supported. Thanks @clementperon for working on this!

seladb avatar Feb 01 '23 07:02 seladb