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

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.

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.

fatal error: omp.h: No such file or directory using arm-unknown-linux-uclibcgnueabi (crosstool-ng)

It seems that any gcc created with crosstool-ng is missing omp.h, is there a way to solve this issue?
tomas#ubuntu:~/eHHAlgorithm/infoli_static$ /home/tomas/x-tools/arm-unknown-linux-uclibcgnueabi/bin/arm-unknown-linux-uclibcgnueabi-gcc infoli.c main.c -o infoli_arm_ns100_ss10_noout_nobench -lm -O3 -DNETWORK_SIZE=100 -DSIMULATION_STEPS=10 -DNO_OUTPUT -DNO_BENCH -static
infoli.c:3:10: fatal error: omp.h: No such file or directory
#include <omp.h>
^~~~~~~
compilation terminated.
If I use arm-linux-gnueabi-gcc, which I installed with apt-get directly in Ubuntu I don't get this error.
Solution:
./ct-ng arm-unknown-linux-uclibcgnueabi
./ct-ng menuconfig -> C compiler -> Compile libgomp (enable pressing < y >). Save changes.
./ct-ng build
This will enable the LIBGOMP option in the .config file:
tomas#ubuntu:~/crosstool-ng$ grep LIBGOMP .config*
.config:CT_CC_GCC_LIBGOMP=y
.config.old:# CT_CC_GCC_LIBGOMP is not set

Issues installing yaml for lua with luarocks during the c-compile

