Warnings when installing R package with Rcpp - 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

Related

Getting (compile) error trying to get open source AI "talking head generation" to work

I'm trying to get Talking-head-Generation-with-Rhythmic-Head-Motion to work inside Google Colab.
I just start a new Notebook and executed this:
!pip3 install dominate
!git clone https://github.com/lelechen63/Talking-head-Generation-with-Rhythmic-Head-Motion
cd Talking-head-Generation-with-Rhythmic-Head-Motion
!python scripts/download_flownet2.py
and got this:
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h: In instantiation of ‘void torch::nn::ConvNdImpl<D, Derived>::reset() [with long unsigned int D = 2; Derived = torch::nn::Conv2dImpl]’:
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:17: required from here
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:77:21: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional<c10::MemoryFormat>’
torch::empty(weight_sizes));
~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:85:21: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional<c10::MemoryFormat>’
torch::empty(weight_sizes));
~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:89:59: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional<c10::MemoryFormat>’
bias = this->register_parameter("bias", torch::empty({options.out_channels()}));
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h: In instantiation of ‘void torch::nn::ConvNdImpl<D, Derived>::reset() [with long unsigned int D = 1; Derived = torch::nn::Conv1dImpl]’:
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:17: required from here
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:77:21: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional<c10::MemoryFormat>’
torch::empty(weight_sizes));
~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:85:21: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional<c10::MemoryFormat>’
torch::empty(weight_sizes));
~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:89:59: error: could not convert ‘c10::nullopt’ from ‘const c10::nullopt_t’ to ‘c10::optional<c10::MemoryFormat>’
bias = this->register_parameter("bias", torch::empty({options.out_channels()}));
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Looks like it is trying to compile it after downloading, and failed.
Anyone knows how to make it work?
Or should I not be using Google Colab, and something else - like a VM or in a real Linux box?

Cannot build RTL8192EU driver on Kali Linux for TP-Link WN821N

