I want to include some features from the boost
library. But when including #include <boost/asio.hpp>
the file will not compile, see my example:
// [[Rcpp::depends(BH)]]
#include <Rcpp.h>
#include <boost/asio.hpp>
// [[Rcpp::export]]
int main()
{
return 0;
}
Error in dyn.load("/tmp/RtmpRZlOEQ/sourceCpp-x86_64-pc-linux-gnu-0.12.14/sourcecpp_c4a63bcd586/sourceCpp_32.so") : unable to load shared object '/tmp/RtmpRZlOEQ/sourceCpp-x86_64-pc-linux-gnu-0.12.14/sourcecpp_c4a63bcd586/sourceCpp_32.so': /tmp/RtmpRZlOEQ/sourceCpp-x86_64-pc-linux-gnu-0.12.14/sourcecpp_c4a63bcd586/sourceCpp_32.so: undefined symbol: _ZN5boost6system15system_categoryEv
When removing #include <boost/asio.hpp>
all works fine. Substituting asio.hpp
with some other files, e.g., integer.hpp
all works fine.
Here is my session.Info()
:
sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=de_DE.UTF-8 LC_COLLATE=en_GB.UTF-8 LC_MONETARY=de_DE.UTF-8
[6] LC_MESSAGES=en_GB.UTF-8 LC_PAPER=de_DE.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.3 magrittr_1.5 rsconnect_0.8.5 tools_3.4.3 yaml_2.1.15 Rcpp_0.12.14 stringi_1.1.6 knitr_1.17
[9] stringr_1.2.0 BH_1.65.0-1
I also tried it on Windows 10 and loading is also not possible.
When compiling via g++, all works fine:
// test.cpp
#include <boost/asio.hpp>
int main()
{
return 0;
}
g++ test.cpp -lboost_system