Fixes compilation issues on Mac OS X. Now it builds successfully against gnuradio installed by Macports and using gcc 4.8. Upgrade version of Gtest. Some fixes and updates in documentation and code cleaning.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@423 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2013-10-18 18:26:06 +00:00
parent 806af3e98f
commit 2972272b3e
23 changed files with 12691 additions and 387 deletions

View File

@ -418,6 +418,14 @@ if(NOT ARMADILLO_FOUND)
endif(NOT ARMADILLO_FOUND)
########################################################################
# OpenCL
########################################################################
find_package(OpenCL)
################################################################################
# Setup of optional drivers
################################################################################
@ -441,6 +449,8 @@ if( $ENV{RTLSDR_DRIVER} )
endif($ENV{RTLSDR_DRIVER} )
########################################################################
# Setup the include paths
########################################################################
@ -460,6 +470,8 @@ endif($ENV{RTLSDR_DRIVER} )
#)
########################################################################
# Set compiler flags
########################################################################
@ -470,7 +482,7 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++0x")
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wno-c++11-narrowing")
#set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wno-c++11-narrowing")
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Add warning flags

37
README
View File

@ -5,7 +5,7 @@ This document describes how to set up the compilation environment and build GNSS
GNU/Linux
-----------------------------------------------------------
Tested distributions: Ubuntu 12.04 (32 and 64 bits), Debian 6.0.6, Fedora 18
Tested distributions: Ubuntu 12.04 (32 and 64 bits), Debian 6.0.6, Fedora 18 (newer versions should work, too)
* Install GNU Radio:
@ -29,9 +29,9 @@ In order to avoid defining these variables each time you enter a session, you ma
- Download, compile, and install the Armadillo linear algebra library
$ sudo apt-get install libatlas-dev
$ wget http://sourceforge.net/projects/arma/files/armadillo-3.6.1.tar.gz
$ tar xvfz armadillo-3.6.1.tar.gz
$ cd armadillo-3.6.1
$ wget http://sourceforge.net/projects/arma/files/armadillo-3.900.7.tar.gz
$ tar xvfz armadillo-3.900.7.tar.gz
$ cd armadillo-3.900.7
$ cmake .
$ make
$ sudo make install
@ -41,9 +41,9 @@ The full stop separated from "cmake" by a space is important. CMake will figure
- Download, unzip, configure, build and install gperftools, a set of performance analysis tools:
$ wget http://gperftools.googlecode.com/files/gperftools-2.0.tar.gz
$ tar xvfz gperftools-2.0.tar.gz
$ cd gperftools-2.0
$ wget http://gperftools.googlecode.com/files/gperftools-2.1.tar.gz
$ tar xvfz gperftools-2.1.tar.gz
$ cd gperftools-2.1
$ ./configure --enable-frame-pointers
$ make
$ sudo make install
@ -51,17 +51,17 @@ $ sudo make install
- Download, unzip, configure, and build Google C++ Testing Framework (also known as Google Test):
$ wget http://googletest.googlecode.com/files/gtest-1.6.0.zip
$ unzip gtest-1.6.0.zip
$ cd gtest-1.6.0
$ wget http://googletest.googlecode.com/files/gtest-1.7.0.zip
$ unzip gtest-1.7.0.zip
$ cd gtest-1.7.0
$ ./configure
$ make
Please DO NOT install gtest (do not do "sudo make install"). Every user needs to compile his tests using the same compiler flags used to compile the installed Google Test libraries; otherwise he may run into undefined behaviors (i.e. the tests can behave strangely and may even crash for no obvious reasons). The reason is that C++ has this thing called the One-Definition Rule: if two C++ source files contain different definitions of the same class/function/variable, and you link them together, you violate the rule. The linker may or may not catch the error (in many cases it is not required by the C++ standard to catch the violation). If it does not, you get strange run-time behaviors that are unexpected and hard to debug. If you compile Google Test and your test code using different compiler flags, they may see different definitions of the same class/function/variable (e.g. due to the use of #if in Google Test). Therefore, for your sanity, we recommend to avoid installing pre-compiled Google Test libraries. Instead, each project should compile Google Test itself such that it can be sure that the same flags are used for both Google Test and the tests. The building system of GNSS-SDR does the compilation and linking of gtest its own tests; it is only required that you tell the system where the gtest folder that you downloaded resides. Just add to your $HOME/.bashrc file the following line:
$ export GTEST_DIR=/home/username/gtest-1.6.0
$ export GTEST_DIR=/home/username/gtest-1.7.0
changing /home/username/gtest-1.6.0 by the actual directory where you downloaded gtest. Again, it is recommended to add this line to your $HOME/.bashrc file.
changing /home/username/gtest-1.7.0 by the actual directory where you downloaded gtest. Again, it is recommended to add this line to your $HOME/.bashrc file.
- Download, unzip, configure, build and install Google's gflags package, a commandline flags processing module for C++:
@ -245,8 +245,8 @@ If you have still not installed Apple's Xcode Developer Tools and MacPorts, plea
Once MacPorts is properly installed on your system, open a terminal and type:
$ sudo port install gcc47
$ sudo port select --set gcc mp-gcc47
$ sudo port install gcc48
$ sudo port select --set gcc mp-gcc48
$ sudo port install gnuradio +full
$ sudo port install subversion
$ svn co http://svn.code.sf.net/p/gnss-sdr/code/trunk gnss-sdr
@ -265,15 +265,6 @@ $ open ../docs/html/index.html
WARNING: GNU Radio's VOLK component (which handles vector optimized instructions and routines) compiles best when using GCC.
The default compiler for macports is CLANG, which will result in a fully functioning GNU Radio install but the VOLK component will not utilize the CPU's capabilities.
In order to take advantage of VOLK, compile it with the (rather old) GCC 4.2:
$ sudo port install gnuradio-devel +grc +python27 +uhd +orc +swig +qtgui +wxgui configure.compiler=llvm-gcc-4.2
However, GNSS-SDR cannot be compiled by GCC 4.2. It has been succesfully built with GCC 4.6 and 4.7, and (could) work in 4.5. If you compile GNU Radio with clang, apart from neglecting the benefits of VOLK, then the problem for building GNSS-SDR is Armadillo.
Check out http://llvm.org/bugs/show_bug.cgi?id=14768 in order to see the status of this bottleneck.
GETTING STARTED
---------------

View File

@ -56,11 +56,19 @@ gps_l1_ca_make_pvt_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_queue> q
}
gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, boost::shared_ptr<gr::msg_queue> queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname) :
gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels,
boost::shared_ptr<gr::msg_queue> queue,
bool dump, std::string dump_filename,
int averaging_depth,
bool flag_averaging,
int output_rate_ms,
int display_rate_ms,
bool flag_nmea_tty_port,
std::string nmea_dump_filename,
std::string nmea_dump_devname) :
gr::block("gps_l1_ca_pvt_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
gr::io_signature::make(1, 1, sizeof(gr_complex)) )
{
d_output_rate_ms = output_rate_ms;
d_display_rate_ms = display_rate_ms;
d_queue = queue;

View File

@ -50,11 +50,17 @@ include_directories(
${GNURADIO_RUNTIME_INCLUDE_DIRS}
)
if(OPENCL_FOUND)
include_directories( ${OPENCL_INCLUDE_DIRS} )
if(OS_IS_MACOSX)
set(OPT_LIBRARIES ${OPT_LIBRARIES} "-framework OpenCL")
else(OS_IS_MACOSX)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${OPENCL_LIBRARIES})
endif(OS_IS_MACOSX)
endif(OPENCL_FOUND)
add_library(acq_gr_blocks ${ACQ_GR_BLOCKS_SOURCES})
target_link_libraries(acq_gr_blocks gnss_sp_libs gnss_system_parameters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${VOLK_LIBRARIES} ${OPT_LIBRARIES})

