Can't compile R package - c++

I am the author of https://github.com/akoyabio/rtree. Until recently, I was able to develop the package in RStudio on Windows with no problems. I was able to check and install the package without any error.
Something has changed and I can no longer build the package. In RStudio, "Install and restart" (with --debug) gives the output
==> Rcmd.exe INSTALL --no-multiarch --with-keep.source --debug rtree
Loading C:\Users\kjohnson\Documents\Rprofile.site
processing 'rtree'
a directory
* installing to library 'C:/Program Files/R/Library'
* build_help_types=html
* DBG: 'R CMD INSTALL' now doing do_install()
* created lock directory 'C:/Program Files/R/Library/00LOCK-rtree'
* installing *source* package 'rtree' ...
** backing up earlier installation
** libs
about to run R CMD SHLIB -o rtree.dll RcppExports.cpp rtree.cpp --debug
ERROR: compilation failed for package 'rtree'
* removing 'C:/Program Files/R/Library/rtree'
* restoring previous 'C:/Program Files/R/Library/rtree'
In R CMD INSTALL
Exited with status 1.
I'm looking for help troubleshooting this error. How can I get more details about the failure?
I do have RTools installed, at C:\RTools, and my PATH includes both
C:\Rtools\bin and C:\Program Files\R\R-3.5.3\bin.
Note: I see the same error if I create a new Rcpp project in RStudio and try to build it. Thank you for any suggestions...

I never really found out how to get more visibility into the failure. I did find the cause - it was an anti-virus program called Minerva's Shield. Turning it off allowed me to build again.

Related

error of compilation wiringPi.h in visual studio

I'm asking for help. I can't compile the app in visual Studio for Windows.
wiringPi.h needed to work with RaspberryPI GPIO
(raspberry pi 3b+ worked on ARM)
GIF
https://pp.userapi.com/c849336/v849336202/789a8/2d6RIDT4S28.jpg
https://pp.userapi.com/c849336/v849336202/789ba/tvBF_VF9M5M.jpg
1>H:\ВГУшное облако\OneDrive - ВГУ\Visual studio\BlinkPI\BlinkPI\main.cpp(1,127): error : C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\Linux\include\wiringPi\2.32\wiringPi.h: No such file or directory
1>Сборка проекта "BlinkPI.vcxproj" завершена с ошибкой.
or https://pp.userapi.com/c850324/v850324544/341e5/vzb2HHJYT78.jpg
1>H:\ВГУшное облако\OneDrive - ВГУ\Visual studio\BlinkPI\BlinkPI\main.cpp(1,22): error : wiringPi.h: No such file or directory
1>H:\ВГУшное облако\OneDrive - ВГУ\Visual studio\BlinkPI\BlinkPI\main.cpp(1,22): error : #include <wiringPi.h>
1>H:\ВГУшное облако\OneDrive - ВГУ\Visual studio\BlinkPI\BlinkPI\main.cpp(1,22): error : ^
1>H:\ВГУшное облако\OneDrive - ВГУ\Visual studio\BlinkPI\BlinkPI\main.cpp(1,22): error : compilation terminated.
Thank you in advance
Add "wireingPi.h" to Visual Studio header src Path And Click Apply
I've had the same problem and found a solution here (in German). Basically, the tutorial states to clone the wiringPi.h from git and build it.
Hint: It is not the fault of VisualStudio (see my comment below the answer of Huseyin Meric Yigit), but it is a missing library on the Raspberry Pi.
The commands I typed in the console of the RasPi were (please adapt the paths to your needs):
cd /home/pi
mkdir lib
chmod 0777 lib
cd lib
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git-core
git clone git://git.drogon.net/wiringPi
git pull origin
./build
Plan to have a coffee while executing the command on line 6 (upgrade). After it is finished, I could successfully compile the project in VisualStudio. Hope, this helps you, too.

Flatpak (flatpak-build) fatal error when building submodules

