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).

You should read the note on using static uhd lib in your own app. Need that 
—Wl,-whole-archive linker directive.

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]

Reply via email to