R compilation failed for package fst - r

I'm trying to install fst R package from CRAN but I get error:
gcc -I"/path/apps/R/3.5.1-20180807-test/x86_64-linux-2.6-rhel6/lib64/R/include" -DNDEBUG
-fopenmp -I. -Ifstcore -Ifstcore_v1 -Ifstcore/LZ4 -Ifstcore/ZSTD -Ifstcore/ZSTD/common
-Ifstcore/ZSTD/decompress -Ifstcore/ZSTD/compress
-I"/path/apps/R/3.5.1-20180807-test/x86_64-linux-2.6-rhel6/r_libs_site/Rcpp/include"
-I /path/apps/R/static-zlib-gcc6.3/x86_64-linux-2.6-rhel6/include -fpic
-I /path/apps/R/static-zlib-gcc6.3/x86_64-linux-2.6-rhel6/include
-c fstcore/ZSTD/compress/huf_compress.c -o fstcore/ZSTD/compress/huf_compress.o
gcc -I"/path/apps/R/3.5.1-20180807-test/x86_64-linux-2.6-rhel6/lib64/R/include" -DNDEBUG
-fopenmp -I. -Ifstcore -Ifstcore_v1 -Ifstcore/LZ4 -Ifstcore/ZSTD -Ifstcore/ZSTD/common
-Ifstcore/ZSTD/decompress -Ifstcore/ZSTD/compress
-I"/path/apps/R/3.5.1-20180807-test/x86_64-linux-2.6-rhel6/r_libs_site/Rcpp/include"
-I /path/apps/R/static-zlib-gcc6.3/x86_64-linux-2.6-rhel6/include -fpic
-I /path/apps/R/static-zlib-gcc6.3/x86_64-linux-2.6-rhel6/include
-c fstcore/ZSTD/decompress/zstd_decompress.c -o fstcore/ZSTD/decompress/zstd_decompress.o
/tmp/cc0LoSFX.s: Assembler messages:
/tmp/cc0LoSFX.s:7353: Error: no such instruction: `shlx %rax,%rdx,%rax'
/tmp/cc0LoSFX.s:8204: Error: no such instruction: `shlx %rax,%rdx,%rax'
/tmp/cc0LoSFX.s:8608: Error: no such instruction: `shlx %rax,%rdx,%rax'
make: *** [fstcore/ZSTD/decompress/zstd_decompress.o] Error 1
ERROR: compilation failed for package ‘fst’
I there any required linux library that can be compiled from source? What else I can do?
EDIT:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/path/apps/gcc/6.3.0/x86_64-linux-2.6-rhel6/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/path/apps/gcc/6.3.0/x86_64-linux-2.6-rhel6 --disable-multilib
Thread model: posix
gcc version 6.3.0 (GCC)

Putting this here for posterity in case others eventually land on this question when facing similar issues.
It turns out that as far as we can tell, the problem was incompatible versions of the assembler (/usr/bin/as) and gcc (our non-system 6.3.0 installation).
So if you landed here at the end of your rope with no idea why you're seeing these errors, looking into getting a compatible version of the assembler (in linux world this is part of the binutils module/project). Hope that helps.

Related

Torch '!./install.sh' returns error in Colab when installing Torch

I followed http://torch.ch/docs/getting-started.html#_ to install Torch.
I always get the following error when running
!./install.sh
in google colab
error:
...
-- Installing: /root/torch/install/include/luaT.h
-- Installing: /root/torch/install/share/cmake/torch/luaTConfig.cmake
Updating manifest for /root/torch/install/lib/luarocks/rocks
torch scm-1 is now built and installed in /root/torch/install/ (license: BSD)
Updating manifest for /root/torch/install/lib/luarocks/rocks
dok scm-1 is now built and installed in /root/torch/install/ (license: BSD)
gcc -O2 -fPIC -I/root/torch/install/include -c utils.c -o utils.o
gcc -shared -o treplutils.so -L/root/torch/install/lib utils.o
gcc -O2 -fPIC -I/root/torch/install/include -c readline.c -o readline.o
readline.c:8:10: fatal error: readline/readline.h: No such file or directory
#include <readline/readline.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Error: Build error: Failed compiling object readline.o
.
Please I need help fixing this error.
Probably you need something like
!apt-get install libreadline-dev
before attempting to run the install.sh script.

Linux issue happens on Windows? "fatal error: fftw3.h: No such file or directory"

I am running MRO 3.5.0 on Win10, and trying to install a package image.CannyImage from bnosac/image on the github. But it keeps reporting fatal errors as following.
* installing *source* package 'image.CannyEdges' ...
** libs
c:/Rtools/mingw_64/bin/g++ -m64 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I"C:/Users/eric1/Documents/R/win-library/3.5/Rcpp/include" -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_64/bin/gcc -m64 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I"C:/Users/eric1/Documents/R/win-library/3.5/Rcpp/include" -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include" -O2 -Wall -std=gnu99 -mtune=core2 -c adsf.c -o adsf.o
c:/Rtools/mingw_64/bin/g++ -m64 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I"C:/Users/eric1/Documents/R/win-library/3.5/Rcpp/include" -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include" -O2 -Wall -mtune=core2 -c rcpp_canny.cpp -o rcpp_canny.o
In file included from rcpp_canny.cpp:13:0:
canny.h:8:19: fatal error: fftw3.h: No such file or directory
#include <fftw3.h>
^
compilation terminated.
make: *** [C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/etc/x64/Makeconf:215: rcpp_canny.o] Error 1
ERROR: compilation failed for package 'image.CannyEdges'
* removing 'C:/Users/eric1/Documents/R/win-library/3.5/image.CannyEdges'
In R CMD INSTALL
Installation failed: Command failed (1)
^
compilation terminated.
Google says I can solve the issue by sudo apt-get remove libfftw3-dev. Unfortunately, I am on Windows, and some advised, apply lib /machine:i386 /def:libfftw3-3.def on cmd mode. Ouch, there is no such command or file called lib.exe on Win10.
Please advise, how I can solve this issue on my Win10+MRO system. Thanks.
Even though this question is already a bit old:
By now (Feb 2020) there are precompiled packages available that work also under Windows:
Canny Edges - Package
and more general:
List of all available packages
I have tried installing them and (at least for me) it worked.

loop_apply.o: file not recognized: File format not recognized

I am trying to install R’s plyr package. Here is the error message:
* installing *source* package ‘plyr’ ...
** package ‘plyr’ successfully unpacked and MD5 sums checked
** libs
clang++ -I/opt/R-3.4.1/include -DNDEBUG -I"/home/isomorphismes/R/i686-pc-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -I/opt/boost_1_61_0/boost -c RcppExports.cpp -o RcppExports.o
clang -I/opt/R-3.4.1/include -DNDEBUG -I"/home/cd/R/i686-pc-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -g -O2 -flto -c loop_apply.c -o loop_apply.o
clang++ -I/opt/R-3.4.1/include -DNDEBUG -I"/home/isomorphismes/R/i686-pc-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -I/opt/boost_1_61_0/boost -c split-numeric.cpp -o split-numeric.o
clang++ -shared -L/usr/local/lib -o plyr.so RcppExports.o loop_apply.o split-numeric.o
loop_apply.o: file not recognized: File format not recognized
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/opt/R-3.4.1/share/make/shlib.mk:6: recipe for target 'plyr.so' failed
make: *** [plyr.so] Error 1
ERROR: compilation failed for package ‘plyr’
* removing ‘/home/cd/R/i686-pc-linux-gnu-library/3.4/plyr’
The *.o files are in /opt/plyr/src, from github.com/hadley/plyr. They look like this on my system:
i#scheherezade:/opt/plyr/src$ file *o
loop_apply.o: LLVM IR bitcode
RcppExports.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
split-numeric.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
In case you didn't know, -flto specifies link time optimization, and has been added by R. How did you manage to end up with such a mis-configured R install?
Adding -flto to the link command may work? Or remove it from the loop_apply compilation line. If either of those works, you need to fix your R install.
Compiling with -flto using clang requires (on Ubuntu) installing the llvm-dev package. Otherwise, the linker is unable to handle -flto object files.
apt-get install clang-10 llvm-10-dev
Now the linking should succeed.

Unable to install fortran based packages in R - "gfortran -m32:not found"

I am writing an R package that has Fortran source code. In short, my problem is when I try to install the package I get the error "gfortran -m32: not found" however, I am able compile my code using gfortran -m32 when I'm not installing the package.
Detailed Version:
I have installed the newest version of R(3.1.1) along with the newest version of Rtools(31) and renamed my path variables accordingly (C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;C:\Program Files\R\R-3.1.1\bin\x64;C:\msys;C:\Program Files (x86)\SSH Secure Shell;C:\Program Files\MiKTeX 2.9\miktex\bin).
For testing purposes, I downloaded the PropClust package from CRAN which has Fortran source code.
When I type "R CMD INSTALL PropClust_1.4.tar.gz" after building it, I get the following error:
* installing *source* package 'PropClust' ...
** libs
*** arch - i386
C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf:202: warning: overriding recipe for target `.m.o'
C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf:195: warning: ignoring old recipe for target `.m.o'
gfortran -m32 -O3 -mtune=core2 -c PropClustParallelTrials.f90 -o PropClustParallelTrials.o
gcc -m32 -I"C:/PROGRA~1/R/R-31~1.1/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall -std=gnu99 -mtune=core2 -c minWhichMin.c -o minWhichMin.o
gfortran -m32 -shared -s -static-libgcc -o PropClust.dll tmp.def PropClustParallelTrials.o minWhichMin.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.1/bin/i386 -lR
gfortran -m32: not found
C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf:202: warning: overriding recipe for target `.m.o'
C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf:195: warning: ignoring old recipe for target `.m.o'
cygwin warning:
MS-DOS style path detected: C:/PROGRA~1/R/R-31~1.1/bin/i386/Rterm.exe
Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-31~1.1/bin/i386/Rterm.exe
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
no DLL was created
ERROR: compilation failed for package 'PropClust'
* removing 'C:/Users/kamicz/Documents/IsotopeR/PropClust.Rcheck/PropClust'
Although it says "gfortran -m32: not found" I have compiled my code in the same window with the same options(gfortran -m32 -O3 -mtne=core2 -c a.f90 -o a.out) with no problems. Has anyone had this problem before? I am running Windows 7 64-bit if that matters.
I had a similar problem : R was invoking gfortran-4.8 - an unrecognized command on my system - instead of gfortran. This problem was fixed upon creating the file ~/.R/Makevars within my home directory. Here are the contents of Makevars which points to the appropriate gfortran installation:
F77 = gfortran
FC = gfortran
FLIBS = -L/usr/local/gfortran/lib

Installing knncat

I am using R in Ubuntu 10.04.
I need to understand the documentation.
Installing knncat I get this error message:
gcc -I/usr/share/R/include -I . -DUSE_R_ALLOC -DCALL_FROM_R -fpic
-std=gnu99 -O3 -pipe -g -c ranlib.c -o ranlib.o gcc -I/usr/share/R/include -I . -DUSE_R_ALLOC -DCALL_FROM_R -fpic -std=gnu99 -O3 -pipe -g -c utilsR.c -o utilsR.o gcc -shared -o knncat.so com.o dodisc.o donn.o donnwrap.o dsort.o linpack.o matrix.o
objective.o ords.o ranlib.o utilsR.o -llapack -lblas -lgfortran -lm
-L/usr/lib/R/lib -lR /usr/bin/ld: cannot find -llapack collect2: ld returned 1 exit status make: *** [knncat.so] Error 1 ERROR:
compilation failed for package ‘knncat’
In the documentation I find this recomendation:
Provision is made for using an external LAPACK library, principally to
cope with BLAS libraries which contain a copy of LAPACK (such as sunperf
on Solaris, vecLib on OS X and ACML on ‘ix86’/‘x86_64’ Linux)
If it is mandatory (?), I should use this code:
--with-lapack="-L/path/to/libs -llapack -lcblas"
But where? I am using the standard installation of packages in R.
install.packages('knncat')
I am not sure of:
Is it mandatory to install lapack? I do have BLAS + LAPACK.
How to install a package without using install.packages()?
which are the choices I have now?
Please install the r-base-dev package, which will take care of the -dev packages for LAPACK and BLAS as well.
It was an old version of R. Even when I did upgrade, it does not fixed.
I followed this orders: from http://ubuntuforums.org/showthread.php?t=377323
sudo aptitude install r-base r-recommended
In R
install.packages('knncat')
Now it is working!

Resources