rwinlib / gcc-4.9.3

Building R for Windows with the new gcc 4.9.3 toolchain
28 stars 7 forks source link

Issue installing packages from source #14

Closed KaiserDominici closed 6 years ago

KaiserDominici commented 6 years ago

I have been experiencing an issue installing packages from source, where Rtools 3.4.0.1964 seems unable to locate some file. For example, trying to install Rcpp:

> install.packages("~/Downloads/Rcpp_0.12.13.tar.gz", repos = NULL, type = "source")
Installing package into ‘C:/R/Library’
(as ‘lib’ is unspecified)
* installing *source* package 'Rcpp' ...
** package 'Rcpp' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-34~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O3 -Wall  -c Date.cpp -o Date.o
In file included from C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/i686-w64-mingw32/bits/c++allocator.h:33:0,
                 from C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/allocator.h:46,
                 from C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/tr1/unordered_map:36,
                 from ../inst/include/Rcpp/platform/compiler.h:172,
                 from ../inst/include/Rcpp/r/headers.h:48,
                 from ../inst/include/RcppCommon.h:29,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/ext/new_allocator.h:33:15: fatal error: new: No such file or directory
 #include <new>
               ^
compilation terminated.
make: *** [Date.o] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-34~1.2/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-34~1.2/share/make/winshlib.mk" -f "C:/Users/kaiser/.R/Makevars" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="Rcpp.dll" OBJECTS="Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o"' had status 2
ERROR: compilation failed for package 'Rcpp'

I think my PATH is correct:

> Sys.getenv("PATH")
[1] "C:\\Program Files\\R\\R-3.4.2\\bin\\x64;C:\\Rtools\\mingw_32\\bin;C:\\Rtools\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\"

Also:

> system('g++ -v')
Using built-in specs.
COLLECT_GCC=C:\Rtools\mingw_32\bin\G__~1.EXE
COLLECT_LTO_WRAPPER=C:/Rtools/mingw_32/bin/../libexec/gcc/i686-w64-mingw32/4.9.3/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-4.9.3/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/home/Jeroen/mingw-gcc-4.9.3/i686-493-posix-dwarf-rt_v3-s/mingw32 --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-static --disable-shared --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static --with-mpfr=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static --with-mpc=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static --with-isl=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static --with-cloog=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i686-posix-dwarf, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/home/Jeroen/mingw-gcc-4.9.3/i686-493-posix-dwarf-rt_v3-s/mingw32/opt/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-zlib-static/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/home/Jeroen/mingw-gcc-4.9.3/i686-493-posix-dwarf-rt_v3-s/mingw32/opt/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-zlib-static/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/home/Jeroen/mingw-gcc-4.9.3/i686-493-posix-dwarf-rt_v3-s/mingw32/opt/lib -L/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-zlib-static/lib -L/home/Jeroen/mingw-gcc-4.9.3/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: posix
gcc version 4.9.3 (i686-posix-dwarf, Built by MinGW-W64 project) 

I am using R 3.4.2 and Rstudio 1.1.383 on Windows 7 Enterprise.

Thank you for any help,

k.

jeroen commented 6 years ago

Can you remove C:\\Rtools\\mingw_32\\bin from the PATH? R should be able to find the compiler via BINPREF. Setting the 32bit compiler on the path may cause conflicts with 64 builds.

Does it work via devtools::install_cran("Rcpp", force = TRUE) ?

KaiserDominici commented 6 years ago

Hi jeroen,

It does work via devtools. I removed that path but I have the same issue. However, I did notice something odd:

> Sys.getenv("PATH")
[1] "C:\\Program Files\\R\\R-3.4.2\\bin\\x64;C:\\Rtools\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\"
> install.packages("~/Downloads/Rcpp_0.12.13.tar.gz", repos = NULL, type = "source")
Installing package into ‘C:/R/Library’
(as ‘lib’ is unspecified)
* installing *source* package 'Rcpp' ...
** package 'Rcpp' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-34~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O3 -Wall  -c Date.cpp -o Date.o

I do not have a d: drive... Could that be it?

Thanks

gaborcsardi commented 6 years ago

The d: path is hardwired into R, because that's the path R-core is using on their server.... No need to worry about it.

KaiserDominici commented 6 years ago

Then I have no clue...

KaiserDominici commented 6 years ago

This is the output I get if I use the -H option in CXXFLAGS:

> install.packages("~/Downloads/Rcpp_0.12.13.tar.gz", repos = NULL, type = "source")
Installing package into ‘C:/R/Library’
(as ‘lib’ is unspecified)
* installing *source* package 'Rcpp' ...
** package 'Rcpp' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-34~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O3 -H -Wno-unused-variable -Wno-unused-function -c Date.cpp -o Date.o
. ../inst/include/Rcpp.h
.. ../inst/include/RcppCommon.h
... ../inst/include/Rcpp/r/headers.h
.... ../inst/include/Rcpp/platform/compiler.h
..... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/cmath
...... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/i686-w64-mingw32/bits/c++config.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/i686-w64-mingw32/bits/os_defines.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/i686-w64-mingw32/bits/cpu_defines.h
...... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/cpp_type_traits.h
...... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/ext/type_traits.h
...... C:/Rtools/mingw_32/i686-w64-mingw32/include/math.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/crtdefs.h
........ C:/Rtools/mingw_32/i686-w64-mingw32/include/_mingw.h
......... C:/Rtools/mingw_32/i686-w64-mingw32/include/_mingw_mac.h
......... C:/Rtools/mingw_32/i686-w64-mingw32/include/_mingw_secapi.h
......... C:/Rtools/mingw_32/i686-w64-mingw32/include/vadefs.h
.......... C:/Rtools/mingw_32/i686-w64-mingw32/include/_mingw.h
........... C:/Rtools/mingw_32/i686-w64-mingw32/include/sdks/_mingw_directx.h
........... C:/Rtools/mingw_32/i686-w64-mingw32/include/sdks/_mingw_ddk.h
..... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/tr1/unordered_map
...... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/utility
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/stl_relops.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/stl_pair.h
........ C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/move.h
......... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/concept_check.h
...... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/stl_algobase.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/functexcept.h
........ C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/exception_defines.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/ext/numeric_traits.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/stl_iterator_base_types.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/stl_iterator_base_funcs.h
........ C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/debug/debug.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/stl_iterator.h
........ C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/ptr_traits.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/predefined_ops.h
...... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/allocator.h
....... C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/i686-w64-mingw32/bits/c++allocator.h
........ C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/ext/new_allocator.h
In file included from C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/i686-w64-mingw32/bits/c++allocator.h:33:0,
                 from C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/bits/allocator.h:46,
                 from C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/tr1/unordered_map:36,
                 from ../inst/include/Rcpp/platform/compiler.h:172,
                 from ../inst/include/Rcpp/r/headers.h:48,
                 from ../inst/include/RcppCommon.h:29,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
C:/Rtools/mingw_32/i686-w64-mingw32/include/c++/ext/new_allocator.h:33:15: fatal error: new: No such file or directory
 #include <new>
               ^
compilation terminated.
make: *** [Date.o] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-34~1.2/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-34~1.2/share/make/winshlib.mk" -f "C:/Users/kaiser/.R/Makevars" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="Rcpp.dll" OBJECTS="Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o"' had status 2
ERROR: compilation failed for package 'Rcpp'
* removing 'C:/R/Library/Rcpp'
* restoring previous 'C:/R/Library/Rcpp'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  problem copying C:\R\Library\00LOCK-Rcpp\Rcpp\libs\x64\Rcpp.dll to C:\R\Library\Rcpp\libs\x64\Rcpp.dll: Permission denied
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-34~1.2/bin/x64/R" CMD INSTALL -l "C:\R\Library" "C:/Users/kaiser/Downloads/Rcpp_0.12.13.tar.gz"' had status 1
Warning in install.packages :
  installation of package ‘C:/Users/kaiser/Downloads/Rcpp_0.12.13.tar.gz’ had non-zero exit status

In the fifth to last line, where it says 'problem copying', it mentions a permission denied. Could that explain it? Is that what #include <new> is looking for?

Thanks

KaiserDominici commented 6 years ago

Solved. It was an issue on our side with the installation of the rtools due to the way packaged is deployed to users. Thanks.

jeroen commented 6 years ago

Can you be more specific what the issue was? It always seems to work fine for most users?

KaiserDominici commented 6 years ago

Rtools were packaged by our IT team, who then deployed it to my machine. The tool they use to capture legacy installations and convert to .MSI is InstallShield. The issue was that using the default “Installation Monitoring” method for some reason this did not capture all of the files in the installation. Hence the missing header files. By using the “Snapshot” application installation capture method the complete installation was captured.

Hope this helps if future enterprise users encounter the same issue.