I have lua, that I isntalled using luarocks.
Edit: on a windows system
I successfully installed luasocket by downloading the luasocket-2.0.2-3.win32-x86.rock file from v202-3 from here. Its an older version, but it works.
However now I need to install yaml so I can work with yaml files. Now I am forced to install using a *.src.rock file or a .rockspec file.
I have tried:
luarocks install yaml which gives:
D:\user\workspace\_lua>luarocks install yaml
Warning: Failed searching manifest: Failed fetching manifest for https://luarocks.org - Failed downloading https://luarocks.org/manifest - C:\Users\user\AppData\Local/LuaRocks/Cache/https___luarocks.org/manifest
Warning: Failed searching manifest: Failed fetching manifest for https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/ - Failed downloading https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/manifest - C:\Users\user\AppData\Local/LuaRocks/Cache/https___raw.githubusercontent.com_rocks-moonscript-org_moonrocks-mirror_master_/manifest
Warning: Failed searching manifest: Failed fetching manifest for http://luafr.org/moonrocks/ - Failed downloading http://luafr.org/moonrocks/manifest - C:\Users\user\AppData\Local/LuaRocks/Cache/http___luafr.org_moonrocks_/manifest
Warning: Failed searching manifest: Failed fetching manifest for http://luarocks.logiceditor.com/rocks - Failed downloading http://luarocks.logiceditor.com/rocks/manifest - C:\Users\user\AppData\Local/LuaRocks/Cache/http___luarocks.logiceditor.com_rocks/manifest
Error: No results matching query were found.
So, then I downloaded yaml-1.1.2-1.src.rock and ran the command:
luarocks install yaml-1.1.2-1.src.rock
This told me that I had dependencies yaml --> lub --> luafilesystem. so then I downloaded:
luafilesystem-1.6.3-2.src.rock
lub-1.1.0-1.src.rock
yaml-1.1.2-1.src.rock
And I installed them one after the other with the result:
luarocks install luafilesystem-1.6.3-2.src.rock - OK
luarocks install lub-1.1.0-1.src.rock - OK
luarocks install yaml-1.1.2-1.src.rock - FAILED, see errors below
Error log:
D:\user\downloads\luarocks-2.3.0-win32\extras>luarocks install yaml-1.1.2-1.src.rock
Using yaml-1.1.2-1.src.rock... switching to 'build' mode
mingw32-gcc -O2 -c -o src/api.o -ID:/user/install/lua/luarocks/include src/api.c -Isrc
mingw32-gcc -O2 -c -o src/b64.o -ID:/user/install/lua/luarocks/include src/b64.c -Isrc
mingw32-gcc -O2 -c -o src/dumper.o -ID:/user/install/lua/luarocks/include src/dumper.c -Isrc
mingw32-gcc -O2 -c -o src/emitter.o -ID:/user/install/lua/luarocks/include src/emitter.c -Isrc
mingw32-gcc -O2 -c -o src/loader.o -ID:/user/install/lua/luarocks/include src/loader.c -Isrc
mingw32-gcc -O2 -c -o src/lyaml.o -ID:/user/install/lua/luarocks/include src/lyaml.c -Isrc
mingw32-gcc -O2 -c -o src/parser.o -ID:/user/install/lua/luarocks/include src/parser.c -Isrc
mingw32-gcc -O2 -c -o src/reader.o -ID:/user/install/lua/luarocks/include src/reader.c -Isrc
mingw32-gcc -O2 -c -o src/scanner.o -ID:/user/install/lua/luarocks/include src/scanner.c -Isrc
mingw32-gcc -O2 -c -o src/strtod.o -ID:/user/install/lua/luarocks/include src/strtod.c -Isrc
In file included from src/strtod.c:23:0:
src/strtod.c:24:17: warning: '_errno' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
extern int errno;
^
mingw32-gcc -O2 -c -o src/writer.o -ID:/user/install/lua/luarocks/include src/writer.c -Isrc
mingw32-gcc -shared -o yaml/core.dll src/api.o src/b64.o src/dumper.o src/emitter.o src/loader.o src/lyaml.o src/parser.o src/reader.o src/scanner.o src/strtod.o src/writer.o D:/user/install/lua/luarocks/lua5.1.lib -lMSVCR80
src/api.o:api.c:(.text+0x395): undefined reference to '_imp__yaml_realloc'
src/api.o:api.c:(.text+0x412): undefined reference to '_imp__yaml_string_extend'
:
LOTS OF THESE
:
src/scanner.o:scanner.c:(.text.unlikely+0x29d0): undefined reference to '_imp__yaml_queue_extend'
src/scanner.o:scanner.c:(.text.unlikely+0x29e8): undefined reference to '_imp__yaml_token_delete'
collect2.exe: error: ld returned 1 exit status
Error: Build error: Failed compiling module yaml/core.dll
Does anyone know why this build fails? - I got it directly from here: https://luarocks.org/modules/gaspard/yaml/1.1.2-1 which is the most downloaded version... so I guess it should work?
I mean, I can see what the error is... but I don't understand why there should be an error. How can I resolve this?... Any help appreciated :)
UPDATE
Thanks to siffiejoe's comment, I was able to compile the yaml rock. Here is the output:
D:\user\downloads\luarocks-2.3.0-win32\extras>luarocks install yaml-1.1.2-1.src.rock CC="gcc -DYAML_DECLARE_STATIC"
Using yaml-1.1.2-1.src.rock... switching to 'build' mode
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/api.o -ID:/user/install/lua/luarocks/include src/api.c -Isrc
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/b64.o -ID:/user/install/lua/luarocks/include src/b64.c -Isrc
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/dumper.o -ID:/user/install/lua/luarocks/include src/dumper.c -Isrc
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/emitter.o -ID:/user/install/lua/luarocks/include src/emitter.c -Isrc
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/loader.o -ID:/user/install/lua/luarocks/include src/loader.c -Isrc
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/lyaml.o -ID:/user/install/lua/luarocks/include src/lyaml.c -Isrc
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/parser.o -ID:/user/install/lua/luarocks/include src/parser.c -Isrc
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/reader.o -ID:/user/install/lua/luarocks/include src/reader.c -Isrc
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/scanner.o -ID:/user/install/lua/luarocks/include src/scanner.c -Isrc
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/strtod.o -ID:/user/install/lua/luarocks/include src/strtod.c -Isrc
In file included from src/strtod.c:23:0:
src/strtod.c:24:17: warning: '_errno' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
extern int errno;
^
gcc -DYAML_DECLARE_STATIC -O2 -c -o src/writer.o -ID:/user/install/lua/luarocks/include src/writer.c -Isrc
mingw32-gcc -shared -o yaml/core.dll src/api.o src/b64.o src/dumper.o src/emitter.o src/loader.o src/lyaml.o src/parser.o src/reader.o src/scanner.o src/strtod.o src/writer.o D:/user/install/lua/luarocks/lua5.1.lib -lMSVCR80
Updating manifest for D:\user\install\lua\luarocks\systree/lib/luarocks/rocks
yaml 1.1.2-1 is now built and installed in D:\user\install\lua\luarocks\systree (license: MIT)
So it says it is installed. However when I try to use the yaml packge it does not find it:
local yaml = require("yaml")
local data = yaml.load("mytest.yaml")
The system reports that it can't find yaml.lua or yaml.dll. I then searched *.lua and *.dll in my luarocks folder I found:
D:\user\install\lua\luarocks\systree>dir *.lua *.dll /b /s
D:\user\install\lua\luarocks\systree\lib\lua\5.1\lfs.dll
D:\user\install\lua\luarocks\systree\lib\lua\5.1\mime\core.dll
D:\user\install\lua\luarocks\systree\lib\lua\5.1\socket\core.dll
D:\user\install\lua\luarocks\systree\lib\lua\5.1\yaml\core.dll
D:\user\install\lua\luarocks\systree\lib\luarocks\rocks\luafilesystem\1.6.3-2\tests\test.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\ltn12.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\mime.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\socket.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\lub\Autoload.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\lub\Dir.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\lub\init.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\lub\Param.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\lub\Template.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\socket\ftp.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\socket\http.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\socket\smtp.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\socket\tp.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\socket\url.lua
D:\user\install\lua\luarocks\systree\share\lua\5.1\yaml\init.lua
For example, I managed to install luasocket with luarocks install luasocket-2.0.2-3.win32-x86.rock because there was a .rock file available. And so you can see there is a socket.lua. For yaml, lub and luafilesystem I can see various install locations, but there is no .lua or .dll files...
I searched more for yaml specifically:
D:\user\install\lua\luarocks\systree>dir *yaml* /b /s
D:\user\install\lua\luarocks\systree\lib\lua\5.1\yaml
D:\user\install\lua\luarocks\systree\lib\luarocks\rocks\yaml
D:\user\install\lua\luarocks\systree\lib\luarocks\rocks\yaml\1.1.2-1\yaml-1.1.2-1.rockspec
D:\user\install\lua\luarocks\systree\share\lua\5.1\yaml
ehh... so then I went and cloned the project from git (had to download the zip file because my stupid IT blocked my git clone ... (port 443).
So finally got that sorted, then in the yaml-master folder I tried:
luarocks make yaml-1.1.2-1.rockspec CC-"gcc -DYAML_DECLARE_STATIC"
This had the same effect as before. So now I have tried both .src.rock and .rockspec types...
I am stuck again :(
UPDATE 2
When I built from git, there was a file called yaml.lua in the top level. But all it contains is the text yaml/init.lua ... not sure what to do with that - tried copying it into the my ..install\lua\luarocks\systree\share\lua\5.1 dir, but when I run my test lua projam it gives an error.... what is going on, it can't be this hard to install :(
UPDATE 3
Following on from siffiejoe's great answer, I have more or less got this yaml installed. But I have a bug running it:
Here is my lua script:
package.path = "D:\\user\\install\\lua\\luarocks\\systree\\share\\lua\\5.1\\?\\init.lua;" .. package.path
print("package.path: " .. package.path)
local yaml = require("yaml")
local data = yaml.load("mytest.yaml")
I am manually adding the lua path for now while I am testing. When I run this I get the window:
And my log looks like:
D:\user\install\lua\luarocks\systree\share\lua\5.1\?\init.lua;D:\user\install\lua\luarocks\systree\share\lua\5.1\?.lua;D:\user\install\lua\luarocks\systree\share\lua\5.1\?\init.lua;./?.lua;./?/init.lua;./lua/?.lua;./lua/?/init.lua;D:\user\install\lua\zerobrane\lualibs/?/?.lua;D:\user\install\lua\zerobrane\lualibs/?.lua;D:\user\install\lua\zerobrane\lualibs/?/?/init.lua;D:\user\install\lua\zerobrane\lualibs/?/init.lua
D:\user\install\lua\zerobrane\bin\lua.exe: error loading module 'lfs' from file 'D:\user\install\lua\luarocks\systree\lib\lua\5.1\lfs.dll':
The specified procedure could not be found.
stack traceback:
[C]: at 0x66df0460
[C]: in function 'require'
...\install\lua\luarocks\systree\share\lua\5.1\lub\init.lua:17: in main chunk
[C]: in function 'require'
...install\lua\luarocks\systree\share\lua\5.1\yaml\init.lua:25: in main chunk
[C]: in function 'require'
D:\user\workspace\_lua\myluatest.lua:3: in main chunk
[C]: at 0x00402a57
Program completed in 56.64 seconds (pid: 15856).
So it appears to come back to this MSVCR80.dll ... this is not making sense to me, I assume this is do with microsoft... Some things I have read about it could be a corrupt MSVCR80.dll that needs replacing or somthing. But I am not yet sure about why this is occuring. Any thoughts?
The include file src/yaml.h from the github repository contains the following preprocessor code:
#ifdef WIN32
# if defined(YAML_DECLARE_STATIC)
# define YAML_DECLARE(type) type
# elif defined(YAML_DECLARE_EXPORT)
# define YAML_DECLARE(type) __declspec(dllexport) type
# else
# define YAML_DECLARE(type) __declspec(dllimport) type
# endif
#else
# define YAML_DECLARE(type) type
#endif
That means that on Windows all yaml-related functions by default are decorated with __declspec(dllimport) (the _imp__ prefixes in the linker error messages were hints). Because of this the linker expects those functions to be in an external DLL. But the yaml code is bundled and compiled together with the Lua binding into a single DLL yaml\core.dll, and so the linker complains. The correct way to fix this is to remove all import/export-related decorations from the yaml functions, and this can be achieved by defining YAML_DECLARE_STATIC. This macro should definitely be set in the rockspec (I'll post a bug report later), but a quick and dirty solution is to set it via the CC variable on the commandline:
luarocks install yaml-1.1.2-1.src.rock CC="mingw32-gcc -DYAML_DECLARE_STATIC"
After that there should be a yaml\core.dll file and a yaml\init.lua file somewhere in your LuaRocks directory. To use the Lua yaml binding you have to make sure that a require("yaml") loads the yaml\init.lua file, and that require("yaml.core") loads yaml\core.dll. This can be achieved by adding to package.path/package.cpath (from within your Lua script) or preferably by adding to LUA_PATH/LUA_CPATH. Since the installed LuaSocket already works, you probably have LUA_PATH/LUA_CPATH mostly set up correctly, but the yaml binding uses a different approach for loading its main Lua module than LuaSocket: LuaSocket has socket.lua for require("socket"), but yaml has yaml\init.lua for require("yaml"). This approach has the advantage that any Lua submodules (e.g. yaml.a) would be in the same directory as the code for the main Lua module. Anyway, you also have to add
D:\user\install\lua\luarocks\systree\share\lua\5.1\?\init.lua
to your LUA_PATH environment variable.
Btw., the yaml.lua file you found in the github repository is a symbolic link and won't work correctly on Windows anyway (but it could interfere, so you shouldn't put it into your rocks tree). It's only there for convenience during development.

Creating R package with Rcpp: errors

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.
```

Installing rb-gsl gem using Cygwin

I'm having issues installing rb-gsl under Windows using Cygwin. I'm using the RubyInstaller for Windows with the dev kit installed. I've installed Cygwin and the GSL runtime, gsl-apps, gsl-devel and gsl-doc packages. When issuing a gem install command I get the following:
$ gem.bat install "C:\Documents and Settings\jzh3fd.2UA1071FGF\Desktop\gsl-1.14
.7.gem"
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing C:\Documents and Settings\jzh3fd.2UA1071FGF\Desktop\gsl
-1.14.7.gem:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
checking gsl version... 1.14
checking gsl cflags... -I/usr/include
checking for main() in -lcblas... no
checking gsl libs... -L/usr/lib -lgsl -lgslcblas -lm
checking for round()... no
checking for rngextra/rngextra.h... no
checking for qrngextra/qrngextra.h... no
checking for ool/ool_version.h... no
checking for tensor/tensor.h... no
checking for jacobi.h... no
checking for gsl/gsl_cqp.h... no
checking for gsl/gsl_multimin_fsdf.h... no
checking for gsl_poly_solve_quartic() in -lgsl... no
checking for gsl_eigen_francis() in -lgsl... no
checking for ndlinear/gsl_multifit_ndlinear.h... no
checking for alf/alf.h... no
checking rb-gsl version...1.14.7
checking ruby version... 1.9.2
checking for graph... no
checking for narray.h... yes
checking for main() in -lnarray... no
checking for tamu_anova/tamu_anova.h... no
checking for main() in -ltamuanova... no
creating Makefile
make
C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_rb_gsl'" > rb_gsl-i386-mingw32.de
f
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DHAVE_NARRAY_H -IC:/Rub
y192/lib/ruby/gems/1.9.1/gems/narray-0.5.9.9/. -IC:/Ruby192/lib/ruby/site_ruby/1
.9.1/i386-msvcrt -Wall -I../include -I/usr/include -o alf.o -c alf.c
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DHAVE_NARRAY_H -IC:/Rub
y192/lib/ruby/gems/1.9.1/gems/narray-0.5.9.9/. -IC:/Ruby192/lib/ruby/site_ruby/1
.9.1/i386-msvcrt -Wall -I../include -I/usr/include -o array.o -c array.c
In file included from array.c:14:0:
../include/rb_gsl_common.h:18:27: fatal error: gsl/gsl_errno.h: No such file or
directory
compilation terminated.
make: *** [array.o] Error 1
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/gsl-1.14.
7 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/gsl-1.14.7/ext/gem_make.ou
t
I have checked and I can find gsl_errno.h at /usr/include/gsl
Try supplying the path for the GSL includes on the command line when installing the gem.
gem install gsl -- --with-gsl-include-path=/usr/include/gsl

Resources