Hi All experienced software porters,

First of all, I would like to say thanks for your efforts to port
popular applications to OpenBSD ports tree.

I'm using OpenBSD 6.1amd64 as production system.
I tried to build build UHD driver from that port:

https://github.com/akpoff/openbsd-wip comms/uhd

... but unsuccessful.

While building from port I have a lot of errors one of them about Boost-1.58.0
library there is no thread support added. In this case boost has been installed
from packages 6.1/packages/amd64/..

So I built 'uhd-release_003_009_004.tar.gz' driver myself.

https://github.com/EttusResearch/uhd/archive/release_003_009_004.tar.gz

Below is my experience...

1. I've added all the patches from akpoff/openbsd-wip/comms/uhd to host/patches 
+
CMakeLists.txt patch to list Boost-1.58.0 version for cmake.

2. Original Boost-1.58.0 library has been downloaded directly from boost.org
and patched from ports tree patches related to boost-1.58.0, then it has been
repacked to boost-1.58.0.tar.gz.

3. Boost-1.58.0 has been rebuilt by gcc/g++ v4.2.1 OpenBSD 6.1amd64 system 
default
compiler set.

4. For UHD build I used cmake-3.7.2 from OBSD6.1amd64 packages, seems further
build has been made by OpenBSD integrated gcc/g++  v4.2.1

Below some scripts I did. Hope it helps to improve UHD driver port to
build it from ports tree and include it to ports and packages by default.

------------------------------------------------------------------
$cat patches/CMakeLists.txt.patch

--- CMakeLists.txt.old  Wed Dec 30 23:11:55 2015
+++ CMakeLists.txt      Sun Nov 12 15:16:12 2017
@@ -208,7 +208,7 @@
 SET(Boost_ADDITIONAL_VERSIONS
     "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.48.0" "1.49" "1.50.0" 
"1.50"
     "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" "1.55.0" 
"1.55"
-    "1.56.0" "1.56"
+    "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58"
 )
 FIND_PACKAGE(Boost 1.46 COMPONENTS ${BOOST_REQUIRED_COMPONENTS})

------------------------------------------------------------------
$cat patches/patch-host_include_uhd_deprecated_hpp

$OpenBSD$
--- include/uhd/deprecated.hpp.orig     Fri Feb 26 23:09:12 2016
+++ include/uhd/deprecated.hpp  Fri Feb 26 23:09:41 2016
@@ -22,6 +22,7 @@
 #ifndef INCLUDED_UHD_TYPES_OTW_TYPE_HPP
 #define INCLUDED_UHD_TYPES_OTW_TYPE_HPP
 
