Re: GR standard UHD options parser module (was UHD default subdevice.)

The move to Python 3.0 is going to be significant, and we probably
don’t want to support both.

FWIW, you can write code for python 3.0 new standards that work on 2.6
and 2.7 (not 2.5). That is, 2.6 and 2.7, for the most part have a
superset of the language.

The issues I mostly ran into were:

  1. use the print function, not the print statement
  2. use the except Exception as ex: style
  3. treat file IO as byte vectors, not strings

Then your code will happy be interpreted by 2.6->3.0. Its a real pain to
test it though. Good thing we have to wait on all those other
dependencies to catch up first.

-Josh

On Fri, Dec 30, 2011 at 4:38 PM, Andrew D.
[email protected]wrote:

Well it’s not the language choice, it’s all the helper programs that are
version locked that annoy me most. Python is in a weird state of limbo
right now with the version 3 switchover.

Version locked? We have a minimum version for the dependencies, but few
actually have a set version required or a max version allowed (even Swig
2.0 seems to work, somewhat to my surprise). All the versions we depend
on
are also very old. When we made the move to Swig 1.3.31 as the min
required, it was a big deal as that version wasn’t generally supported
out
of the box by most distros. But that was 2007.

Many systems are defaulting to python 3 and we should probably do the
same. Python

Many, but not most. And the ones most of our users work with still
default
to 2.x. We’ll make that leap when we have to, but it’s non-trivial.

would work great if I was just putting together an FM radio by connecting
blocks, but for any more computational advanced program I would want to
switch to C++. GNUradio is almost catered to Pyhton, this should not be the
case, it should be modular so I can call it from any

Remember that Python is only the glue language; all of the computation
takes place in C++.

scripting language or GRC. For just connecting blocks Python has way too
much overhead,

Wow. That’d be a nightmare to maintain. We had hooks for Guile for a
while,
but it’s been too big of a deal to manage that and Python, so we’re no
longer supporting it. It seems like it’d be a simple thing to support
various scripting languages, but it isn’t.

a simpler scripting environment would suffice. Then for more advance
programs you almost have to switch to C++. Take usrp_spectrum_sence for
example, this program has it’s own block ( bin_statistics ) that has no use
other than basically being the heart of usrp_spectrum_sence, it just shows
python isn’t up to the task of real DSP work beyond just connecting real
C++ code. Whats needed is a common block connecting API that can be run
directly from GRC without using python as an intermediary. Without the need
for python/swig we eliminate a great deal of version locking and system
incompatibility.

I’m curious about your issues with “version locking.” It sounds like
it’s
isolated to a particular system. We’ve built GNU Radio on a huge range
of
systems. The Swig version is pretty ancient in software standards and we
support Python 2.5 - 2.7, which is what most systems still use.

Any time we have a dependency, which are essential these days to making
a
program of any worth and complexity, we are going to have version
issues,
but I think we’ve been very good about handling them for the past few
years. The move to Python 3.0 is going to be significant, and we
probably
don’t want to support both.

And Python isn’t the only thing that suffers from this. Look into the
changes from Guile 1.8 to 2.0. Huge differences and massive
incompatibilities.

Anyways, if you have a particular problem that you’ve run into with a
given
system, please let us know what it is! Hell, I fairly recently built GNU
Radio on CentOS 5.2. I think the only thing I had to hand-install was
Swig
and Cmake (maybe Boost; I can’t recall).

Tom

On Fri, Dec 30, 2011 at 6:18 PM, Josh B. [email protected] wrote:

  1. use the print function, not the print statement
  2. use the except Exception as ex: style
  3. treat file IO as byte vectors, not strings

Then your code will happy be interpreted by 2.6->3.0. Its a real pain to
test it though. Good thing we have to wait on all those other
dependencies to catch up first.

-Josh

Good point. And kind of like what I said on our last call that we should
start writing new stuff that is “towards” compatible with 3.0 whenever
possible, if not compatible. We are still Python 2.5 compliant, but this
is
going to have to change at some point, but I’m not yet sure when we’ll
be
ready to pull the trigger on that or what systems it might cause
problems
on.

Tom

On Fri, Dec 30, 2011 at 6:40 PM, Josh B. [email protected] wrote:

Same hardware runs Ubuntu 11.04 :
it is fixed in the source. ( I’ll do that and proceede.)
+#endif
this into the existing udp_source/sink blocks, that would drastically
clean up the code:

http://gnuradio.org/cgit/jblum.git/tree/gnuradio-core/src/lib/io/gr_socket_to_blob.cc?h=msg_passing_squashed

http://gnuradio.org/cgit/jblum.git/tree/gnuradio-core/src/lib/io/gr_blob_to_socket.cc?h=msg_passing_squashed

-Josh

I think the OSX community has similar issues with that block, too.
Anyone
know more about that?

Hopefully, we can move to the Boost ASIO to fix this for cross platform
issues like this.

Tom

On 12/30/2011 03:12 PM, LRK wrote:

ort unsigned int, int, bool)':
+#if defined(HAVE_NETINET_IN_H)
+#include <netinet/in.h>
+#endif
+#if defined(HAVE_ARPA_INET_H)
+#include <arpa/inet.h>
+#endif
+
#elif defined(HAVE_WINDOWS_H)

Boost fan here. I think replacing that with #include <boost/asio.hpp>
would take care of all those system-specific intricacies.

Here are some blocks using boost asio. If anyone felt motivated to port
this into the existing udp_source/sink blocks, that would drastically
clean up the code:

http://gnuradio.org/cgit/jblum.git/tree/gnuradio-core/src/lib/io/gr_socket_to_blob.cc?h=msg_passing_squashed
http://gnuradio.org/cgit/jblum.git/tree/gnuradio-core/src/lib/io/gr_blob_to_socket.cc?h=msg_passing_squashed

-Josh

On Fri, Dec 30, 2011 at 12:41:48PM -0800, Josh B. wrote:

And please, tell us the errors you get on FreeBSD. They may be simple or
easily fixable. Let us know!

Make check seems to just hang when it gets here:

gr-digital/python/qa_constellation_receiver.py

Either this test takes more than 20 minutes or it is hung. Deleting this
file allows the build and install to complete.


LRK
gr-user . ovillatx.sytes.net

On Fri, Dec 30, 2011 at 12:41:48PM -0800, Josh B. wrote:

And please, tell us the errors you get on FreeBSD. They may be simple or
easily fixable. Let us know!

This is where the UHD build stops. I have not run this down yet.
FreeBSD 8.0+ has it’s own USB 2.0 code which works with the 3.2.2
build.

uhd/host/build/lib/convert/convert_orc.c: In function ‘_backup__co
nvert_fc32_1_to_item32_1_bswap_orc’:
uhd/host/build/lib/convert/convert_orc.c:432: warning: comparison
between signed and unsigned
uhd/host/build/lib/convert/convert_orc.c:438: warning: comparison
between signed and unsigned
[ 20%] Building CXX object
lib/CMakeFiles/uhd.dir/convert/convert_with_orc.cpp.o

In file included from uhd/host/include/uhd/utils/byteswap.hpp:54,
from uhd/host/lib/convert/convert_with_orc.cpp:19
:
uhd/host/include/uhd/utils/byteswap.ipp: In function ‘uint32_t uhd
::byteswap(uint32_t)’:
uhd/host/include/uhd/utils/byteswap.ipp:46: error: ‘__builtin_bswa
p32’ was not declared in this scope
uhd/host/include/uhd/utils/byteswap.ipp: In function ‘uint64_t uhd
::byteswap(uint64_t)’:
uhd/host/include/uhd/utils/byteswap.ipp:50: error: ‘__builtin_bswa
p64’ was not declared in this scope
gmake[2]: *** [lib/CMakeFiles/uhd.dir/convert/convert_with_orc.cpp.o]
Error 1
gmake[1]: *** [lib/CMakeFiles/uhd.dir/all] Error 2
gmake: *** [all] Error 2
exit 1


LRK
gr-user . ovillatx.sytes.net

LRK wrote:

Make check seems to just hang when it gets here:

gr-digital/python/qa_constellation_receiver.py

Either this test takes more than 20 minutes or it is hung. Deleting this
file allows the build and install to complete.