View File

@ -63,8 +63,8 @@
#include "fft_internal.h"
#include "gnss_synchro.h"
#ifdef APPLE
#include <OpenCL/cl.hpp>
#ifdef __APPLE__
#include "cl.hpp"
#else
#include <CL/cl.hpp>
#endif

View File

@ -16,17 +16,6 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
#if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
#set(GNSS_SPLIBS_SOURCES
# galileo_e1_signal_processing.cc
# gnss_sdr_valve.cc
# gnss_signal_processing.cc
# gps_sdr_signal_processing.cc
# pass_through.cc
#)
#else(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
#endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(OPENCL_FOUND)
set(GNSS_SPLIBS_SOURCES
galileo_e1_signal_processing.cc
@ -62,7 +51,11 @@ include_directories(
if(OPENCL_FOUND)
include_directories( ${OPENCL_INCLUDE_DIRS} )
if(OS_IS_MACOSX)
set(OPT_LIBRARIES ${OPT_LIBRARIES} "-framework OpenCL")
else(OS_IS_MACOSX)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${OPENCL_LIBRARIES})
endif(OS_IS_MACOSX)
endif(OPENCL_FOUND)
add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES})

12305
src/algorithms/libs/cl.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -55,8 +55,8 @@ extern "C" {
#include <stdio.h>
#ifdef APPLE
#include <OpenCL/cl.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif

View File

@ -77,7 +77,6 @@ public:
gr::basic_block_sptr get_right_block();
private:
//gr_block_sptr sink_;
gr::blocks::null_sink::sptr sink_;
size_t item_size_;
std::string item_type_;

View File

@ -157,7 +157,6 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
if (dump_)
{
//sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")";
}
@ -298,7 +297,6 @@ void FileSignalSource::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr FileSignalSource::get_left_block()
{
LOG_AT_LEVEL(WARNING) << "Left block of a signal source should not be retrieved";
//return gr_block_sptr();
return gr::blocks::file_source::sptr();
}

View File

@ -46,8 +46,9 @@
#include "gnss_synchro.h"
#ifndef _lrotl
#define _lrotl(X,N) ((X << N) ^ (X >> (32-N))) // Used in the parity check algorithm
#endif
using google::LogMessage;
/*!

View File

@ -1,5 +1,5 @@
/*!
* \file supl_client.h
* \file gnss_sdr_supl_client.h
* \brief class that implements a C++ interface to external Secure User Location Protocol (SUPL) client library.
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*

View File

@ -1,11 +1,11 @@
/*!
* \file concurrent_queue.h
* \file concurrent_map.h
* \brief Interface of a thread-safe std::map
* \author Javier Arribas, 2011. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver

View File

@ -1,6 +1,6 @@
/*!
* \file gps_almanac.h
* \brief Interface of a GPS ALMANAC storage
* \file galileo_almanac.h
* \brief Interface of a Galileo ALMANAC storage
* \author Javier Arribas, 2013. jarribas(at)cttc.es
* \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
* -------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*!
* \file gps_ephemeris.cc
* \file galileo_ephemeris.cc
* \brief Interface of a GPS EPHEMERIS storage and orbital model functions
*
* See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II
@ -103,7 +103,6 @@ double Galileo_Ephemeris::Galileo_System_Time(double WN, double TOW){
t = WN*sec_in_day*day_in_week + TOW; // second from the origin of the Galileo time
return t;
}
@ -268,6 +267,4 @@ void Galileo_Ephemeris::satellitePosition(double transmitTime) //when this funct
galileo_satvel_X = - Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + galileo_satpos_X * cos(Omega) - galileo_satpos_Y * cos(i) * sin(Omega);
galileo_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + galileo_satpos_X * sin(Omega) + galileo_satpos_Y * cos(i) * cos(Omega);
galileo_satvel_Z = galileo_satpos_Y * sin(i);
}

View File

@ -1,8 +1,7 @@
/*!
* \file gps_iono.cc
* \file galileo_iono.cc
* \brief Interface of a GPS IONOSPHERIC MODEL storage
*
* See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
/*
* \file gps_utc_model.h
* \brief Interface of a GPS UTC MODEL storage
* \file galileo_utc_model.h
* \brief Interface of a Galileo UTC MODEL storage
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
@ -110,6 +110,5 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int WN)
double secondsOfWeekBeforeToday = 43200 * floor(t_e / 43200);
t_Utc = secondsOfWeekBeforeToday + t_Utc_daytime;
return t_Utc;
}

View File

@ -1,6 +1,6 @@
/*!
* \file gps_utc_model.h
* \brief Interface of a GPS UTC MODEL storage
* \file galileo_utc_model.h
* \brief Interface of a Galileo UTC MODEL storage
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
*
@ -45,7 +45,6 @@
class Galileo_Utc_Model
{
public:
//bool valid;
/*Word type 6: GST-UTC conversion parameters*/
double A0_6;
@ -59,15 +58,11 @@ public:
bool flag_utc_model;
//double TOW_6;
double GST_to_UTC_time(double t_e, int WN);
/*!
* Default constructor
*/
Galileo_Utc_Model();
};
#endif