Following on from here, when using OpenSUSE Tumbleweed I cannot get flatpak-builder to compile submodule dependencies. I first noticed this issue when developing a console application within Gnome Builder using the Vala dependencies Gee and GXml.
As a test, I have installed org.gnome.Books.json and issued the following command (as documented here):
$ flatpak-builder --repo=repo books-app org.gnome.Books.json
The outcome is the same as I observed when developing my own application, the fatal error:
Initializing build dir
Committing stage init to cache
Starting build of org.gnome.Books
fuse: failed to exec fusermount: Permission denied
<more stuff>
Cloning into '/home/robin/Projects-CSim/org.gnome.books/.flatpak-builder/build/gnome-online-accounts-1/telepathy-account-widgets'...
Submodule path 'telepathy-account-widgets': checked out '7d944b79961dfb6291110ceb27597a224d329b36'
error: Build directory /home/<user>/Projects/org.gnome.books/.flatpak-builder/rofiles/rofiles-D4R4cZ not initialized, use flatpak build-init
Error: module gnome-online-accounts: module gnome-online-accounts: Child process exited with code 1
Effectively it fails to build the very first submodule. This is the same behaviour that I observed when invoked from Gnome-Builder on my project; it downloaded but failed to build the very first submodule - in that case it was libgee-0.8.
I've double checked the Flatpak (V0.10.4) installation here and cannot find a solution. I understand from the documentation that invoking flatpak-builder should automatically invoke flatpak build-init.
This is worrisome as Gnome-Builder seems be using Flatpak as the default packager. Any suggestions?
The problem is not Flatpak. It is a conflict between Flatpak and fuse. For some reason this was not occuring with valac or meson from the command line, only Flatpak.
From here we find a solution:
# chmod +x /usr/bin/fusermount
Is this a peculiarity of OpenSUSE Tumbleweed? In any case, after making this change, Flatpak builds submodules as expected. Magnificent!
Not sure about the security aspect of this, however - any comments would be welcomed.

Makefile error raspberry-pi 3

I have an issue with Codelite compilation, running on raspbian jessie - these are the (known) steps I have taken to produce it.
First I installed Codelite with apt-get install Codelite, then produced a c++ project.
When running build project I get the error:
/bin/sh -c ' -j 4 -e -f Makefile'
/bin/sh: 1: -j: not found
0 errors, 0 warnings
I note that this error has been found and corrected previously, through running a different version of Codelite from 6.1.1 (that which apt-get installs). I therefore found the updated version of armhf .deb codelite from the rasbian archive with gdebi-gtk. However the updated version (9.1.1) produces the following error (install attempt with the graphical debian):
Error: Dependency is not satisfiable: libclang 1-3.8 (>=3.2)
I do not understand why the package manager cannot update these packages - do they not exist for the pi? I ran the manager as root, so I do not think it is a permissions issue.
EDIT 1:
Thank you for that Fabre. My Enviromental Variables file now looks like this:
CodeLiteDir=/usr/share/codelite
export MAKE=make
I still get the same error however.

R: Error in dyn.load(file, DLLpath = DLLpath, ...)