This is a bug common to all versions; see:
http://gnuradio.org/redmine/issues/471. It depends on the timing of
execution, so it only fails sometimes, for some users on some machines
with
some operating systems.

– Don W.

On 12/30/2011 05:20 PM, LRK wrote:

:
gmake: *** [all] Error 2
exit 1

What version of gcc do you have? The compat check may have the wrong
version. Try this little diff if you can: diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/bytesw - Pastebin.com

-Josh

GR builds on OSX just fine, with autotools or CMake. CMake is a bit
easier & more of the components compile correctly using it. On OSX, the
UDP stuff compiles just fine, but I don’t think it works correctly.
I’ve never debugged it further. Very possibly moving to Boost ASIO
would solve that issue, since the boost folks make every reasonable
effort to weed out platform-specific bugs. - MLD

On Fri, Dec 30, 2011 at 07:05:41PM -0800, Josh B. wrote:

FreeBSD 8.0+ has it’s own USB 2.0 code which works with the 3.2.2

p64’ was not declared in this scope
gmake[2]: *** [lib/CMakeFiles/uhd.dir/convert/convert_with_orc.cpp.o] Error 1
gmake[1]: *** [lib/CMakeFiles/uhd.dir/all] Error 2
gmake: *** [all] Error 2
exit 1

What version of gcc do you have?

gcc (GCC) 4.2.2 20070831 prerelease [FreeBSD]

is installed in /usr/bin/gcc and the default.

gcc46 (FreeBSD Ports Collection) 4.6.3 20111209 (prerelease)

is installed in /usr/local/bin/gcc46 and used by some of the “ports”.

I had to do the patch by hand but it does not look like the build is
checking the version or trying to use gcc before this error. The dump
is slightly different.

The compat check may have the wrong
version. Try this little diff if you can: diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/bytesw - Pastebin.com

In file included from
/log/gr/gr341/uhd/host/include/uhd/utils/byteswap.hpp:54,
from
/log/gr/gr341/uhd/host/lib/convert/convert_with_orc.cpp:19
:
/log/gr/gr341/uhd/host/include/uhd/utils/byteswap.ipp:54:37: error:
libkern/OSBy
teOrder.h: No such file or directory
In file included from
/log/gr/gr341/uhd/host/include/uhd/utils/byteswap.hpp:54,
from
/log/gr/gr341/uhd/host/lib/convert/convert_with_orc.cpp:19
:
/log/gr/gr341/uhd/host/include/uhd/utils/byteswap.ipp: In function
‘uint16_t uhd
::byteswap(uint16_t)’:
/log/gr/gr341/uhd/host/include/uhd/utils/byteswap.ipp:57: error:
‘OSSwapInt16’ w
as not declared in this scope
/log/gr/gr341/uhd/host/include/uhd/utils/byteswap.ipp: In function
‘uint32_t uhd
::byteswap(uint32_t)’:
/log/gr/gr341/uhd/host/include/uhd/utils/byteswap.ipp:61: error:
‘OSSwapInt32’ w
as not declared in this scope
/log/gr/gr341/uhd/host/include/uhd/utils/byteswap.ipp: In function
‘uint64_t uhd
::byteswap(uint64_t)’:
/log/gr/gr341/uhd/host/include/uhd/utils/byteswap.ipp:65: error:
‘OSSwapInt64’ w
as not declared in this scope
gmake[2]: *** [lib/CMakeFiles/uhd.dir/convert/convert_with_orc.cpp.o]
Error 1
gmake[1]: *** [lib/CMakeFiles/uhd.dir/all] Error 2
gmake: *** [all] Error 2


LRK
gr-user . ovillatx.sytes.net

On Fri, Dec 30, 2011 at 8:59 PM, Don W. [email protected]
wrote:

This is a bug common to all versions; see: http://gnuradio.org/redmine/**
issues/471 http://gnuradio.org/redmine/issues/471. It depends on the
timing of execution, so it only fails sometimes, for some users on some
machines with some operating systems.

– Don W.

Don, et al.,

I just pushed a fix for this issue to maint/master/next. I’m
not guaranteeing that the output is correct (I’m pretty sure, though),
but
it won’t fail on you if noutput_items = 1, at least.

Tom