I cannot build RTL8192EU driver on Kali Linux 5.2 for TP-Link WN821N. After running make in cd rtl8192eu-linux-driver (downloaded from https://github.com/jeremyb31/rtl8192eu-linux-driver):
# sudo apt update
Hit:1 http://kali.download/kali kali-rolling InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
511 packages can be upgraded. Run 'apt list --upgradable' to see them.
# git clone https://github.com/jeremyb31/rtl8192eu-linux-driver
fatal: destination path 'rtl8192eu-linux-driver' already exists and is not an empty directory.
# cd rtl8192eu-linux-driver
# make
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/5.2.0-kali2-amd64/build M=/root/rtl8192eu-linux-driver modules
make[1]: Entering directory '/usr/src/linux-headers-5.2.0-kali2-amd64'
CC [M] /root/rtl8192eu-linux-driver/os_dep/osdep_service.o
In file included from /root/rtl8192eu-linux-driver/include/drv_types.h:35,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/root/rtl8192eu-linux-driver/include/wifi.h:1019: warning: "IEEE80211_MAX_AMPDU_BUF" redefined
#define IEEE80211_MAX_AMPDU_BUF 0x40
In file included from /root/rtl8192eu-linux-driver/include/osdep_service_linux.h:84,
from /root/rtl8192eu-linux-driver/include/osdep_service.h:45,
from /root/rtl8192eu-linux-driver/include/drv_types.h:32,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/usr/src/linux-headers-5.2.0-kali2-common/include/linux/ieee80211.h:1441: note: this is the location of the previous definition
#define IEEE80211_MAX_AMPDU_BUF 0x100
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c: In function ‘isFileReadable’:
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c:1970:28: error: implicit declaration of function ‘get_ds’; did you mean ‘get_da’? [-Werror=implicit-function-declaration]
oldfs = get_fs(); set_fs(get_ds());
^~~~~~
get_da
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c:1970:28: error: incompatible type for argument 1 of ‘set_fs’
oldfs = get_fs(); set_fs(get_ds());
^~~~~~~~
In file included from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uaccess.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/crypto.h:21,
from /usr/src/linux-headers-5.2.0-kali2-common/include/crypto/hash.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uio.h:10,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/socket.h:8,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/compat.h:15,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/ethtool.h:17,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/netdevice.h:37,
from /root/rtl8192eu-linux-driver/include/osdep_service_linux.h:35,
from /root/rtl8192eu-linux-driver/include/osdep_service.h:45,
from /root/rtl8192eu-linux-driver/include/drv_types.h:32,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/usr/src/linux-headers-5.2.0-kali2-common/arch/x86/include/asm/uaccess.h:29:40: note: expected ‘mm_segment_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
static inline void set_fs(mm_segment_t fs)
~~~~~~~~~~~~~^~
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c: In function ‘retriveFromFile’:
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c:1998:29: error: incompatible type for argument 1 of ‘set_fs’
oldfs = get_fs(); set_fs(get_ds());
^~~~~~~~
In file included from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uaccess.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/crypto.h:21,
from /usr/src/linux-headers-5.2.0-kali2-common/include/crypto/hash.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uio.h:10,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/socket.h:8,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/compat.h:15,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/ethtool.h:17,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/netdevice.h:37,
from /root/rtl8192eu-linux-driver/include/osdep_service_linux.h:35,
from /root/rtl8192eu-linux-driver/include/osdep_service.h:45,
from /root/rtl8192eu-linux-driver/include/drv_types.h:32,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/usr/src/linux-headers-5.2.0-kali2-common/arch/x86/include/asm/uaccess.h:29:40: note: expected ‘mm_segment_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
static inline void set_fs(mm_segment_t fs)
~~~~~~~~~~~~~^~
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c: In function ‘storeToFile’:
/root/rtl8192eu-linux-driver/os_dep/osdep_service.c:2032:29: error: incompatible type for argument 1 of ‘set_fs’
oldfs = get_fs(); set_fs(get_ds());
^~~~~~~~
In file included from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uaccess.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/crypto.h:21,
from /usr/src/linux-headers-5.2.0-kali2-common/include/crypto/hash.h:11,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/uio.h:10,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/socket.h:8,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/compat.h:15,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/ethtool.h:17,
from /usr/src/linux-headers-5.2.0-kali2-common/include/linux/netdevice.h:37,
from /root/rtl8192eu-linux-driver/include/osdep_service_linux.h:35,
from /root/rtl8192eu-linux-driver/include/osdep_service.h:45,
from /root/rtl8192eu-linux-driver/include/drv_types.h:32,
from /root/rtl8192eu-linux-driver/os_dep/osdep_service.c:24:
/usr/src/linux-headers-5.2.0-kali2-common/arch/x86/include/asm/uaccess.h:29:40: note: expected ‘mm_segment_t’ {aka ‘struct <anonymous>’} but argument is of type ‘int’
static inline void set_fs(mm_segment_t fs)
~~~~~~~~~~~~~^~
cc1: some warnings being treated as errors
make[4]: *** [/usr/src/linux-headers-5.2.0-kali2-common/scripts/Makefile.build:284: /root/rtl8192eu-linux-driver/os_dep/osdep_service.o] Error 1
make[3]: *** [/usr/src/linux-headers-5.2.0-kali2-common/Makefile:1610: _module_/root/rtl8192eu-linux-driver] Error 2
make[2]: *** [Makefile:179: sub-make] Error 2
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.2.0-kali2-amd64'
make: *** [Makefile:1700: modules] Error 2
How do I fix the compile errors?
go to mange:
download and install the only working drivers. It worked with default drivers for me but with extremely low "power" and dropping/poor connection. Now it works great, just as it should...
I am just a simple/new linux user so I can't offer any further support. But the mentioned site has detailed instructions. I was referred there by multiple other forums.

error: 'SetPosition' was not declared in this scope

Arduino: 1.6.9 (Windows 10), Board: "Arduino Mega ADK"
In file included from C:\Users\Disheet\Downloads\humanoid_1\humanoid_1.ino:1:0:
C:\Users\Disheet\Documents\Arduino\libraries\ax12v2/ax12.h:66:23: error: conflicting declaration 'typedef unsigned char boolean'
typedef unsigned char boolean;
^
In file included from sketch\humanoid_1.ino.cpp:1:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:117:14: error: 'boolean' has a previous declaration as 'typedef bool boolean'
typedef bool boolean;
^
C:\Users\Disheet\Downloads\humanoid_1\humanoid_1.ino: In function 'void setup()':
humanoid_1:5: error: 'SetPosition' was not declared in this scope
SetPosition(1,0);////id,posiotin 0-1023
^
C:\Users\Disheet\Downloads\humanoid_1\humanoid_1.ino: In function 'void loop()':
humanoid_1:13: error: 'SetPosition' was not declared in this scope
SetPosition(1,512);
^
Multiple libraries were found for "ax12.h"
Used: C:\Users\Disheet\Documents\Arduino\libraries\ax12v2
Not used: C:\Users\Disheet\Documents\Arduino\libraries\Bioloid
exit status 1
'SetPosition' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
You'll need to find typedef unsigned char boolean; in your library and change it to match the version in Arduino.h.
boolean is already a typedef in Arduino.h, and it is a bool ,not unsigned char.
In the AX12 library search for this:
https://github.com/7Robot/Arduino/blob/master/AX12/libraries/ax12/ax12.h#L66
And change it to typedef bool boolean;.
This was updated a while ago, so your IDE version is newer than the AX12 library.

wxc-0.91.0.0 failed to install

I'm trying to install reactive-banana, wx, wxcore in cabal sandbox. When cabal install --only-dependencies is run following error message is given:
src\cpp\eljlistctrl.cpp: In function 'int ListCmp(long int, long int, long int)':
src\cpp\eljlistctrl.cpp:16:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
src\cpp\eljlistctrl.cpp:16:53: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
src\cpp\eljlistctrl.cpp: In function 'bool wxListCtrl_SortItems(wxListCtrl*, void*, void*)':
src\cpp\eljlistctrl.cpp:478:41: error: cast from 'EiffelSort* {aka _EiffelSort*}' to 'long int' loses precision [-fpermissive]
src\cpp\eljlistctrl.cpp:478:44: error: invalid conversion from 'int (*)(long int, long int, long int)' to 'wxListCtrlCompare {aka int (*)(long long int, long long int, long long int)}' [-fpermissive]
C:\wxWidgets-3.0.2\include/wx/msw/listctrl.h:342:10: error: initializing argument 1 of 'bool wxListCtrl::SortItems(wxListCtrlCompare, wxIntPtr)' [-fpermissive]
What is wrong and how to solve this?
The code in this file just seems to be wrong and uses 32 bit types even in what looks like 64 bit build. Unless it was fixed in later versions, the only solution would be to build it in 32 bits, i.e. use a 32 bit Haskell installation.

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