I have worked now for some time on an R project in my office's desktop computer, but need to carry the scripts with me while on travel. I copied everything into my laptop and did some changes to the code. Alas, when trying to compile (following the exact same procedure I was using in my desktop computer), the following error:
$ R CMD INSTALL --no-multiarch --with-keep.source coala
* installing to library ‘/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3’
* installing *source* package ‘coala’ ...
** libs
make: Nothing to be done for `all'.
installing to /home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala/libs/coala.so':
/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala/libs/coala.so: undefined symbol: _ZSt24__throw_out_of_range_fmtPKcz
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala’
* restoring previous ‘/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala’
Both computers have the same Ubuntu but different R version. Also, I have to mention that I am working in two libraries at the same time and that the accompanying library update without problems, which makes this error message more puzzling. I have checked answers that may be related to this question, but can't figure out how to apply their solutions:
R: error installing packages UBUNTU - Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object
Got message unable to load shared object stats.so when R starts
Is there a way to solve this problem? Which may be the cause? What is the undefined symbol _ZSt24__throw_out_of_range_fmtPKcz?
I had a similar issue with rgdal on Ubuntu. Re-installing the package was enough to getting it working again.
$ sudo R
> install.packages("rgdal")
> quit()
$ exit
What is .libPaths() giving you as the output?
I encountered the same problem using the latest update today (R 3.3.1 for MacOS X). My R installation seemed to crash after updating it. My solution was simply to remove the lib directories from the file system and reinstall R:
rm -rf /Users/johann/Library/R/3.3/library
sudo rm -rf Library/Frameworks/R.framework/Versions/3.3/Resources/library
Hope this helps...
The problem is the linkage with your g++ stdlib. Different versions of Ubuntu have different versions of g++ stdlib. You cant always copy binaries from one to the other.
You may fix this by recompiling R for the laptop, or using the Ubuntu R packages. e.g. http://packages.ubuntu.com/xenial/r-base
For Mac / Linux
Press command + space
Type terminal and press enter to open terminal. In terminal paste this open /Library/Frameworks/R.framework/Resources/library and press enter. A finder window should open with a lot of folders
Each folder matches an installed R package.
Delete them all, close RStudio, reopen RStudio and install the packages you need with install.packages("dplyr") etc
After I did this, the issue went away

dyn.load error linking a package with Rcpp

I've made an R package with Rcpp, to use the methods of a library I programmed in c++.
I've R running on the last version:
R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04 LTS
I'm executing the following instruction to install my package:
> install.packages("mypackage", repos = NULL)
The package compiles well, I have the .o files of my source code, but in the linking phase I got the error:
* installing *source* package ‘rbdd’ ...
** libs
make: No se hace nada para 'all'.
installing to /home/sergio/R/x86_64-pc-linux-gnu-library/3.2/mypackage/libs
** R
** preparing package for lazy loading
** help
Warning: /home/sergio/R/mypackage/man/mypackage-package.Rd:27: All text must be in a section
Warning: /home/sergio/R/mypackage/man/mypackage-package.Rd:28: All text must be in a section
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/sergio/R/x86_64-pc-linux-gnu-library/3.2/mypackage/libs/mypackage.so':
/home/sergio/R/x86_64-pc-linux-gnu-library/3.2/mypackage/libs/mypackage.so: undefined symbol: _ZN4cudd12defaultErrorENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE
Error: loading failed
Ejecución interrumpida
ERROR: loading failed
mypackge.so is created in the src folder of my package.
I've got a Makevars file (in src, too) with the following content:
PKG_CPPFLAGS=-I./buddy-2.5/src -I./cudd-3.0.0/cudd -I./cudd-3.0.0/mtr -I./cudd-3.0.0/cplusplus -I./cudd-3.0.0/dddmp -I./cudd-3.0.0/util -I./cudd-3.0.0 -isystem /usr/include/c++/v1 -std=c++11
PKG_LIBS=-lc++ -L/lib
and my NAMESPACE file has the lines:
useDynLib(mypackage)
exportPattern("^[[:alpha:]]+")
importFrom(Rcpp, evalCpp)
Someone knows how to solve this problem?
I am a little concerned about
PKG_LIBS=-lc++ -L/lib
Did you really mean /lib? If it is your library, a more common place would be /usr/local/lib which is also search by default.
But, and that is a BIG but, you also need to understand what you need to do for ldconfig for the proper setup of libfoo.so, libfoo.so.$MAJOR and so on. I taught myself that many moons ago from a Linux HOWTO.
If and when that is setup right, you can link it to R via Rcpp. Otherwise maybe stick with system libraries, or package-local static libraries. That approach will also make your package more portable.
The problem was I am consumming external libs, and I must compile it and execute ldconfig before compile my R library.