Re: [ibr-dtn] Using ibrdtn stack as an external library
Hello Mathias,
the tools package can be compiled standalone as long as libribcommon and libibrdtn is installed. The necessary checks and linker parameters are gathered by pkgconfig. It is good practice to use autotools to manage dependencies in new applications. In that case, the configure.ac only needs to include these lines:
# check for ibrcommon library PKG_CHECK_MODULES([ibrdtn], [ibrdtn >= 1.0], [ AC_SUBST(ibrdtn_CFLAGS) AC_SUBST(ibrdtn_LIBS) ])
And this code must be included within the Makefile.am:
# what flags you want to pass to the C compiler & linker AM_CPPFLAGS = @ibrdtn_CFLAGS@ AM_LDFLAGS = @ibrdtn_LIBS@
That should be sufficient to link against the ibrdtn library.
Kind regards Johannes
PS: I have had CC'd this mail to the mailinglist, because the topic might be interesting for others too. In order to get fast answers to your question, I recommend you to do the same for future questions.
Am 22.07.2015 um 14:06 schrieb Mathias Brulatout:
Hello again ! After a while I did end up finding the answer, which was just a mistake by my side ... Two of my colleagues were also fooled by it ! Don't spend time to answer that :)
Have a nice day,
Mathias
2015-07-22 11:56 GMT+02:00 Mathias Brulatout <mathias.brulatout@gmail.com mailto:mathias.brulatout@gmail.com>:
Hi Johannes, I'm basically trying to create two new applications (client/server) using ibrdtn. I started devloping these inside the ibrdtn stack (in the tools folder) but it implies the compilation of the whole stack again and I don't need that. Moreover, I'll have some external depedencies (a JSON lib and a REST client lib too) which may not be easy to include in the ibr compilation chain. And it surely is not the way to go. Now I'm trying to use IBR stack (v1.0) as an external library ! I guess it should work fine since libibrcommon.* and libibrdtn.* can be found at /usr/local/include (btw the stack is properly installed on my system for a while now) I have a program test.cpp (which is heavily based on dtnping and does nothing else for now) and I compile it using this line : g++ -I/usr/local/include/ibrcommon-1.0 -I/usr/local/include/ibrdtn-1.0 -L/usr/local/lib -librcommon -librdtn -o test test.cpp The includes are like this : #include <ibrdtn/api/Client.h> #include <ibrcommon/Logger.h> Compilation is OK (it couldn't find the headers until I added the -I paths) but the linker fails and gives me undefined references to each ibrdtn/ibrcommon functions used. Am I missing something ? Thanks in advance! Mathias
participants (1)
-
Johannes Morgenroth