RH support for frontend::OutDigitalTunerPort appears missing most FEI functions - redhawksdr

I have a component which uses frontend::OutDigitalTunerPort to make FEI calls to a RH device. Here is the generated code in XXX_base.cpp:
device_fei_out = new frontend::OutDigitalTunerPort("device_fei_out");
addPort("device_fei_out", device_fei_out);
Here is a sample usage which compiles properly:
device_fei_out->setTunerOutputSampleRate(id, freq);
Here is a sample usage which does NOT compile:
device_fei_out->setTunerCenterFrequency(id);
Apparently this FEI call is not defined in the appropriate template definitions - the compile bug points to /usr/local/redhawk/core/include/frontend/fe_tuner_port_impl.h.
Looking at this code - I can see that only the working FEI call above is defined in the following classes:
OutDigitalTunerPortT
digital_tuner_delegation
Where ALL other "set" FEI functions are defined in:
OutAnalogTunerPortT
analog_tuner_delegation
So does this mean that frontend::OutDigitalTunerPort only supports this one "set" function ? How else can I make all the FEI calls to RH device ?
Below is one of the compile error details - there is similar for 'operator !=' :
/usr/local/redhawk/core/include/frontend/fe_tuner_port_impl.h:329: error: no match for ‘operator=’ in ‘i = ((frontend::OutAnalogTunerPortT<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>*)this)->frontend::OutAnalogTunerPortT<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>::.frontend::OutFrontendTunerPortT<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>::.frontend::OutFrontendPort<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>::outConnections.std::vector<_Tp, _Alloc>::begin with _Tp = std::pair<_CORBA_ObjRef_Var, std::basic_string, std::allocator > >, _Alloc = std::allocator, std::basic_string, std::allocator > > >’
double freq=0.5;
std::string id1("usrp-to-wavemaster");
device_fei_out->setTunerCenterFrequency(id1, freq);
/usr/local/redhawk/core/include/frontend/fe_tuner_port_impl.h: In member function ‘void frontend::OutAnalogTunerPortT::setTunerCenterFrequency(std::string&, double) [with PortType_var = _CORBA_ObjRef_Var, PortType = FRONTEND::DigitalTuner]’:
WaveformMaster.cpp:124: instantiated from here
/usr/local/redhawk/core/include/frontend/fe_tuner_port_impl.h:329: error: no match for ‘operator=’ in ‘i = ((frontend::OutAnalogTunerPortT<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>)this)->frontend::OutAnalogTunerPortT<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>::.frontend::OutFrontendTunerPortT<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>::.frontend::OutFrontendPort<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>::outConnections.std::vector<_Tp, _Alloc>::begin with _Tp = std::pair<_CORBA_ObjRef_Var, std::basic_string, std::allocator > >, _Alloc = std::allocator, std::basic_string, std::allocator > > >’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_iterator.h:669: note: candidates are: __gnu_cxx::__normal_iterator, std::basic_string, std::allocator > >, std::vector, std::basic_string, std::allocator > >, std::allocator, std::basic_string, std::allocator > > > > >& __gnu_cxx::__normal_iterator, std::basic_string, std::allocator > >, std::vector, std::basic_string, std::allocator > >, std::allocator, std::basic_string, std::allocator > > > > >::operator=(const __gnu_cxx::__normal_iterator, std::basic_string, std::allocator > >, std::vector, std::basic_string, std::allocator > >, std::allocator, std::basic_string, std::allocator > > > > >&)
WaveformMaster.cpp:124: instantiated from here
/usr/local/redhawk/core/include/frontend/fe_tuner_port_impl.h:329: error: no match for ‘operator!=’ in ‘i != ((frontend::OutAnalogTunerPortT<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>*)this)->frontend::OutAnalogTunerPortT<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>::.frontend::OutFrontendTunerPortT<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>::.frontend::OutFrontendPort<_CORBA_ObjRef_Var, FRONTEND::DigitalTuner>::outConnections.std::vector<_Tp, _Alloc>::end with _Tp = std::pair<_CORBA_ObjRef_Var, std::basic_string, std::allocator > >, _Alloc = std::allocator, std::basic_string, std::allocator > > >’
/usr/include/omniORB4/fixed.h:57: note: candidates are: CORBA::Boolean operator!=(const CORBA::Fixed&, const CORBA::Fixed&)
/usr/local/redhawk/core/include/bulkio/bulkio_out_port.h:718: note: bool operator!=(const bulkio::connection_descriptor_struct&, const bulkio::connection_descriptor_struct&)
/usr/local/redhawk/core/include/frontend/fe_tuner_struct_props.h:116: note: bool operator!=(const frontend::frontend_tuner_allocation_struct&, const frontend::frontend_tuner_allocation_struct&)
/usr/local/redhawk/core/include/frontend/fe_tuner_struct_props.h:173: note: bool operator!=(const frontend::frontend_listener_allocation_struct&, const frontend::frontend_listener_allocation_struct&)
/usr/local/redhawk/core/include/frontend/fe_tuner_struct_props.h:272: note: bool operator!=(const frontend::default_frontend_tuner_status_struct_struct&, const frontend::default_frontend_tuner_status_struct_struct&)
/usr/local/redhawk/core/include/frontend/fe_tuner_struct_props.h:308: note: bool operator!=(const std::vector >&, const std::vector >&)
/usr/local/redhawk/core/include/frontend/fe_tuner_port_impl.h: In member function ‘void frontend::OutAnalogTunerPortT::setTunerBandwidth(std::string&, double) [with PortType_var = _CORBA_ObjRef_Var, PortType = FRONTEND::DigitalTuner]’:

The setTunerCenterFrequency(..) function takes in two arguments (std::string& id, double freq), you are calling with just id, this might be the cause of your compile problem. If this is not the cause of your problem, please provide more details of your source code and all error output along with the REDHAWK version that you are using.
OutDigitalTunerPort supports all the OutAnalogTunerPortT functions. OutDigitalTunerPort inherits from OutDigitalTunerPortT which inherits from OutAnalogTunerPortT (so yes, it has all the functions of OutAnalogTunerPort plus the addition of the getTunerOutputSampleRate and setTunerOutputSampleRate functions).

Related

Warnings when installing R package with Rcpp

I am tring to build an R package with Rcpp using Rstudio. When I click "install and restart", Rstudio outputs hundreds of warning information and I cannot easily find the error information. I tried to find out reason to avoid the warning information but failed. It seems the warnings are from Rcpp package. BTW, the package can still work.
The below is the additional options for R CMD INSTALL
--no-multiarch --with-keep.source
The information can be replicated using the below commands
library(devtools) # author version: 2.3.0, use install.packages("devtools") first
install_github("GeneticAnalysisinBiobanks/GRAB", INSTALL_opts=c("--no-multiarch")) # The INSTALL_opts is required in Windows OS.
My working environment:
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_2.4.2 usethis_2.0.1
loaded via a namespace (and not attached):
[1] rstudioapi_0.13 magrittr_2.0.1 pkgload_1.2.1 R6_2.5.0
[5] rlang_0.4.11 fastmap_1.1.0 tools_4.1.0 pkgbuild_1.2.0
[9] sessioninfo_1.1.1 cli_3.0.0 withr_2.4.2 ellipsis_0.3.2
[13] remotes_2.4.0 rprojroot_2.0.2 lifecycle_1.0.0 crayon_1.4.1
[17] processx_3.5.2 purrr_0.3.4 callr_3.7.0 fs_1.5.0
[21] ps_1.6.0 curl_4.3.1 testthat_3.0.4 memoise_2.0.0
[25] glue_1.4.2 cachem_1.0.5 compiler_4.1.0 desc_1.3.0
[29] prettyunits_1.1.1
The below include the warning information when I install and restart the package.
In file included from C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/RcppCommon.h:118,
from C:/Users/wenjianb/Documents/R/win-library/4.1/RcppArmadillo/include/RcppArmadilloForward.h:26,
from C:/Users/wenjianb/Documents/R/win-library/4.1/RcppArmadillo/include/RcppArmadillo.h:31,
from RcppExports.cpp:4:
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h: In function 'const char* Rcpp::type2name(SEXP)':
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h:70:73: warning: cast between incompatible function types from 'DL_FUNC' {aka 'void* (*)()'} to 'Fun' {aka 'const char* (*)(SEXPREC*)'} [-Wcast-function-type]
#define GET_CALLABLE(__FUN__) (Fun) R_GetCCallable( "Rcpp", __FUN__ )
^
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h:74:26: note: in expansion of macro 'GET_CALLABLE'
static Fun fun = GET_CALLABLE("type2name");
^~~~~~~~~~~~
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h: In function 'long unsigned int Rcpp::internal::enterRNGScope()':
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h:70:73: warning: cast between incompatible function types from 'DL_FUNC' {aka 'void* (*)()'} to 'Fun' {aka 'long unsigned int (*)()'} [-Wcast-function-type]
#define GET_CALLABLE(__FUN__) (Fun) R_GetCCallable( "Rcpp", __FUN__ )
^
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h:81:30: note: in expansion of macro 'GET_CALLABLE'
static Fun fun = GET_CALLABLE("enterRNGScope");
^~~~~~~~~~~~
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h: In function 'long unsigned int Rcpp::internal::exitRNGScope()':
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h:70:73: warning: cast between incompatible function types from 'DL_FUNC' {aka 'void* (*)()'} to 'Fun' {aka 'long unsigned int (*)()'} [-Wcast-function-type]
#define GET_CALLABLE(__FUN__) (Fun) R_GetCCallable( "Rcpp", __FUN__ )
^
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h:87:30: note: in expansion of macro 'GET_CALLABLE'
static Fun fun = GET_CALLABLE("exitRNGScope");
^~~~~~~~~~~~
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h: In function 'long unsigned int Rcpp::internal::beginSuspendRNGSynchronization()':
C:/Users/wenjianb/Documents/R/win-library/4.1/Rcpp/include/Rcpp/routines.h:70:73: warning: cast between incompatible function types from 'DL_FUNC' {aka 'void* (*)()'} to 'Fun' {aka 'long unsigned int (*)()'} [-Wcast-function-type]
#define GET_CALLABLE(__FUN__) (Fun) R_GetCCallable( "Rcpp", __FUN__ )
^
The other warnings are all similar to the above.
Thank you all in advance.
Wenjian

