I suspect the same solution I gave a couple weeks ago will work here: set(MY_LIB_OPT -Wl,--whole-archive libuhd -Wl,--no-whole-archive) target_link_libraries(myapp ${MY_LIB_OPT} <...the rest of your libs...>)
On Wed, Apr 17, 2019 at 3:02 AM Paolo Palana via USRP-users < usrp-users@lists.ettus.com> wrote: > Hi to all the mailing list. > > I've a question about the correct way to use a static version of libuhd > (namely libuhd.a) > > For experimental reason I need a way to build an executable of mine that > "embed" a specific version of libuhd. I enabled (throutg > -DENABLE_STATIC_LIBS=ON) the compilation of the static library and I get > the libuhd.a file. > > After that I modified my CMakeLists.txt to link against libuhd.a. The > compilation and link process goes smooth. So far so good. > > The problem arise when I execute the program. No radio (x310 in my case) > is found. I traced the problem. > > The shared version of libuhd (libuhd.so) has a init function (that > should be register_x300_device, defined in x300_impl.cpp). that is > called before main This function is no longer called when I compile > using libuhd.a, may be because there is no the dynamic loader involved. > > The question is. Can I call it from my code? And if yes how? I tried > different ways, but no success. > > Thank you for your attention. > > My version is 003-010-003-000. > > Paolo > > > > _______________________________________________ > USRP-users mailing list > USRP-users@lists.ettus.com > http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com >
_______________________________________________ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com