Building under FreeBSD

The current GnuRadio now builds under FreeBSD using my script. Volk
is disabled in my script because it did not build and I have not looked
into that.

The UHD code will not build the USRP1 or other USB code because since
FreeBSD 8.0, USB code is included in the FreeBSD kernel code. libusb-1.0
has not been ported to FreeBSD because it is not useful. libusb-0.1 was
working with earlier versions but never very well.

The UHD cmake demands libusb-1.0 to build the USB device code without
checking to see if libusb code is available in the kernel. My old 3.2.2
code (ported by Diane and tested by me) works under FreeBSD 8.2 using
it’s
libusb20.


LRK
gr-user . ovillatx.sytes.net

On 01/05/2012 07:52 AM, LRK wrote:

The current GnuRadio now builds under FreeBSD using my script. Volk
is disabled in my script because it did not build and I have not looked
into that.

What was the error and what is the git hash of your build?

I had a build error with the cpu type detection at build time. Fixed it
here:
http://gnuradio.org/cgit/gnuradio.git/commit/?h=maint&id=4c6316e12456650b56fab2aa5bbca273a972b1c6

The UHD code will not build the USRP1 or other USB code because since
FreeBSD 8.0, USB code is included in the FreeBSD kernel code. libusb-1.0
has not been ported to FreeBSD because it is not useful. libusb-0.1 was
working with earlier versions but never very well.

The UHD cmake demands libusb-1.0 to build the USB device code without
checking to see if libusb code is available in the kernel. My old 3.2.2
code (ported by Diane and tested by me) works under FreeBSD 8.2 using it’s
libusb20.

Libusb lists that there is a freebsd version:
http://www.libusb.org/wiki/libusb-1.0#Portability

Maybe UHD just needs to look for a different library name.
Something simple like this: diff --git a/host/cmake/Modules/FindUSB1.cmake b/host/cmake/Modules/FindUSB1.cma - Pastebin.com

-Josh

On Thu, Jan 05, 2012 at 09:34:42AM -0800, Josh B. wrote:

On 01/05/2012 07:52 AM, LRK wrote:

The current GnuRadio now builds under FreeBSD using my script. Volk
is disabled in my script because it did not build and I have not looked
into that.

What was the error and what is the git hash of your build?

I’m one of those who has not figured out version intracies of git.

I re-enabled the volk and started this morning with a new download so it
was recent (about 1400 GMT today). While looking at the error, I
discovered
I had set the script back to the autotools type build.

Switching back to cmake, it fails here:

Linking CXX executable gnuradio-config-info
libgnuradio-core.so.3.5.1git: undefined reference to
`gruel::enable_realtime_sch
eduling(gruel::rt_sched_param)’
gmake[2]: *** [gnuradio-core/src/lib/gnuradio-config-info] Error 1

I don’t think FreeBSD does the realtime_scheduling.


LRK
gr-user . ovillatx.sytes.net

Best I can make out the cmake stuff, if it doesn’t find libusb-1.0 it
does not build. Never looks for any libusb libraries in /usr/lib/ or
/usr/local/lib.

Since there is no pc file, you have to manually point cmake to the
libusb1.0 install. You might try this (I assume thats the correct lib):

cmake -DLIBUSB_INCLUDE_DIR=/usr/include
-DLIBUSB_LIBRARIES=/usr/lib/libusb.so <src_dir>

-Josh

On Thu, Jan 05, 2012 at 03:18:02PM -0800, Josh B. wrote:

Best I can make out the cmake stuff, if it doesn’t find libusb-1.0 it
does not build. Never looks for any libusb libraries in /usr/lib/ or
/usr/local/lib.

Since there is no pc file, you have to manually point cmake to the
libusb1.0 install. You might try this (I assume thats the correct lib):

cmake -DLIBUSB_INCLUDE_DIR=/usr/include
-DLIBUSB_LIBRARIES=/usr/lib/libusb.so <src_dir>

We are still talking about FreeBSD 8.x here, there IS NO libusb-1.0!

The pointer you sent tells about FreeBSD 8.x using libusb-2.0 as it
was developed from libusb-1.0 and that projects should run under FreeBSD
8.x if developed elsewhere using libusb-1.0.

I got the tarball and tried to build it under FreeBSD 7.4 in case it
would do better than libusb-0.1 but the configure says “unsupported OS”.
Probably does that under 8.2 but I haven’t got that far.

Since FreeBSD has /usr/lib/libusb.a, /usr/lib/libusb.so, etc., they
should
be used by normal cmake instead of demanding libusb-1.0 from outside.


LRK
gr-user . ovillatx.sytes.net

On 01/06/2012 06:27 AM, LRK wrote:

-DLIBUSB_LIBRARIES=/usr/lib/libusb.so <src_dir>

We are still talking about FreeBSD 8.x here, there IS NO libusb-1.0!

Doesnt matter. There is a libusb 1.0 compatible header. Tell cmake how
to find it with the command above; uhd will configure usb support and
compile. But can the library talk to the usrp?

-Josh

On Thu, Jan 05, 2012 at 09:34:42AM -0800, Josh B. wrote:

Libusb lists that there is a freebsd version:
http://www.libusb.org/wiki/libusb-1.0#Portability

I might try this but since there is libusb code in FreeBSD it seems like
it
should be used.

Maybe UHD just needs to look for a different library name.
Something simple like this: diff --git a/host/cmake/Modules/FindUSB1.cmake b/host/cmake/Modules/FindUSB1.cma - Pastebin.com

Best I can make out the cmake stuff, if it doesn’t find libusb-1.0 it
does not build. Never looks for any libusb libraries in /usr/lib/ or
/usr/local/lib.


LRK
gr-user . ovillatx.sytes.net

On Fri, Jan 6, 2012 at 12:45 PM, Josh B. [email protected] wrote:

libusb1.0 install. You might try this (I assume thats the correct lib):

-Josh

Issue 481 on Redmine discusses a problem with the gr_vector_source in
FreeBSD. See my response:
http://gnuradio.org/redmine/issues/481

I’d like to get more information about what’s going on here with FreeBSD
and why the std::invalid_argument exception isn’t being handled
properly.

Thanks,
Tom

On Thu, Jan 05, 2012 at 09:52:11AM -0600, LRK wrote:

The current GnuRadio now builds under FreeBSD using my script. Volk
is disabled in my script because it did not build and I have not looked
into that.

Ok, I enable volk again and find this:

g++ -DHAVE_CONFIG_H -I. -I… -DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN
-I…/inclu
de -I…/lib -I/usr/local/include -I…/gen/include -I…/include
-Dvolk_EXPORTS -
fvisibility=hidden -g -O2 -nostdinc++ -I/usr/include/c++/4.2.2
-I/usr/include
/c++/4.2.2/ -MT testqa-testqa.o -MD -MP -MF .deps/testqa-testqa.Tpo -c
-o testqa
-testqa.o test -f 'testqa.cc' || echo './'testqa.cc

qa_utils.h:4:19: error: cstdlib: No such file or directory
qa_utils.h:5:18: error: string: No such file or directory
qa_utils.h:6:18: error: vector: No such file or directory
…/include/volk/volk_complex.h:22:19: error: complex: No such file or
directory
/usr/local/include/boost/config/select_stdlib_config.hpp:17:19: error:
cstddef:
No such file or directory
/usr/local/include/boost/config/no_tr1/utility.hpp:21:21: error:
utility: No suc
h file or directory

The errors are due to the code looking for files in
/usr/include/c++/4.2.2
which are installed in /usr/include/c++/4.2
FreeBSD uses gcc 4.2.2 in the kernel code and gcc46 installed from the
port,
normally only used by some ports.

/usr/include/c++/4.2/tr1/cstdlib
/usr/include/c++/4.2/cstdlib
/usr/local/include/boost/compatibility/cpp_c_headers/cstdlib
/usr/local/lib/gcc46/include/c++/tr1/cstdlib
/usr/local/lib/gcc46/include/c++/cstdlib
/usr/src/contrib/libstdc++/include/tr1/cstdlib
/usr/X11R6/include/boost/compatibility/cpp_c_headers/cstdlib
/usr/X11R6/lib/gcc46/include/c++/tr1/cstdlib
/usr/X11R6/lib/gcc46/include/c++/cstdlib

If I make a link so 4.2.2 is there pointing to the 4.2 directory, it
compiles, with only 23 warnings about volk.

The autotools build installs and it runs dial_tone.py so it looks
better.

The cmake build does not install the gnuradio stuff in the site-packages
directory in PYTHONPATH like autotools did. I found the way to put the
GR_PREFIX in for the other installs but not the PYTHONPATH part.

Onward…


LRK
gr-user . ovillatx.sytes.net

On Fri, Jan 06, 2012 at 09:45:12AM -0800, Josh B. wrote:

Doesnt matter. There is a libusb 1.0 compatible header. Tell cmake how
to find it with the command above; uhd will configure usb support and
compile.

Ok, so I tell cmake how to find libraries where unix normally puts them
and it makes. Now the gnuradio cmake build finds uhd but fails the
realtime stuff. Disabling gruel gets it past that and it makes. On to
install…

But can the library talk to the usrp?

The FreeBSD 8.x libusb can talk to my USRP1 since my USRP1 was used
during
the development of the libusb20 code. :slight_smile:

As soon as I get the install issues worked, I’ll have some info on
3.5.1.

I was building from the svn downloads and installing as a user. With
different sub-directories, I could get the next version working while
still able to run experiments using the previous version. Once the next
one worked and my code was ported, I could switch to that.

I routinely run projects under FreeBSD 8.2 and the GnuRadio 3.2.2 port
which
Diane did using a machine other than the one I am currently using to try
to
get 3.5.1 working. The grc with that has recently failed, probably due
to some other program upgrade so that is still on my list.


LRK
gr-user . ovillatx.sytes.net

For us following along at home, do you think you could give us a running
command list? I just finished getting UHD installed with just “cmake
-DLIBUSB_INCLUDE_DIR=/usr/include -DLIBUSB_LIBRARIES=/usr/lib/
libusb.so …/” , someone should put UHD in the ports collection, it
compiles very easily. But now I’m stuck in a dependency hell with qwt
and
pyQwt5, what versions do you have installed? None of them seem to
include
the headers, is there a dev package that installs the headers?

On Sat, Jan 7, 2012 at 1:53 PM, Andrew D.
[email protected]wrote:

For us following along at home, do you think you could give us a running
command list? I just finished getting UHD installed with just “cmake
-DLIBUSB_INCLUDE_DIR=/usr/include -DLIBUSB_LIBRARIES=/usr/lib/
libusb.so …/” , someone should put UHD in the ports collection, it
compiles very easily. But now I’m stuck in a dependency hell with qwt and
pyQwt5, what versions do you have installed? None of them seem to include
the headers, is there a dev package that installs the headers?

We will also want to put any of these instruction onto the Build Guide
on
gnuradio.org.

We should also work out any of these details in the code where we can
and
where they make sense.

Thanks for pushing on this!

Tom

Ok, all of gnuradio from the current master builds on freebsd 8.2 with
all dependencies installed from pkg_add. Now here are the little snags
(mostly relating to the graphical appliances in gnuradio)

  1. qtgui tweaks
    http://gnuradio.org/cgit/jblum.git/commit/?h=freebsd_tweaks&id=ca3868256079060993ebb643e34b39c558052ce0

  2. The find qt cmake script is bonkers. This diff makes fixes it, but
    was too goofy to commit: diff --git a/gr-qtgui/CMakeLists.txt b/gr-qtgui/CMakeLists.txtindex a8fead4..7 - Pastebin.com

What this means is the script found and set all the important variables
to build with qt4, and then must have given up towards the end. Applying
1 and 2, gr-qtgui builds.

  1. All unit tests pass except for http://gnuradio.org/redmine/issues/481
    Although I didnt run qtgui test since that needed an X server.

  2. GRC didnt configure on account of this:

[root@ ~/build/gnuradio]# python -c “import gtk”
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.6/site-packages/gtk-1.2/gtk.py”, line 894
def set_policy(self, as, ag, autos):
^
SyntaxError: invalid syntax

That as is probably a reserved keyword. This is python 2.6

  1. I noticed that when building gnuradio the second time, after
    installing, the compiler was building against installed gr headers in
    /usr/local/include I noticed this since qtgui was building against the
    installed high_res_timer.h with the bug in it and not the in-tree one
    that I fixed. Thats got to be a compiler or cmake issue, but I have
    never seen this happen on other platforms.

-josh

Also I’m trying to make UHD install with ports, this will be useful to
projects that use USRP hardware without GNUradio and the GNUradio port
can
pull this in as a dependency so it can be made with it, but I cant find
where the tarballs are at, github has releases but they use some
rediection
so I cant pin down exactly where there at, does anyone have a mirror
with
“uhd-3.3.1.tar.gz” or similar file on it?

I dont think this is BSD related but ./configure cant find the qwt
headers
“checking qwt/qwt_math.h presence… no”, they are in
“/usr/local/include/qwt/qwt_math”.
–with-qwt-incdir=/usr/local/include/qwt
fixes that, but then it doesn’t find the libs in /usr/local, it finds
other
libs in there but not qwt ( and libqwt.so is present )? I tried --prefix
/usr/local but that does nothing. Any Ideas on why qwt is so special?

On 01/08/2012 11:29 AM, Andrew D. wrote:

Also I’m trying to make UHD install with ports, this will be useful to
projects that use USRP hardware without GNUradio and the GNUradio port can
pull this in as a dependency so it can be made with it, but I cant find
where the tarballs are at, github has releases but they use some rediection
so I cant pin down exactly where there at, does anyone have a mirror with
“uhd-3.3.1.tar.gz” or similar file on it?

Tarballs for release tags are all here:

The urls for fetching look a bit like this:
https://github.com/EttusResearch/UHD-Mirror/tarball/release_003_003_001
https://github.com/EttusResearch/UHD-Mirror/tarball/patch_release

Mind you that there were some fixes needed to compile uhd on this os. I
will try to tag a 3.3.2 patch release on monday with some of these
fixes.

-Josh