Creating R package with Rcpp: errors - package

I wanted to create my R package using the Rcpp library but I met some problems even with the example.
I run
Rcpp.package.skeleton("foobar")
but when I try to compile/check the R package, I have the following error:
==> devtools::check(document = FALSE)
Setting env vars ---------------------------------------------------------------
CFLAGS : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building foobar ----------------------------------------------------------------
"C:/PROGRA~1/R/R-32~1.3/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore --quiet CMD build "C:\Users\scacciat\Desktop\foobar" \
--no-resave-data --no-manual
* checking for file 'C:\Users\scacciat\Desktop\foobar/DESCRIPTION' ... OK
* preparing 'foobar':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to process help pages
-----------------------------------
* installing *source* package 'foobar' ...
** libs
g++ -m64 -I"C:/PROGRA~1/R/R-32~1.3/include" -DNDEBUG -I"\\icnas4.cc.ic.ac.uk/scacciat/R/win-library/3.2/Rcpp/include" -I"d:/RCompile/r-compiling/local/local323/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp:4:18: fatal error: Rcpp.h: No such file or directory
compilation terminated.
make: *** [RcppExports.o] Error 1
Warning: running command 'make -f "C:/PROGRA~1/R/R-32~1.3/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-32~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="foobar.dll" WIN=64 TCLBIN=64 OBJECTS="RcppExports.o rcpp_hello_world.o"' had status 2
ERROR: compilation failed for package 'foobar'
* removing 'C:/Users/scacciat/AppData/Local/Temp/Rtmpkvl6Bo/Rinst116c227323e9/foobar'
-----------------------------------
ERROR: package installation failed
Warning: running command '"C:/PROGRA~1/R/R-32~1.3/bin/x64/Rcmd.exe" INSTALL -l "C:\Users\scacciat\AppData\Local\Temp\Rtmpkvl6Bo\Rinst116c227323e9" --no-multiarch "C:/Users/scacciat/AppData/Local/Temp/Rtmpkvl6Bo/Rbuild116c5035785/foobar"' had status 1
Error: Command failed (1)
Execution halted
Exited with status 1.
```

Related

Understanding chocolatey gcc compiler error on Windows

I am trying to compile PortAudio using the GitHub-hosted windows-latest runner.
I use the following code to compile (see here for the full script):
curl -sSLO https://github.com/PortAudio/portaudio/archive/refs/tags/v19.7.0.zip
unzip -q v19.7.0.zip
cd portaudio-19.7.0
./configure \
--with-winapi=wasapi --enable-static=yes --enable-shared=no \
CC="$(command -v gcc)" CXX="$(command -v g++)"
make
Here is the output in GitHub Actions from the make command onwards:
+ make
gcc.exe: fatal error: no input files
compilation terminated.
mkdir lib
mingw32-make: *** [makefile:228: src/common/pa_allocation.lo] Error 1
mkdir -p src/common src/hostapi/alsa src/hostapi/asihpi src/hostapi/asio src/hostapi/coreaudio src/hostapi/dsound src/hostapi/jack src/hostapi/oss src/hostapi/skeleton src/hostapi/wasapi src/hostapi/wdmks src/hostapi/wmme src/os/unix src/os/win
touch lib-stamp
C:/Program Files/Git/usr/bin/sh.exe ./libtool --mode=compile /c/ProgramData/Chocolatey/bin/gcc -c -g -O2 -DPA_LITTLE_ENDIAN -I./include -I./src/common -I./src/os/win -DPA_USE_WMME=0 -DPA_USE_ASIO=0 -DPA_USE_WDMKS=0 -DPA_USE_DS=0 -DPA_USE_WASAPI=0 -UPA_USE_WASAPI -DPA_USE_WASAPI=1 -mthreads -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DHAVE_CLOCK_GETTIME=1 -DHAVE_NANOSLEEP=1 src/common/pa_allocation.c -o src/common/pa_allocation.lo
libtool: compile: /c/ProgramData/Chocolatey/bin/gcc -c -g -O2 -DPA_LITTLE_ENDIAN -I./include -I./src/common -I./src/os/win -DPA_USE_WMME=0 -DPA_USE_ASIO=0 -DPA_USE_WDMKS=0 -DPA_USE_DS=0 -DPA_USE_WASAPI=0 -UPA_USE_WASAPI -DPA_USE_WASAPI=1 -mthreads "-DPACKAGE_NAME=\\\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DHAVE_CLOCK_GETTIME=1 -DHAVE_NANOSLEEP=1 src/common/pa_allocation.c -o src/common/pa_allocation.lo" -o pa_allocation.o
Error: Process completed with exit code 1.
The full build output can be viewed here.
You can see in the output above that the CC I specified is one installed by Chocolatey installed at /c/ProgramData/Chocolatey/bin/gcc.
I also tried compiling without specifying CC or CXX when I run the ./configure command, but the build also fails.
The libtool command doesn't have any error output, so I don't know why the libtool command failed.
I also don't understand why there is a gcc.exe: fatal error: no input files error in the output of make, since I specify CC in when I run ./configure.
I am looking for help understanding why this problems are occurring, and help fixing these problems.

Trying to build a helloworld.c program on Visual studio but keep getting fatal error?

> Executing task: gcc -g o helloworld helloworld.c <
cc1: fatal error: helloworld.c: No such file or directory
compilation terminated.
The terminal process "C:\cygwin64\bin\bash.exe '--login', '-c', 'gcc -g o helloworld
helloworld.c'" terminated with exit code: 1.

Sagemaker suddenly unable to install python packages, missing python-dev

Not sure why, but sagemaker complaining about unable to install certain python packages. This is automatically deployed with cloudtemplate. Not sure how to go about installing python-dev on sagemaker.
Running setup.py install for cymem: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-he9ui3pu/cymem/setup.py'"'"'; __file__='"'"'/tmp/pip-install-he9ui3pu/cymem/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-spf4a86a/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-he9ui3pu/cymem/
Complete output (27 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/cymem
copying cymem/__init__.py -> build/lib.linux-x86_64-3.6/cymem
copying cymem/about.py -> build/lib.linux-x86_64-3.6/cymem
package init file 'cymem/tests/__init__.py' not found (or not a regular file)
creating build/lib.linux-x86_64-3.6/cymem/tests
copying cymem/tests/test_import.py -> build/lib.linux-x86_64-3.6/cymem/tests
copying cymem/cymem.pyx -> build/lib.linux-x86_64-3.6/cymem
copying cymem/__init__.pxd -> build/lib.linux-x86_64-3.6/cymem
copying cymem/cymem.pxd -> build/lib.linux-x86_64-3.6/cymem
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building 'cymem.cymem' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/cymem
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -I/usr/include/python3.6m -c cymem/cymem.cpp -o build/temp.linux-x86_64-3.6/cymem/cymem.o -O3 -Wno-strict-prototypes -Wno-unused-function
cc1plus: warning: command line option ‘-Wno-strict-prototypes’ is valid for C/ObjC but not for C++
cymem/cymem.cpp:4:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Running setup.py install for cymem: finished with status 'error' ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-he9ui3pu/cymem/setup.py'"'"'; __file__='"'"'/tmp/pip-install-he9ui3pu/cymem/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-spf4a86a/install-record.txt --single-version-externally-managed --compile cwd: /tmp/pip-install-he9ui3pu/cymem/ Complete output (27 lines): running install running build running build_py creating build creating build/lib.linux-x86_64-3.6 creating build/lib.linux-x86_64-3.6/cymem copying cymem/__init__.py -> build/lib.linux-x86_64-3.6/cymem copying cymem/about.py -> build/lib.linux-x86_64-3.6/cymem package init file 'cymem/tests/__init__.py' not found (or not a regular file) creating build/lib.linux-x86_64-3.6/cymem/tests copying cymem/tests/test_import.py -> build/lib.linux-x86_64-3.6/cymem/tests copying cymem/cymem.pyx -> build/lib.linux-x86_64-3.6/cymem copying cymem/__init__.pxd -> build/lib.linux-x86_64-3.6/cymem copying cymem/cymem.pxd -> build/lib.linux-x86_64-3.6/cymem warning: build_py: byte-compiling is disabled, skipping. running build_ext building 'cymem.cymem' extension creating build/temp.linux-x86_64-3.6 creating build/temp.linux-x86_64-3.6/cymem x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -I/usr/include/python3.6m -c cymem/cymem.cpp -o build/temp.linux-x86_64-3.6/cymem/cymem.o -O3 -Wno-strict-prototypes -Wno-unused-function cc1plus: warning: command line option ‘-Wno-strict-prototypes’ is valid for C/ObjC but not for C++ cymem/cymem.cpp:4:10: fatal error: Python.h: No such file or directory #include "Python.h" ^~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ----------------------------------------
Seems like you are missing python-devel for the c++ bindings.
sudo yum install python-devel
may help resolve the missing dependency.
By using a later version of sagermaker image, it appear to resolve it.

Check for working C compiler: /usr/bin/cc -- broken

I am having a problem with the installation of a ROS packages on my raspberry pi 3. I really hope you can help me.
<== Finished processing package [10 of 53]: 'fzi_icl_core'
==> Processing plain cmake package: 'fzi_icl_can'
==> Building with env: '/opt/ros/kinetic/env.sh'
==> cmake /home/pi/ros_catkin_ws/src/fzi_icl_can -DCMAKE_INSTALL_PREFIX=/opt/ros/kinetic -DCMAKE_BUILD_TYPE=Release -G Unix Makefiles in '/home/pi/ros_catkin_ws/build_isolated/fzi_icl_can/install'
The C compiler identification is unknown
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61 (message):
** The C compiler "/usr/bin/cc" is not able to compile a simple test program.**
It fails with the following output:
Change Dir: /home/pi/ros_catkin_ws/build_isolated/fzi_icl_can/install/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_cd4f1/fast"
/usr/bin/make -f CMakeFiles/cmTC_cd4f1.dir/build.make
CMakeFiles/cmTC_cd4f1.dir/build
make[1]: Entering directory
'/home/pi/ros_catkin_ws/build_isolated/fzi_icl_can/install/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_cd4f1.dir/testCCompiler.c.o
/usr/bin/cc -o CMakeFiles/cmTC_cd4f1.dir/testCCompiler.c.o -c
/home/pi/ros_catkin_ws/build_isolated/fzi_icl_can/install/CMakeFiles/CMakeTmp/testCCompiler.c
cc1: internal compiler error: in next_pass_1, at passes.c:1258
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
CMakeFiles/cmTC_cd4f1.dir/build.make:65: recipe for target
'CMakeFiles/cmTC_cd4f1.dir/testCCompiler.c.o' failed
make[1]: *** [CMakeFiles/cmTC_cd4f1.dir/testCCompiler.c.o] Error 1
make[1]: Leaving directory
'/home/pi/ros_catkin_ws/build_isolated/fzi_icl_can/install/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_cd4f1/fast' failed
make: *** [cmTC_cd4f1/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/home/pi/ros_catkin_ws/build_isolated/fzi_icl_can/install/CMakeFiles/CMakeOutput.log".
See also "/home/pi/ros_catkin_ws/build_isolated/fzi_icl_can/install/CMakeFiles/CMakeError.log".
<== Failed to process package 'fzi_icl_can':
Command '['/opt/ros/kinetic/env.sh', 'cmake', '/home/pi/ros_catkin_ws/src/fzi_icl_can', '-DCMAKE_INSTALL_PREFIX=/opt/ros/kinetic', '-DCMAKE_BUILD_TYPE=Release', '-G', 'Unix Makefiles']' returned non-zero exit status 1
Reproduce this error by running:
==> cd /home/pi/ros_catkin_ws/build_isolated/fzi_icl_can && /opt/ros/kinetic/env.sh cmake /home/pi/ros_catkin_ws/src/fzi_icl_can -DCMAKE_INSTALL_PREFIX=/opt/ros/kinetic -DCMAKE_BUILD_TYPE=Release -G 'Unix Makefiles'
Command failed, exiting.
The output was:
1
cc1: internal compiler error: in next_pass_1, at passes.c:1258
Please submit a full bug report,
If you haven't already, I would try sudo apt-get install build-essential to make sure that all the necessary build components are installed.
Search installed gcc libs:
dpkg -l | grep libgcc | cut -d' ' -f 3 | tr '\n' ' '
My result:
libgcc-5-dev:amd64 libgcc1:amd64
Reinstall it:
apt install --reinstall libgcc1:armhf libgcc-5-dev:armhf

How to fix "*** [obj/flash_board_cstartup.o] Error 2"

I am trying to get up to speed with the SAM7S examples pack "at91sam7s-ek" available from the Atmel website.
When I load any project into Eclipse I get the following error after building project.
make: *** [obj/flash_board_cstartup.o] Error 2
I have checked that paths are correct and that the files are where they are supposed to be.
Is there anyone that can help me to get this running or can anyone recommend a better set of examples that actually work for the SAM7S devices?
The CDT build console is :
18:58:29 **** Incremental Build of configuration Default for project test_project ****
make all
arm-none-eabi-gcc -g -O0 -I../at91lib/boards/asn442g -I../at91lib/peripherals -I../at91lib/components -I../at91lib -I. -I../at91lib/utility -I../external_libs/ethernet/lwip/src/include -I../external_libs/ethernet/lwip/src/include/lwip -I../external_libs/ethernet/lwip/src/include/ipv4 -I./system/modbus/tcp -I./system/modbus/tcp/arch -I./system/dal/dalAdc -I./system/dal/dalHoldingRegisters -I./system/dal/dalTimer -I./system/bll/bllModbusTCP -I./system/drivers/drvGprsLink -I./system/drivers/drvAtmBus -I./system/hal/halUsart1 -I./system/hal/halGpio -I./system/hal/halUsart0 -I./system/drv/drvAtmBus -Dat91sam7x256 -D__ASSEMBLY__ -Dflash -c -o obj/flash_board_cstartup.o ../at91lib/boards/asn442g/board_cstartup.S
process_begin: CreateProcess(NULL, arm-none-eabi-gcc -g -O0 -I../at91lib/boards/asn442g -I../at91lib/peripherals -I../at91lib/components -I../at91lib -I. -I../at91lib/utility -I../external_libs/ethernet/lwip/src/include -I../external_libs/ethernet/lwip/src/include/lwip -I../external_libs/ethernet/lwip/src/include/ipv4 -I./system/modbus/tcp -I./system/modbus/tcp/arch -I./system/dal/dalAdc -I./system/dal/dalHoldingRegisters -I./system/dal/dalTimer -I./system/bll/bllModbusTCP -I./system/drivers/drvGprsLink -I./system/drivers/drvAtmBus -I./system/hal/halUsart1 -I./system/hal/halGpio -I./system/hal/halUsart0 -I./system/drv/drvAtmBus -Dat91sam7x256 -D__ASSEMBLY__ -Dflash -c -o obj/flash_board_cstartup.o../at91lib/boards/asn442g/board_cstartup.S, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/flash_board_cstartup.o] Error 2
18:58:33 Build Finished (took 3s.647ms)
When make return Error nn, it means that a command that make has executed has returned a non-zero value nn. You need to look at the error message for teh command that failed, rather than teh final status of make - make has not failed; your build has failed.
In this case, the relevant error message (elided) is:
process_begin: CreateProcess(NULL, arm-none-eabi-gcc [...] obj/flash_board_cstartup.o
../at91lib/boards/asn442g/board_cstartup.S, ...) failed.
It appears on the face of it that the compiler arm-none-eabi-gcc cannot be found. Is it installed, and does the PATH environment variable include its location?

Resources