Hi,
On 5/18/21 1:51 PM, [email protected] wrote:
Paolo:
I took the route of building the boost libraries as static builds to
use in the static build of libuhd.
Some more recent versions of boost had some issues but I was
successful with boost version 1.71.0.
Download boost v1.71.0, run bootstrap.sh and invoke sudo ./b2
cxxflags=-fPIC cflags=-fPIC link=static -a install
which results in a bunch libboost*.a in /usr/local/lib.
And then for building uhd, I used cmake -DENABLE_STATIC_LIBS=ON
-DENABLE_TESTS=OFF ../
(Had issues building the tests).
what you suggest is for shure a possible solution and also a good one I
dare say, better than mine for shure.
However I choose not to rebuild boost because, from my own point of view
clearly, the static version of libuhd should link using the libraries
provided by the distro you are using. This, I think, make things easier
for people who are working, for any reasons, on different platforms
(e.g. ubuntu 18.04 and ubuntu 20.4 use different boost versions).
Of course this is my opinion and can be completely wrong,
You should read the note on using static uhd lib in your own app. Need
that âWl,-whole-archive linker directive.
Yes, you are rigth, I should. However my problem in linking an
application using libuhd.a was not with this library, but with libdl.
Hope can be helpful
have a good day.
I am having some issues doing this along with using the static boost
libraries in my app. Will update once I resolve that issue.
Hope that helps.
ââ-
When linking the static library, you must ensure that the library is
loaded in its entirety, otherwise global objects aren't initialized at
load-time and it will always fail to detect any devices. Also, *all*
UHD dependencies for UHD must be provided unless your linker has other
ways of resolving library dependencies.
With the GNU ld linker (e.g. on Linux platforms), this is done using
the |--whole-archive| switch. Using the GNU C++ compiler, the correct
command line is:
|g++ your_uhd_app.cpp -Wl,-whole-archive <path to UHD libs>/libuhd.a
-Wl,-no-whole-archive -ldl -lpthread -l<all other libraries> From
https://files.ettus.com/manual_archive/release_003_008_003/html/page_build_guide.html
And here is some more background on static UHD lib:
http://www.trondeau.com/blog/2015/1/19/working-with-uhd-static-library
Subu |
_______________________________________________
USRP-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
_______________________________________________
USRP-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]