Error when using tbb::parallel_for

I'm having an error when I'm using parallel_for of the TBB library. I can't understand why..
I have been able to use tbb::atomic so i'm guessing this in not a linking problem.
Here is the part of my code where i use tbb :
auto values = std::vector<double>(10);
tbb::parallel_for( tbb::blocked_range<int>(0,values.size()),
[&](tbb::blocked_range<int> r)
{
for (int i=r.begin(); i<r.end(); ++i)
{
values[i] = std::sin(i * 0.001);
}
});
double total = 0;
for (double value : values)
{
total += value;
}
std::cout << total << std::endl;
I took some example on the Internet, to debug more easily.
Here is my includes, i tried to add tbb::task but it didn't worked.
#include "interval_map_estimator.h"
#include "interval_map_estimation.h"
#include <stdlib.h>
#include <boost/numeric/ublas/matrix.hpp>
//Antoine
#include <chrono>
#include <boost/thread/thread.hpp>
#include <tbb/parallel_for.h>
#include <tbb/task.h>
#include <iostream>
And here on of the two errors i get (they are the same)
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `tbb::interface9::internal::start_for<tbb::blocked_range<int>, IntervalMapEstimation::IntervalMapEstimator::extract_relevant_points_multithread(std::vector<IntervalMapEstimation::Point3D, std::allocator<IntervalMapEstimation::Point3D> >&, std::vector<IntervalMapEstimation::Point3D, std::allocator<IntervalMapEstimation::Point3D> >&, double, double)::{lambda(tbb::blocked_range<int>)#1}, tbb::auto_partitioner const>::run(tbb::blocked_range<int> const&, {lambda(tbb::blocked_range<int>)#1} const&, tbb::auto_partitioner&)':
/usr/include/tbb/parallel_for.h:87: undefined reference to `tbb::task_group_context::~task_group_context()'
/usr/include/tbb/parallel_for.h:87: undefined reference to `tbb::task_group_context::~task_group_context()'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o):(.data.rel.ro+0x18): undefined reference to `typeinfo for tbb::task'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `tbb::task_group_context::task_group_context(tbb::task_group_context::kind_type, unsigned long)':
/usr/include/tbb/task.h:450: undefined reference to `tbb::task_group_context::init()'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `tbb::task::task()':
/usr/include/tbb/task.h:556: undefined reference to `vtable for tbb::task'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `tbb::task::~task()':
/usr/include/tbb/task.h:560: undefined reference to `vtable for tbb::task'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `tbb::task::is_cancelled() const':
/usr/include/tbb/task.h:862: undefined reference to `tbb::task_group_context::is_group_execution_cancelled() const'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `operator new(unsigned long, tbb::internal::allocate_root_with_context_proxy const&)':
/usr/include/tbb/task.h:1005: undefined reference to `tbb::internal::allocate_root_with_context_proxy::allocate(unsigned long) const'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `operator delete(void*, tbb::internal::allocate_root_with_context_proxy const&)':
/usr/include/tbb/task.h:1009: undefined reference to `tbb::internal::allocate_root_with_context_proxy::free(tbb::task&) const'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `operator new(unsigned long, tbb::internal::allocate_continuation_proxy const&)':
/usr/include/tbb/task.h:1014: undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `operator delete(void*, tbb::internal::allocate_continuation_proxy const&)':
/usr/include/tbb/task.h:1018: undefined reference to `tbb::internal::allocate_continuation_proxy::free(tbb::task&) const'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `tbb::interface9::internal::allocate_sibling(tbb::task*, unsigned long)':
/usr/include/tbb/parallel_for.h:120: undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o): In function `tbb::interface9::internal::adaptive_mode<tbb::interface9::internal::auto_partition_type>::adaptive_mode()':
/usr/include/tbb/partitioner.h:272: undefined reference to `tbb::internal::get_initial_auto_partitioner_divisor()'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o):(.data.rel.ro._ZTVN3tbb10interface98internal9flag_taskE[_ZTVN3tbb10interface98internal9flag_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
/home/catkin_ws/SWC_INTERVAL_MAP/devel/lib/libinterval_map_logic.a(interval_map_estimator.cpp.o):(.data.rel.ro._ZTIN3tbb10interface98internal9flag_taskE[_ZTIN3tbb10interface98internal9flag_taskE]+0x10): undefined reference to `typeinfo for tbb::task'
collect2: error: ld returned 1 exit status
If you have any suggestions it would be very welcomed :)

CGAL filtered kernel without lazy evaluation

I've been studying CGAL and I am having trouble trying to define a kernel that satisfies what I need.
I need a kernel that is thread safe but, at the same time, I want to store exact coordinates.
If I understood CGAL documentation correctly:
The exact_predicates_inexact_constructions_kernel is thread safe, but it stores coordinates as double values.
The exact_predicates_exact_constructions_kernel stores the exact coordinates, but is not thread safe (because of the lazy number type).
CGAL::Simple_cartesian is thread-safe and stores the coordinates exactly. However, it is much slower for my application.
I basically concluded that I need something like:
CGAL::Filtered_kernel<CGAL::Simple_cartesian<mpq_class>>
(a kernel that uses filtered interval arithmetic for performance, stores the exact coordinates (that will be used when the filter fails) and does not use a lazy number type).
I think this kernel would be slower than exact_predicates_exact_constructions_kernel, but it would be thread-safe and much faster than a non-filtered kernel. (furthermore, I think lazy number types would not be so useful for my application because I want to output the exact coordinates anyway and, thus, they will have to be computed at some point -- that is, the only "optimization" I need is fast filtered predicates)
The problem is: I tried to compile a test application with this kernel and the compilation always fails. Is there a reason why I cannot create a filtered kernel that keeps not only the floating-point intervals but also the exact coordinates?
PS: I am using CGAL 4.10 on Linux
Thanks!
Update:
Minimum example that fails:
#include <CGAL/gmpxx.h> //needed to use mpq_class as the field type
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/Lazy_kernel.h>
//typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; //works...
//typedef CGAL::Filtered_kernel<CGAL::Simple_cartesian<double>> Kernel; //works...
//typedef CGAL::Simple_cartesian<mpq_class> Kernel; //works!
//typedef CGAL::Filtered_kernel<CGAL::Simple_cartesian<CGAL::Gmpq>> Kernel; //works! (but Gmpq is not thread safe, while mpq_class is)
typedef CGAL::Filtered_kernel<CGAL::Simple_cartesian<mpq_class>> Kernel;
typedef Kernel::Point_3 Point_3;
int main() {
Point_3 a(0,0,0);
Point_3 b(1,0,0);
Point_3 c(0,1,0);
Point_3 d(1,1,1);
//The code compiles if I remove the line below
CGAL::Orientation orientationP0Triangle = CGAL::orientation(a,b,c,d);
}
Error message:
In file included from /usr/local/include/CGAL/Cartesian_converter.h:35:0,
from /usr/local/include/CGAL/Filtered_kernel.h:27,
from /usr/local/include/CGAL/Exact_predicates_inexact_constructions_kernel.h:29,
from cgalSimpleExample.cpp:2:
/usr/local/include/CGAL/NT_converter.h: In instantiation of ‘NT2 CGAL::NT_converter<NT1, NT2>::operator()(const NT1&) const [with NT1 = __gmp_expr<__mpq_struct [1], __mpq_struct [1]>; NT2 = CGAL::Gmpq]’:
/usr/local/include/CGAL/Cartesian_converter.h:293:45: required from ‘typename K2::Point_3 CGAL::Cartesian_converter<K1, K2, Converter>::operator()(const typename K1::Point_3&) const [with K1 = CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >, CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >; K2 = CGAL::Simple_cartesian<CGAL::Gmpq>; Converter = CGAL::NT_converter<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, CGAL::Gmpq>; typename K2::Point_3 = CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >; typename K1::Point_3 = CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >]’
/usr/local/include/CGAL/Filtered_predicate.h:175:27: required from ‘CGAL::Filtered_predicate<EP, AP, C2E, C2A, Protection>::result_type CGAL::Filtered_predicate<EP, AP, C2E, C2A, Protection>::operator()(const Args& ...) const [with Args = {CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> >, true> >, CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> >, true> >, CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> >, true> >, CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> >, true> >}; EP = CGAL::CartesianKernelFunctors::Orientation_3<CGAL::Simple_cartesian<CGAL::Gmpq> >; AP = CGAL::CartesianKernelFunctors::Orientation_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >; C2E = CGAL::Cartesian_converter<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >, CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >, CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::NT_converter<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, CGAL::Gmpq> >; C2A = CGAL::Cartesian_converter<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >, CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, CGAL::Interval_nt<false> > >; bool Protection = true; CGAL::Filtered_predicate<EP, AP, C2E, C2A, Protection>::result_type = CGAL::Sign]’
/usr/local/include/CGAL/internal/Static_filters/Orientation_3.h:170:41: required from ‘CGAL::internal::Static_filters_predicates::Orientation_3<K_base>::result_type CGAL::internal::Static_filters_predicates::Orientation_3<K_base>::operator()(const Point_3&, const Point_3&, const Point_3&, const Point_3&) const [with K_base = CGAL::Filtered_kernel_base<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >, CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > > >; CGAL::internal::Static_filters_predicates::Orientation_3<K_base>::result_type = CGAL::Sign; CGAL::internal::Static_filters_predicates::Orientation_3<K_base>::Point_3 = CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >]’
/usr/local/include/CGAL/Kernel/global_functions_internal_3.h:860:45: required from ‘typename K::Orientation CGAL::internal::orientation(const typename K::Point_3&, const typename K::Point_3&, const typename K::Point_3&, const typename K::Point_3&, const K&) [with K = CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > >; typename K::Orientation = CGAL::Sign; typename K::Point_3 = CGAL::Point_3<CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > > >]’
/usr/local/include/CGAL/Kernel/global_functions_3.h:1047:47: required from ‘typename K::Orientation CGAL::orientation(const CGAL::Point_3<R>&, const CGAL::Point_3<R>&, const CGAL::Point_3<R>&, const CGAL::Point_3<R>&) [with K = CGAL::Filtered_kernel<CGAL::Simple_cartesian<__gmp_expr<__mpq_struct [1], __mpq_struct [1]> > >; typename K::Orientation = CGAL::Sign]’
cgalSimpleExample.cpp:19:69: required from here
/usr/local/include/CGAL/NT_converter.h:41:21: error: no matching function for call to ‘CGAL::Gmpq::Gmpq(const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>&)’
return NT2(a);
^
/usr/local/include/CGAL/NT_converter.h:41:21: note: candidates are:
In file included from /usr/local/include/CGAL/Gmp_coercion_traits.h:33:0,
from /usr/local/include/CGAL/Gmpz.h:33,
from /usr/local/include/CGAL/internal/Exact_type_selector.h:36,
from /usr/local/include/CGAL/Filtered_kernel.h:35,
from /usr/local/include/CGAL/Exact_predicates_inexact_constructions_kernel.h:29,
from cgalSimpleExample.cpp:2:
/usr/local/include/CGAL/GMP/Gmpq_type.h:193:3: note: CGAL::Gmpq::Gmpq(const string&, int)
Gmpq(const std::string& str, int base = 10)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:193:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘const string& {aka const std::basic_string<char>&}’
/usr/local/include/CGAL/GMP/Gmpq_type.h:174:3: note: CGAL::Gmpq::Gmpq(const CGAL::Gmpfr&)
Gmpq(const Gmpfr &f)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:174:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘const CGAL::Gmpfr&’
/usr/local/include/CGAL/GMP/Gmpq_type.h:168:3: note: CGAL::Gmpq::Gmpq(double)
Gmpq(double d)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:168:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘double’
/usr/local/include/CGAL/GMP/Gmpq_type.h:161:3: note: CGAL::Gmpq::Gmpq(const CGAL::Gmpz&, const CGAL::Gmpz&)
Gmpq(const Gmpz& n, const Gmpz& d)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:161:3: note: candidate expects 2 arguments, 1 provided
/usr/local/include/CGAL/GMP/Gmpq_type.h:155:3: note: CGAL::Gmpq::Gmpq(long unsigned int, long unsigned int)
Gmpq(unsigned long n, unsigned long d)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:155:3: note: candidate expects 2 arguments, 1 provided
/usr/local/include/CGAL/GMP/Gmpq_type.h:149:3: note: CGAL::Gmpq::Gmpq(long int, long unsigned int)
Gmpq(signed long n, unsigned long d)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:149:3: note: candidate expects 2 arguments, 1 provided
/usr/local/include/CGAL/GMP/Gmpq_type.h:139:3: note: CGAL::Gmpq::Gmpq(int, int)
Gmpq(int n, int d)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:139:3: note: candidate expects 2 arguments, 1 provided
/usr/local/include/CGAL/GMP/Gmpq_type.h:136:3: note: CGAL::Gmpq::Gmpq(const CGAL::Gmpz&)
Gmpq(const Gmpz& n)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:136:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘const CGAL::Gmpz&’
/usr/local/include/CGAL/GMP/Gmpq_type.h:124:3: note: CGAL::Gmpq::Gmpq(long long int)
Gmpq(long long n)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:124:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘long long int’
/usr/local/include/CGAL/GMP/Gmpq_type.h:116:3: note: CGAL::Gmpq::Gmpq(long long unsigned int)
Gmpq(unsigned long long n)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:116:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘long long unsigned int’
/usr/local/include/CGAL/GMP/Gmpq_type.h:104:3: note: CGAL::Gmpq::Gmpq(long unsigned int)
Gmpq(unsigned long n)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:104:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘long unsigned int’
/usr/local/include/CGAL/GMP/Gmpq_type.h:101:3: note: CGAL::Gmpq::Gmpq(long int)
Gmpq(long n)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:101:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘long int’
/usr/local/include/CGAL/GMP/Gmpq_type.h:98:3: note: CGAL::Gmpq::Gmpq(unsigned int)
Gmpq(unsigned int n)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:98:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘unsigned int’
/usr/local/include/CGAL/GMP/Gmpq_type.h:95:3: note: CGAL::Gmpq::Gmpq(int)
Gmpq(int n)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:95:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘int’
/usr/local/include/CGAL/GMP/Gmpq_type.h:92:3: note: CGAL::Gmpq::Gmpq(const __mpq_struct*)
Gmpq(const mpq_t q)
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:92:3: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘const __mpq_struct*’
/usr/local/include/CGAL/GMP/Gmpq_type.h:90:3: note: CGAL::Gmpq::Gmpq()
Gmpq() {}
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:90:3: note: candidate expects 0 arguments, 1 provided
/usr/local/include/CGAL/GMP/Gmpq_type.h:69:7: note: CGAL::Gmpq::Gmpq(const CGAL::Gmpq&)
class Gmpq
^
/usr/local/include/CGAL/GMP/Gmpq_type.h:69:7: note: no known conversion for argument 1 from ‘const __gmp_expr<__mpq_struct [1], __mpq_struct [1]>’ to ‘const CGAL::Gmpq&’
I think I found a solution: I should've compiled my program with the flag CGAL_USE_GMPXX

Troubles creating Card.IO binding for Xamarin iOS project

Previously I had made a Card.IO binding manually. It was compiling, so was the project that used it, but it would crash too often.
Now I'm trying to recreate the binding using ObjectiveSharpie from scratch. The binding project compiles but when I reference it from another project I get compiler errors shown below.
It was showing AVFoundation framework items as "Undefined symbols..." so under IOS Build options in Xamarin I have "-cxx" option. I tried various combinations of ways to add frameworks to the project:
- modified [assembly: LinkWith(..., Frameworks="...")] in CardIO binding project. This results in unrecognized CardIO namespace in my main project
- added -gcc_flags "-framework ...". This results in "framework not found" message from the compiler
I finally resolved the AVFoundation by including a using AVFoundation, then requesting the type name of one if its classes so the linker doesn't optimize it away - ugly hack in my book.
In the error below it looks like there are more frameworks missing, on top of that I believe the std::... ones should have been resolved by using the "-cxx" parameter
I'm out of ideas how to make this binding compile and work properly.
Undefined symbols for architecture armv7:
"_AudioServicesPlayAlertSound", referenced from:
-[CardIOCameraViewController vibrate] in libCardIO.a(CardIOCameraViewController.o)
"_CMGetAttachment", referenced from:
-[CardIOVideoStream captureOutput:didOutputSampleBuffer:fromConnection:] in libCardIO.a(CardIOVideoStream.o)
"_CMSampleBufferGetImageBuffer", referenced from:
-[CardIOVideoFrame process] in libCardIO.a(CardIOVideoFrame.o)
"_CVPixelBufferGetBaseAddressOfPlane", referenced from:
+[CardIOIplImage imageFromYCbCrBuffer:plane:] in libCardIO.a(CardIOIplImage.o)
"_CVPixelBufferGetBytesPerRowOfPlane", referenced from:
+[CardIOIplImage imageFromYCbCrBuffer:plane:] in libCardIO.a(CardIOIplImage.o)
"_CVPixelBufferGetHeightOfPlane", referenced from:
+[CardIOIplImage imageFromYCbCrBuffer:plane:] in libCardIO.a(CardIOIplImage.o)
"_CVPixelBufferGetWidthOfPlane", referenced from:
+[CardIOIplImage imageFromYCbCrBuffer:plane:] in libCardIO.a(CardIOIplImage.o)
"_CVPixelBufferLockBaseAddress", referenced from:
-[CardIOVideoFrame process] in libCardIO.a(CardIOVideoFrame.o)
"_CVPixelBufferUnlockBaseAddress", referenced from:
-[CardIOVideoFrame process] in libCardIO.a(CardIOVideoFrame.o)
"_OBJC_CLASS_$_EAGLContext", referenced from:
objc-class-ref in libCardIO.a(CardIOGPURenderer.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find(char const*, unsigned long, unsigned long) const", referenced from:
cv::CommandLineParser::CommandLineParser(int, char const* const*, char const*)in libCardIO.a(cmdparser.o)
(anonymous namespace)::split_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)in libCardIO.a(cmdparser.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find(char, unsigned long) const", referenced from:
cv::CommandLineParser::CommandLineParser(int, char const* const*, char const*)in libCardIO.a(cmdparser.o)
(anonymous namespace)::del_space(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)in libCardIO.a(cmdparser.o)
cv::CommandLineParser::printParams() in libCardIO.a(cmdparser.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::rfind(char, unsigned long) const", referenced from:
(anonymous namespace)::del_space(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)in libCardIO.a(cmdparser.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(char const*) const", referenced from:
cv::CommandLineParser::CommandLineParser(int, char const* const*, char const*)in libCardIO.a(cmdparser.o)
cv::CommandLineParser::printParams() in libCardIO.a(cmdparser.o)
bool cv::CommandLineParser::get<bool>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)in libCardIO.a(cmdparser.o)
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
This was an ugly one, but an easy fix in the end. In the target's build settings, in "Other Linker Flags," I have the following:
-lstdc++ -ObjC -lc++
That is, libCardIO is requiring both -lstdc++ and -lc++.
Also, make sure you have set "Link With Standard Libraries" to "Yes".
After a lot of guesswork, trial-error and searching for each particular error in the output I came up with a solution that works, add this attribute to the .linkwith.cs file in the binding project:
[assembly: LinkWith ("libCardIO.a", IsCxx=true, LinkTarget= LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator, ForceLoad = true
,Frameworks = "AVFoundation AudioToolbox CoreMedia CoreVideo OpenGLES MobileCoreServices"
,LinkerFlags = "-ObjC -lc++")]
I had assumed that adding
-cxx -gcc_flags "-lstdc++"
to the main project's iOS build should do the same thing but that wasn't the case, with or without these additional compiler parameters the binding wasn't building.
If you need a copy of the binding project just ask.

How do you post a boost packaged_task to an io_service in C++03?

This is a follow-on from a previous question (here), but I'm working on a multithreaded application and I would like to post a Boost packaged_task to a threaded io_service. I'm stuck using a C++03 compiler (so std::move is out), and the packaged_task is not copyable. I've tried wrapping it in a shared_ptr and passing that, and a lot of other things. Here is my current attempt and the subsequent compiler errors. Any idea how to get this to work?
boost::asio::io_service io_service;
boost::thread_group threads;
boost::asio::io_service::work work(io_service);
for (int i = 0; i < maxNumThreads; ++i)
{
threads.create_thread(boost::bind(&boost::asio::io_service::run,
&io_service));
}
std::vector<boost::shared_future<bool> > pending_data; // vector of futures
bool process_data(int,int){...}
...
for(int theTime = 0; theTime != totalScenarioTime; ++theTime)
{
for(int i = 0; i < numSmallTasks; ++i)
{
boost::packaged_task<bool> task(boost::bind(&process_data,i,theTime));
boost::shared_future<bool> fut(task.get_future());
pending_data.push_back(fut); // C++11 possible: (std::move(fut) when fut is a unique_future);
io_service.post(task); // C++11 possible: (std::move(task));
}
// After loop - wait until all futures are evaluated
boost::wait_for_all(pending_data.begin(), pending_data.end());
pending_data.clear();
}
This results in:
In file included from ../boostlibs/boost/asio/io_service.hpp:767:0,
from ../boostlibs/boost/asio/basic_io_object.hpp:19,
from ../boostlibs/boost/asio/basic_socket.hpp:19,
from ../boostlibs/boost/asio/basic_datagram_socket.hpp:20,
from ../boostlibs/boost/asio.hpp:20,
from ../main.cpp:13:
../boostlibs/boost/asio/impl/io_service.hpp: In member function ‘void boost::asio::io_service::post(const CompletionHandler&) [with CompletionHandler = boost::packaged_task<bool>]’:
../main.cpp:256:23: instantiated from here
../boostlibs/boost/asio/impl/io_service.hpp:95:67: error: no matching function for call to ‘boost::packaged_task<bool>::packaged_task(const boost::packaged_task<bool>&)’
../boostlibs/boost/asio/impl/io_service.hpp:95:67: note: candidates are:
../boostlibs/boost/thread/future.hpp:1372:9: note: boost::packaged_task<R>::packaged_task(boost::detail::thread_move_t<boost::packaged_task<R> >) [with R = bool]
../boostlibs/boost/thread/future.hpp:1372:9: note: no known conversion for argument 1 from ‘const boost::packaged_task<bool>’ to ‘boost::detail::thread_move_t<boost::packaged_task<bool> >’
../boostlibs/boost/thread/future.hpp:1318:9: note: boost::packaged_task<R>::packaged_task() [with R = bool]
../boostlibs/boost/thread/future.hpp:1318:9: note: candidate expects 0 arguments, 1 provided
../boostlibs/boost/thread/future.hpp:1314:9: note: boost::packaged_task<R>::packaged_task(boost::packaged_task<R>&) [with R = bool, boost::packaged_task<R> = boost::packaged_task<bool>]
../boostlibs/boost/thread/future.hpp:1314:9: note: no known conversion for argument 1 from ‘const boost::packaged_task<bool>’ to ‘boost::packaged_task<bool>&’
../boostlibs/boost/asio/detail/handler_type_requirements.hpp:95:26: error: initializing argument 1 of ‘T& boost::asio::detail::lvref(T) [with T = boost::packaged_task<bool>]’
../boostlibs/boost/asio/impl/io_service.hpp:95:67: error: no matching function for call to ‘boost::packaged_task<bool>::packaged_task(const boost::packaged_task<bool>&)’
../boostlibs/boost/asio/impl/io_service.hpp:95:67: note: candidates are:
../boostlibs/boost/thread/future.hpp:1372:9: note: boost::packaged_task<R>::packaged_task(boost::detail::thread_move_t<boost::packaged_task<R> >) [with R = bool]
../boostlibs/boost/thread/future.hpp:1372:9: note: no known conversion for argument 1 from ‘const boost::packaged_task<bool>’ to ‘boost::detail::thread_move_t<boost::packaged_task<bool> >’
../boostlibs/boost/thread/future.hpp:1318:9: note: boost::packaged_task<R>::packaged_task() [with R = bool]
../boostlibs/boost/thread/future.hpp:1318:9: note: candidate expects 0 arguments, 1 provided
../boostlibs/boost/thread/future.hpp:1314:9: note: boost::packaged_task<R>::packaged_task(boost::packaged_task<R>&) [with R = bool, boost::packaged_task<R> = boost::packaged_task<bool>]
../boostlibs/boost/thread/future.hpp:1314:9: note: no known conversion for argument 1 from ‘const boost::packaged_task<bool>’ to ‘boost::packaged_task<bool>&’
../boostlibs/boost/asio/detail/handler_type_requirements.hpp:96:32: error: initializing argument 1 of ‘const T& boost::asio::detail::clvref(T) [with T = boost::packaged_task<bool>]’
../boostlibs/boost/asio/impl/io_service.hpp:97:3: error: no matching function for call to ‘boost::packaged_task<bool>::packaged_task(const boost::packaged_task<bool>&)’
../boostlibs/boost/asio/impl/io_service.hpp:97:3: note: candidates are:
../boostlibs/boost/thread/future.hpp:1372:9: note: boost::packaged_task<R>::packaged_task(boost::detail::thread_move_t<boost::packaged_task<R> >) [with R = bool]
../boostlibs/boost/thread/future.hpp:1372:9: note: no known conversion for argument 1 from ‘const boost::packaged_task<bool>’ to ‘boost::detail::thread_move_t<boost::packaged_task<bool> >’
../boostlibs/boost/thread/future.hpp:1318:9: note: boost::packaged_task<R>::packaged_task() [with R = bool]
../boostlibs/boost/thread/future.hpp:1318:9: note: candidate expects 0 arguments, 1 provided
../boostlibs/boost/thread/future.hpp:1314:9: note: boost::packaged_task<R>::packaged_task(boost::packaged_task<R>&) [with R = bool, boost::packaged_task<R> = boost::packaged_task<bool>]
../boostlibs/boost/thread/future.hpp:1314:9: note: no known conversion for argument 1 from ‘const boost::packaged_task<bool>’ to ‘boost::packaged_task<bool>&’
../boostlibs/boost/asio/detail/impl/task_io_service.hpp:54:6: error: initializing argument 1 of ‘void boost::asio::detail::task_io_service::post(Handler) [with Handler = boost::packaged_task<bool>]’
Using boost::move(task) results in the two errors:
error: no match for call to ‘(boost::detail::thread_move_t<boost::packaged_task<bool> >) ()’
error: no match for call to ‘(boost::detail::thread_move_t<boost::packaged_task<bool> >) ()’
boost::packaged_task supports boost::move since Boost version 1.50, see corresponding ticket.
But the problem is that io_service::post completion handler parameter must be CopyConstructible as noted in Asio handler requirements. Therefore boost::packaged_task cannot be posted directly or by moving. (Thanks to Igor R. for this issue).
There is workaround using pointers, e.g. you could wrap boost::packaged_task with boost::shared_ptr and bind it to operator():
typedef boost::packaged_task<bool> task_t;
boost::shared_ptr<task_t> task = boost::make_shared<task_t>(
boost::bind(&process_data, i, theTime));
io_service.post(boost::bind(&task_t::operator(), task));

Resources