+#include <cstddef>
 #include <uhd/config.hpp>
 
 namespace uhd{

------------------------------------------------------------------
$ cat patches/patch-host_include_uhd_types_ref_vector_hpp

$OpenBSD$
--- include/uhd/types/ref_vector.hpp.orig       Fri Feb 26 23:14:28 2016
+++ include/uhd/types/ref_vector.hpp    Fri Feb 26 23:14:49 2016
@@ -18,6 +18,7 @@
 #ifndef INCLUDED_UHD_TYPES_REF_VECTOR_HPP
 #define INCLUDED_UHD_TYPES_REF_VECTOR_HPP
 
+#include <cstddef>
 #include <uhd/config.hpp>
 
 namespace uhd{

------------------------------------------------------------------
$cat build-shared.sh

#!/bin/sh -v
# Ettus Research UHD driver for USRP devices

echo "\n### Installing packages..."
# build time libraries: cmake, doxygen (optional), py-mako & py-docutils
# build time + runtime libraries: libusb1, boost, python
#pkg_add doxygen
pkg_add libusb1 cmake python-2.7.13p0
ln -sf /usr/local/bin/python2.7 /usr/local/bin/python2
ln -sf /usr/local/bin/python2.7 /usr/local/bin/python
pkg_add py-setuptools py-pip
pip install mako docutils

UHD_ROOT=$(pwd)
UHD_INSTDIR=/usr/local
BOOST_PREFIX="${UHD_ROOT}/build/boost"
BVER=1.58.0
mkdir -p build

echo "\n### Building boost..."
mkdir -p $BOOST_PREFIX
tar -zxf boost-$BVER.tar.gz
cd boost-$BVER
echo 'using gcc : : g++ : <cxxflags>"-fvisibility=hidden -fPIC"
<linkflags>"" <archiver>"ar" <striper>"strip" <ranlib>"ranlib" <rc>"" :
;' > user-config.jam
BOOST_CONF="runtime-link=shared threadapi=pthread threading=multi
link=shared variant=release --layout=tagged --build-type=complete
--user-config=user-config.jam -sNO_BZIP2=1"
./bootstrap.sh --without-icu
--with-libraries=date_time,filesystem,program_options,regex,system,thread,test,serialization
./b2 -d2 -j2 -d1 ${BOOST_CONF} --prefix=$BOOST_PREFIX stage
./b2 -d0 -j4 ${BOOST_CONF} --prefix=$BOOST_PREFIX install

echo "\n### Building UHD..."
cd $UHD_ROOT
patch -p0 < patches/patch-host_include_uhd_deprecated_hpp
patch -p0 < patches/patch-host_include_uhd_types_ref_vector_hpp
patch -p0 < patches/CMakeLists.txt.patch
cd $UHD_ROOT/build
cmake -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true -DENABLE_LIBUHD=ON
-DENABLE_C_API=ON -DENABLE_EXAMPLES=ON -DENABLE_UTILS=ON
-DENABLE_MANPAGES=ON -DENABLE_TESTS=ON -DENABLE_MANUAL=OFF
-DENABLE_DOXYGEN=OFF -DENABLE_MANPAGES=ON -DENABLE_USB=ON
-DENABLE_GPSD=OFF -DENABLE_USRP1=OFF -DENABLE_USRP2=ON -DENABLE_B100=OFF
-DENABLE_E100=OFF -DENABLE_E300=OFF -DENABLE_X300=OFF -DENABLE_B200=ON
-DENABLE_OCTOCLOCK=OFF -DBoost_NO_SYSTEM_PATHS=OFF -DBoost_DEBUG=OFF
-DBOOST_ROOT=$BOOST_PREFIX -DBOOST_INCLUDEDIR=$BOOST_PREFIX/include
-DBOOST_LIBRARYDIR=$BOOST_PREFIX/lib -DENABLE_STATIC_LIBS=OFF
-DCMAKE_INSTALL_PREFIX=$UHD_INSTDIR ../
make
make test
make install

echo "\n### UHD driver was installed in /usr/local"
echo "### to remove the driver use 'uhd_uninstall.sh'"
echo "### from uhd-x.x.x/host"
------------------------------------------------------------------

$cat build-static.sh

#!/bin/sh -v
# Ettus Research UHD driver for USRP devices

echo "\n### Installing packages..."
# build time libraries: cmake, doxygen (optional), py-mako & py-docutils
# build time + runtime libraries: libusb1, boost, python
#pkg_add doxygen
pkg_add libusb1 cmake python-2.7.13p0
ln -sf /usr/local/bin/python2.7 /usr/local/bin/python2
ln -sf /usr/local/bin/python2.7 /usr/local/bin/python
pkg_add py-setuptools py-pip
pip install mako docutils

UHD_ROOT=$(pwd)
UHD_INSTDIR=/usr/local
BOOST_PREFIX="${UHD_ROOT}/build/boost"
BVER=1.58.0
mkdir -p build

echo "\n### Building boost..."
mkdir -p $BOOST_PREFIX
tar -zxf boost-$BVER.tar.gz
cd boost-$BVER
echo 'using gcc : : g++ : <cxxflags>"-fvisibility=hidden -fPIC"
<linkflags>"" <archiver>"ar" <striper>"strip" <ranlib>"ranlib" <rc>"" :
;' > user-config.jam
BOOST_CONF="runtime-link=shared threadapi=pthread threading=multi
link=static variant=release --layout=tagged --build-type=complete
--user-config=user-config.jam -sNO_BZIP2=1"
./bootstrap.sh --without-icu
--with-libraries=date_time,filesystem,program_options,regex,system,thread,test,serialization
./b2 -d2 -j2 -d1 ${BOOST_CONF} --prefix=$BOOST_PREFIX stage
./b2 -d0 -j4 ${BOOST_CONF} --prefix=$BOOST_PREFIX install

echo "\n### Building UHD..."
cd $UHD_ROOT
patch -p0 < patches/patch-host_include_uhd_deprecated_hpp
patch -p0 < patches/patch-host_include_uhd_types_ref_vector_hpp
patch -p0 < patches/CMakeLists.txt.patch
cd $UHD_ROOT/build
cmake -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true -DENABLE_LIBUHD=ON
-DENABLE_C_API=ON -DENABLE_EXAMPLES=ON -DENABLE_UTILS=ON
-DENABLE_MANPAGES=ON -DENABLE_TESTS=ON -DENABLE_MANUAL=OFF
-DENABLE_DOXYGEN=OFF -DENABLE_MANPAGES=ON -DENABLE_USB=ON
-DENABLE_GPSD=OFF -DENABLE_USRP1=OFF -DENABLE_USRP2=ON -DENABLE_B100=OFF
-DENABLE_E100=OFF -DENABLE_E300=OFF -DENABLE_X300=OFF -DENABLE_B200=ON
-DENABLE_OCTOCLOCK=OFF -DBoost_NO_SYSTEM_PATHS=ON -DBoost_DEBUG=OFF
-DBOOST_ROOT=$BOOST_PREFIX -DBOOST_INCLUDEDIR=$BOOST_PREFIX/include
-DBOOST_LIBRARYDIR=$BOOST_PREFIX/lib -DENABLE_STATIC_LIBS=ON
-DCMAKE_INSTALL_PREFIX=$UHD_INSTDIR ../
make
make test
make install

echo "\n### UHD driver was installed in /usr/local"
echo "### to remove the driver use 'uhd-uninstall.sh'"
echo "### from uhd-x.x.x/host"
------------------------------------------------------------------

$ cat uninstall.sh

#!/bin/sh -v
# Uninstall Ettus Research UHD driver for USRP devices

UHD_INSTDIR=/usr/local

rm -rf $UHD_INSTDIR/bin/uhd_*
rm -rf $UHD_INSTDIR/bin/usrp_*
rm -rf $UHD_INSTDIR/include/uhd
rm -rf $UHD_INSTDIR/include/uhd.h
rm -rf $UHD_INSTDIR/lib/libuhd.{so*,a}
rm -rf $UHD_INSTDIR/lib/cmake/uhd
rm -rf $UHD_INSTDIR/lib/pkgconfig/uhd.pc
rm -rf $UHD_INSTDIR/lib/uhd
rm -rf $UHD_INSTDIR/share/uhd
rm -rf $UHD_INSTDIR/share/doc/uhd
rm -rf $UHD_INSTDIR/share/man/man1/{octoclock_*,uhd_*,usrp2_*,usrp_*}

echo "\n### UHD driver has been uninstalled"
------------------------------------------------------------------

Can help to make some tests using Ettus Research B210 and N210
hardware platforms to improve the UHD driver port.

Also, I'm very in interesting in porting GNUradio with all the modules, 
especially
listed below:
gr-uhd
gr-qtgui
gnuradio-companion

Denis



Reply via email to