View File

@ -1,5 +1,5 @@
/*!
* \file gps_navigation_message.h
* \file gps_ephemeris.h
* \brief Interface of a GPS EPHEMERIS storage
* \author Javier Arribas, 2013. jarribas(at)cttc.es
*
@ -47,7 +47,6 @@
class Gps_Ephemeris
{
private:
/*
* Accounts for the beginning or end of week crossover
*
@ -57,9 +56,7 @@ private:
*/
double check_t(double time);
public:
unsigned int i_satellite_PRN; // SV PRN NUMBER
double d_TOW; //!< Time of GPS Week of the ephemeris set (taken from subframes TOW) [s]
double d_Crs; //!< Amplitude of the Sine Harmonic Correction Term to the Orbit Radius [m]

View File

@ -35,11 +35,11 @@ add_definitions( -DGNSS_SDR_VERSION="${VERSION}" )
if(OS_IS_MACOSX)
# Tell the linker where the libraries installed by MacPorts are
link_directories( /opt/local/lib )
link_directories( /opt/local/lib ) # Not very elegant, to be fixed
endif(OS_IS_MACOSX)
add_executable(gnss-sdr ${CMAKE_CURRENT_SOURCE_DIR}/main.cc)
target_link_libraries(gnss-sdr ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GFlags_LIBS} ${GLOG_LIBRARIES} ${ARMADILLO_LIBRARIES} gnss_sp_libs gnss_rx)
target_link_libraries(gnss-sdr ${MAC_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GFlags_LIBS} ${GLOG_LIBRARIES} ${ARMADILLO_LIBRARIES} gnss_sp_libs gnss_rx)
install(TARGETS gnss-sdr

View File

@ -24,12 +24,12 @@ endif(NOT EXISTS GTEST_DIR_LOCAL)
if(NOT GTEST_DIR_LOCAL)
# if GTEST_DIR is not defined, we download and build it
set(gtest_RELEASE 1.6.0)
set(gtest_RELEASE 1.7.0)
ExternalProject_Add(
gtest-${gtest_RELEASE}
URL http://googletest.googlecode.com/files/gtest-${gtest_RELEASE}.zip
DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../download/gtest-${gtest_RELEASE}
URL_MD5 "4577b49f2973c90bf9ba69aa8166b786"
URL_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7"
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gtest/gtest-${gtest_RELEASE}
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../gtest-${gtest_RELEASE}
UPDATE_COMMAND ""
@ -88,7 +88,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/algorithms/output_filter/adapters
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
# ${GNURADIO_RUNTIME_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
@ -100,7 +100,11 @@ find_library(
/usr/lib
/usr/lib64
)
if(OS_IS_MACOSX)
# Tell the linker where the libraries installed by MacPorts are
link_directories( /opt/local/lib ) # not very elegant, to be fixed
# set(MAC_LIBRARIES sdtc++)
endif(OS_IS_MACOSX)
add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc)
target_link_libraries(run_tests ${Boost_LIBRARIES} ${GFLAGS_LIBS} ${GLOG_LIBRARIES} ${GTEST_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_ANALOG_LIBRARIES} gnss_sp_libs gnss_rx)