I've installed Octave in Linux machine (Ubuntu 20.04) using this code:
sudo apt-add-repository -y ppa:octave/stable;
sudo apt install -y software-properties-common;
sudo apt-get update;
sudo apt-get install -y octave liboctave-dev
The program works perfectly using his interface.
I now wanted to use it through R via the library RcppOctave but I'm not even able to install it.
Using the default installation doesn't work because of the R version:
> install.packages('RcppOctave')
Installing package into ‘/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘RcppOctave’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
> install.packages("RcppOctave", repos="http://R-Forge.R-project.org")
Installing package into ‘/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘RcppOctave’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Then I tried to installed it from github (install_github('https://github.com/renozao/RcppOctave')) or directly from the tar.gz latest release, but this is the error I get:
> file <- '../../05_Software/R/RcppOctave_0.8.5.tar.gz'
> install.packages(pkgs=file, type="source", repos=NULL)
Installing package into ‘/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
* installing *source* package ‘RcppOctave’ ...
** package ‘RcppOctave’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether R is a shared library... yes
Using R LDFLAGS: -Wl,--export-dynamic -fopenmp -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n
Using R CPPFLAGS: -I/usr/share/R/include
checking for octave-config... /usr/bin/octave-config
checking for mkoctfile... /usr/bin/mkoctfile
checking Octave include directory... /usr/include/octave-5.2.0/octave
checking Octave library directory... /usr/lib/x86_64-linux-gnu/octave/5.2.0
checking Octave version... 5.2.0
checking whether to infer output names for Octave function (>= 3.4.3)... yes
configure: creating ./config.status
config.status: creating src/Makevars
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/modules/Makefile
** libs
cd modules;\
make; \
mkdir -p "/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppOctave/00new/RcppOctave/modules"; \
echo "Moving Octave modules to '"/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppOctave/00new/RcppOctave/modules"'"; \
cp -f PKG_ADD *.oct "/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppOctave/00new/RcppOctave/modules";
make[1]: se entra en el directorio '/tmp/RtmpJjatgt/R.INSTALL144cc3d8bf8b1/RcppOctave/src/modules'
/usr/bin/mkoctfile -v -c -I/usr/share/R/include Rrng.cc
g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -I/usr/share/R/include Rrng.cc -o Rrng.o
Rrng.cc:32:10: fatal error: octave/config.h: No existe el archivo o el directorio
32 | #include <octave/config.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:25: Rrng.oct] Error 1
make[1]: se sale del directorio '/tmp/RtmpJjatgt/R.INSTALL144cc3d8bf8b1/RcppOctave/src/modules'
Moving Octave modules to '/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppOctave/00new/RcppOctave/modules'
cp: no se puede efectuar `stat' sobre '*.oct': No existe el archivo o el directorio
make: *** [Makevars:18: OctaveModule] Error 1
ERROR: compilation failed for package ‘RcppOctave’
* removing ‘/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/RcppOctave’
Warning in install.packages :
installation of package ‘../../05_Software/R/RcppOctave_0.8.5.tar.gz’ had non-zero exit status
The goal es clear: How can I install this library in R 4.1 (Ubuntu machine 20.04)?
UPDATE (20/10/21)
I've used this comand as #Gorka sujested:
sudo ln -s /usr/include/octave-5.2.0/octave/octave-config.h /usr/include/octave-5.2.0/octave/config.h
...but this is the new error:
> install_github('https://github.com/renozao/RcppOctave')
Downloading GitHub repo renozao/RcppOctave#HEAD
✓ checking for file ‘/tmp/Rtmp2OpHDN/remotes23297a629ef/renozao-RcppOctave-fcf4d02/DESCRIPTION’ ...
─ preparing ‘RcppOctave’:
✓ checking DESCRIPTION meta-information ...
─ cleaning src
─ running ‘cleanup’
─ installing the package to process help pages
-----------------------------------
─ installing *source* package ‘RcppOctave’ ...
** using staged installation
checking R architecture... none
checking for R... /usr/lib/R/bin/R
checking for Rscript... /usr/lib/R/bin/Rscript
checking whether loading Rprofile writes to stdout... no
checking R version... R version 4.1.1 (2021-08-10)
checking R platform... x86_64-pc-linux-gnu
checking R CC... gcc -std=gnu99
checking R CFLAGS... -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall -pedantic -fdiagnostics-color=always
checking R CPPFLAGS...
checking R CXXFLAGS... -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall -pedantic -fdiagnostics-color=always
checking for gcc... /usr/bin/gcc
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for g++... /usr/bin/g++
configure: Original R_LDFLAGS: -Wl,--export-dynamic -fopenmp -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n
configure: Original R_CPPFLAGS: -I/usr/share/R/include
checking whether R is a shared library... yes
checking type of Operating System... Linux
checking whether OS is Mac OS (Darwin)... no
configure: Using mkoctfile with R_LDFLAGS: -Wl,--export-dynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n
configure: Using mkoctfile with R_CPPFLAGS: -I/usr/share/R/include
checking Octave custom binary path specification... none
configure: using Octave binary path from $PATH
checking for octave-config... /usr/bin/octave-config
checking for mkoctfile... /usr/bin/mkoctfile
checking Octave Octave bin directory... /usr/bin
checking Octave Octave libraries directory... /usr/lib/x86_64-linux-gnu/octave/5.2.0
checking for octave... /usr/bin/octave
checking PATH changes... none
checking Octave module make target... all
checking mkoctfile command... /usr/bin/mkoctfile
checking Octave cpp flags... -Wdate-time -D_FORTIFY_SOURCE=2
checking Octave include flags... -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave
checking Octave -L flags... warning: LFLAGS is deprecated and will be removed in a future version of Octave, use LDFLAGS instead
-L/usr/lib/x86_64-linux-gnu
checking Octave libraries... -loctinterp -loctave
checking Octave C compiler... gcc
checking Octave Fortran compiler... gfortran
checking Octave platform... x86_64-pc-linux-gnu
checking Octave API version... api-v53
checking Octave version... 5.2.0
checking whether to infer output names for Octave function (>= 3.4.3)... yes
configure: Using Octave LDFLAGS: -L/usr/lib/x86_64-linux-gnu -loctinterp -loctave
configure: Using Octave CPPFLAGS: -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -DOCT_POST_3_4_0=1
checking RcppOctave Octave module directory... /tmp/Rtmprp7Rn4/Rinst241a34c4f6ea/00LOCK-RcppOctave/00new/RcppOctave/modules
configure: creating ./config.status
config.status: creating R/config-vars.R
configure: creating ./config.status
config.status: creating R/config-vars.R
config.status: creating src/Makevars
configure: creating ./config.status
config.status: creating R/config-vars.R
config.status: creating src/Makevars
config.status: creating src/modules/Makefile
** libs
# Making Octave module [r_arch: all]
make[1]: se entra en el directorio '/tmp/Rtmprp7Rn4/Rbuild241a5f538b08/RcppOctave/src/modules'
*** Building octave module: utils.oct
/usr/bin/mkoctfile -v utils.cc
g++ -std=gnu++11 -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security utils.cc -o /tmp/oct-XxPJKC.o
g++ -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -Wl,-Bsymbolic-functions -Wl,-z,relro -o utils.oct /tmp/oct-XxPJKC.o -L/usr/lib/x86_64-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro
*** Building octave module: Rrng.oct
/usr/bin/mkoctfile -v -I/usr/share/R/include -Wl,--export-dynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n Rrng.cc
g++ -std=gnu++11 -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -I/usr/share/R/include Rrng.cc -o /tmp/oct-zr4Boo.o
Rrng.cc: In function ‘octave_value_list Frand(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:181:1: note: in expansion of macro ‘RAND_ARGS’
181 | RAND_ARGS(octave_fun, 0, 2, 0, 1) \
| ^~~~~~~~~
Rrng.cc:196:3: note: in expansion of macro ‘RAND_FUNCTION’
196 | RAND_FUNCTION(unif_rand, "rand")
| ^~~~~~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc: In function ‘octave_value_list Frandn(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:181:1: note: in expansion of macro ‘RAND_ARGS’
181 | RAND_ARGS(octave_fun, 0, 2, 0, 1) \
| ^~~~~~~~~
Rrng.cc:207:2: note: in expansion of macro ‘RAND_FUNCTION’
207 | RAND_FUNCTION(norm_rand, "randn")
| ^~~~~~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc: In function ‘octave_value_list Frande(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:181:1: note: in expansion of macro ‘RAND_ARGS’
181 | RAND_ARGS(octave_fun, 0, 2, 0, 1) \
| ^~~~~~~~~
Rrng.cc:218:2: note: in expansion of macro ‘RAND_FUNCTION’
218 | RAND_FUNCTION(exp_rand, "rande")
| ^~~~~~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc: In function ‘octave_value_list Frandg(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:232:3: note: in expansion of macro ‘RAND_ARGS’
232 | RAND_ARGS("randg", 1, 4, 1, 2)
| ^~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc:238:48: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
238 | double scale(nArgs >= 4 && !args(3).is_empty() ? args(3).double_value() : 1);
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc: In function ‘octave_value_list Frandp(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:256:3: note: in expansion of macro ‘RAND_ARGS’
256 | RAND_ARGS("randp", 2, 3, 1, 2)
| ^~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
g++ -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -Wl,-Bsymbolic-functions -Wl,-z,relro -o Rrng.oct /tmp/oct-zr4Boo.o -Wl,--export-dynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n -L/usr/lib/x86_64-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro
make[1]: se sale del directorio '/tmp/Rtmprp7Rn4/Rbuild241a5f538b08/RcppOctave/src/modules'
# Copying Octave modules to directory '/tmp/Rtmprp7Rn4/Rinst241a34c4f6ea/00LOCK-RcppOctave/00new/RcppOctave/modules'
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG `"/usr/lib/R/bin/Rscript" -e "Rcpp:::CxxFlags()"` -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -DOCT_POST_3_4_0=1 -I'/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall -pedantic -fdiagnostics-color=always -c conversion.cpp -o conversion.o
In file included from /usr/include/octave-5.2.0/octave/../octave/lo-utils.h:35
from /usr/include/octave-5.2.0/octave/../octave/Array.h:41
from /usr/include/octave-5.2.0/octave/../octave/str-vec.h:32
from /usr/include/octave-5.2.0/octave/../octave/ovl.h:33
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/quit.h:178:2:warning: tra ‘;-Wpedantic
178 | };
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/boolMatrix.h:30
from /usr/include/octave-5.2.0/octave/../octave/mx-base.h:34
from /usr/include/octave-5.2.0/octave/../octave/ov.h:40
from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/boolNDArray.h:121:46:warning: tra ‘;-Wpedantic
121 | BSXFUN_OP_DECL (and, boolNDArray, OCTAVE_API);
| ^
/usr/include/octave-5.2.0/octave/../octave/boolNDArray.h:122:45:warning: tra ‘;-Wpedantic
122 | BSXFUN_OP_DECL (or, boolNDArray, OCTAVE_API);
| ^
conversion.cpp:n function ‘SEXPREC* wrap(const Cell&, bool)
conversion.cpp:134:9:error: const class Cellhas no member named ‘is_cellstr did you mean ‘iscellstr
134 | if( x.is_cellstr
| ^~~~~~~~~~
| iscellstr
conversion.cpp:n function ‘SEXPREC* Rcpp::wrap(const T&) [with T = octave_value; SEXP = SEXPREC*]
conversion.cpp:180:24:warning: bool octave_value::is_null_value() constdeprecated: [4.4]: use 'isnull' instead [-Wdeprecated-declarations
180 | if( val.is_null_value()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:633:8:note: red here
633 | bool is_null_valued) const
| ^~~~~~~~~~~~~
conversion.cpp:214:30:warning: bool octave_value::is_bool_type() constdeprecated: [4.4]: use 'islogical' instead [-Wdeprecated-declarations
214 | else if ( val.is_bool_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:701:8:note: red here
701 | bool is_bool_typed) const
| ^~~~~~~~~~~~
conversion.cpp:219:102:warning: bool octave_value::is_integer_type() constdeprecated: [4.4]: use 'isinteger' instead [-Wdeprecated-declarations
219 | }else if( val.is_int32_type() || val.is_int64_type() || val.is_int16_type() || val.is_integer_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:692:8:note: red here
692 | bool is_integer_typed) const
| ^~~~~~~~~~~~~~~
conversion.cpp:223:30:warning: bool octave_value::is_real_type() constdeprecated: [4.4]: use 'isreal' instead [-Wdeprecated-declarations
223 | }else if( val.is_real_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:708:8:note: red here
708 | bool is_real_typed) const
| ^~~~~~~~~~~~
conversion.cpp:250:33:warning: bool octave_value::is_integer_type() constdeprecated: [4.4]: use 'isinteger' instead [-Wdeprecated-declarations
250 | else if ( val.is_integer_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:692:8:note: red here
692 | bool is_integer_typed) const
| ^~~~~~~~~~~~~~~
conversion.cpp:255:30:warning: bool octave_value::is_real_type() constdeprecated: [4.4]: use 'isreal' instead [-Wdeprecated-declarations
255 | }else if( val.is_real_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:708:8:note: red here
708 | bool is_real_typed) const
| ^~~~~~~~~~~~
conversion.cpp:270:24:warning: bool octave_value::is_map() constdeprecated: [4.4]: use 'isstruct' instead [-Wdeprecated-declarations
270 | } else if( val.is_map()/ Maps are converted into lists
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:594:8:note: red here
594 | bool is_mapd) const
| ^~~~~~
conversion.cpp:307:25:warning: bool octave_value::is_cell() constdeprecated: [4.4]: use 'iscell' instead [-Wdeprecated-declarations
307 | } else if( val.is_cell() Cell objects are used for character vectors
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:541:8:note: red here
541 | bool is_celld) const
| ^~~~~~~
conversion.cpp:n function ‘T Rcpp::as(SEXP) [with T = octave_value; SEXP = SEXPREC*]
conversion.cpp:471:50:error: valid initialization of reference of type ‘const octave_value&from expression of type ‘octave_value_list
471 | const octave_value& ol = as<octave_value_list>(x)
| ~~~~~~~~~~~~~~~~~~~~~^~~
make: *** [/usr/lib/R/etc/Makeconf:177: conversion.o] Error 1
ERROR: compilation failed for package ‘RcppOctave’
─ removing ‘/tmp/Rtmprp7Rn4/Rinst241a34c4f6ea/RcppOctave’
-----------------------------------
ERROR: package installation failed
Error: Failed to install 'RcppOctave' from GitHub:
System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines):
E> | ^~~~~~~
E> conversion.cpp:n function ‘T Rcpp::as(SEXP) [with T = octave_value; SEXP = SEXPREC*]
E> conversion.cpp:471:50:error: valid initialization of reference of type ‘const octave_value&from expression of type ‘octave_value_list
E> 471 | const octave_value& ol = as<octave_value_list>(x)
E> | ~~~~~~~~~~~~~~~~~~~~~^~~
E> make: *** [/usr/lib/R/etc/Makeconf:177: conversion.o] Error 1
E> ERROR: compilation failed for package ‘RcppOctave’
E> * removing ‘/tmp/Rtmprp7Rn4/Rinst241a34c4f6ea/RcppOctave’
E> -----------------------------------
E> ERROR: package installation failed
Sometimes just downloading and installing/building the package on your own is enough, when the package ... is not available for this version of R error message appears.
In this case obviously not ... and Gorka is probably right, when he says it could be the Octave version.
In general I would rather try to get the latest CRAN version RcppOctave_0.18.1 running instead of the GitHub version (whose latest updates were also years ago).
Since the package seems to be temporary or permanently discontinued you never know, if they stopped their Github version in the middle of some changes that didn't work out.
Whereas for the latest CRAN version it is more likely that it was a staple build, that worked at the time it was being uploaded (2015-10-06).
So probably if you replicate the environment from this time (R version, Version of package dependencies, Ubuntu version, Octave version) you have a pretty high chance to get this package running.
But just bringing the Octave version to the current version at the time of RcppOctave_0.18.1 release might also already do the job.
Looking at https://wiki.octave.org/Release_History indicates that version 4.0.0 or 3.8.2 could be a good fit.
I am not really a linux/ubuntu user, but I'd guess just
apt-get install octave=4.0.0
won't do the job of installing the package, since the package must be present in the repository/ package manager. Probably you have to get the old package version from somewhere / add a repository that includes the package version (which you also did in your code with apt-add-repository -y ppa ...).
For Ubuntu you can find old packages at launchpad
https://launchpad.net/ubuntu/trusty/+source/octave
https://launchpad.net/ubuntu/+source/octave/3.8.2-4.1
For Debian you can find old packages at
https://snapshot.debian.org/
Would be interesting to see if building the package works with Octave 4.0.0 or 3.8.2 (and if it is possible to install these).
If you get it running this way and you anyway don't need functionality from newer Octave versions - perfect.
If not ... I don't know of any other R - Octave interface package, which would probably rule out the solution of just using another R package.
A solution (depending on your plans) could be using system() / system2() for invoking system commands.
system invokes the OS command specified by command.
Since (as far as I know) you can also run Octave scripts from the shell, this could be a possible workaround.
I also failed to install RcppOctave in R 4.1.2.
Instead I found a way to run Octave script in R Markdown file. Take a look at this example:
```{octave, engine.path='/usr/local/opt/octave/bin/octave', warning=F}
addpath('/Applications/freesurfer/matlab')
[vertex_coords_sp, faces] = read_surf("/Applications/freesurfer/subjects/fsaverage5/surf/lh.sphere")
save('~/RAS_coord_fs_sphere.mat','-v6')
```
You can refer to this page for more details on Octave code in R Markdown.
Hope this could help someone who also have trouble dealing with split environments :D
Related
when installing a R package from github
install_github("DataSlingers/ExclusiveLasso")
I get the error messages:
* installing *source* package 'ExclusiveLasso' ...
** using staged installation
** libs
g++ -std=gnu++11 -I"/include" -DNDEBUG -I'D:/R-4.2.2/library/Rcpp/include' -I'D:/R-4.2.2/library/RcppArmadillo/include' -I"D:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c ExclusiveLasso.cpp -o ExclusiveLasso.o
In file included from D:/R-4.2.2/library/Rcpp/include/RcppCommon.h:30,
from D:/R-4.2.2/library/RcppArmadillo/include/RcppArmadillo/interface/RcppArmadilloForward.h:25,
from D:/R-4.2.2/library/RcppArmadillo/include/RcppArmadillo.h:29,
from ExclusiveLasso.cpp:23:
D:/R-4.2.2/library/Rcpp/include/Rcpp/r/headers.h:66:10: fatal error: R.h: No such file or directory
66 | #include <R.h>
| ^~~~~
compilation terminated.
make: *** [D:/R-4.2.2/etc/x64/Makeconf:260:ExclusiveLasso.o] 错误 1
ERROR: compilation failed for package 'ExclusiveLasso'
* removing 'D:/R-4.2.2/library/ExclusiveLasso'
I know where my R.h at, and I tried change
#include <R.h>
into
#include <D:/R-4.2.2/include>,
but there's too many files and errors like this
It seems that I should tell the g++ where to find D:/R-4.2.2/include, can someone guide me whether I should do that or what should I do.
I's using:
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Using vscode
Works fine here on Ubuntu 22.10. Note in the log below how it uses -I"/usr/share/R/include" (which is something R itself adds) to point to R's headers. So to me it looks like your R installation is at fault because the src/Makevars.win in that repo is very standard and mostly likely correct.
edd#rob:~$ installGithub.r DataSlingers/ExclusiveLasso # wrapper around install_github()
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo DataSlingers/ExclusiveLasso#HEAD
Skipping 1 packages ahead of CRAN: Rcpp
── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/tmp/remotes2ac86f2646632b/DataSlingers-ExclusiveLasso-ed6b729/DESCRIPTION’ ...
─ preparing ‘ExclusiveLasso’:
✔ checking DESCRIPTION meta-information ...
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘ExclusiveLasso_0.0.tar.gz’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘ExclusiveLasso’ ...
** using staged installation
** libs
ccache g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes -c ExclusiveLasso.cpp -o ExclusiveLasso.o
ccache g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes -c RcppExports.cpp -o RcppExports.o
ccache g++ -std=gnu++11 -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o ExclusiveLasso.so ExclusiveLasso.o RcppExports.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Linux" ]] ; then /usr/bin/strip --strip-debug *.o *.so; fi
if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Darwin" ]] ; then /usr/bin/strip -S *.o *.so; fi
installing to /usr/local/lib/R/site-library/00LOCK-ExclusiveLasso/00new/ExclusiveLasso/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (ExclusiveLasso)
edd#rob:~$
Looking at your installation attempt confirms that because you have
g++ -std=gnu++11 -I"/include"
so R does not figure out where its installation is. Normally you should have
edd#rob:~$ R RHOME
/usr/lib/R
edd#rob:~$
but I suspect that too is borked at your end.
I tried to build affxparser an R package on my book, M1 MacOS 12.3.1, with R 4.1.3 and gcc 11.2.0.
However the building runs error. (as the limit of characters, i haven't put few beginning lines, to see more details can click here
g++-11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -Ifusion/calvin_files/array/src -Ifusion/calvin_files/data/src -Ifusion/calvin_files/exception/src -Ifusion/calvin_files/fusion/src -Ifusion/calvin_files/fusion/src/GCOSAdapter -Ifusion/calvin_files/fusion/src/CalvinAdapter -Ifusion/calvin_files/parameter/src -Ifusion/calvin_files/parsers/src -Ifusion/calvin_files/portability/src -Ifusion/calvin_files/template/src -Ifusion/calvin_files/utils/src -Ifusion/calvin_files/writers/src -Ifusion/file -Ifusion/file/TsvFile -Ifusion/portability -Ifusion/util -Ifusion -D_USE_MEM_MAPPING_ -I/opt/R/arm64/include -fPIC -mtune=native -g -O2 -Wall -pedantic -Wconversion -Wno-sign-compare -O0 -c fusion/calvin_files/fusion/src/FusionCELData.cpp -o fusion/calvin_files/fusion/src/FusionCELData.o
In file included from fusion/file/CELFileData.h:33,
from fusion/calvin_files/fusion/src/GCOSAdapter/GCOSCELDataAdapter.h:30,
from fusion/calvin_files/fusion/src/FusionCELData.cpp:24:
fusion/file/FileIO.h: In function 'uint16_t affy_swap16(uint16_t)':
fusion/file/FileIO.h:67:31: warning: conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} may change value [-Wconversion]
67 | return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from fusion/calvin_files/fusion/src/GCOSAdapter/GCOSCELDataAdapter.h:30,
from fusion/calvin_files/fusion/src/FusionCELData.cpp:24:
fusion/file/CELFileData.h: At global scope:
fusion/file/CELFileData.h:91:23: warning: malformed '#pragma options align={mac68k|power|reset}', ignoring [-Wpragmas]
91 | #pragma options align=packed
| ^~~~~~
fusion/file/CELFileData.h:127:23: error: too many '#pragma options align=reset'
127 | #pragma options align=reset
| ^~~~~
fusion/calvin_files/fusion/src/FusionCELData.cpp: In member function 'unsigned int affymetrix_fusion_io::FusionCELData::GetFileSize()':
fusion/calvin_files/fusion/src/FusionCELData.cpp:492:22: warning: conversion from 'int64_t' {aka 'long long int'} to 'unsigned int' may change value [-Wconversion]
492 | return Fs::fileSize(filename);
| ~~~~~~~~~~~~^~~~~~~~~~
make: *** [fusion/calvin_files/fusion/src/FusionCELData.o] Error 1
ERROR: compilation failed for package ‘affxparser’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/affxparser’
Besides, i have installed some other packages which also run error. According to some information, i wrote some codes in bash_profile and Makevars in command line.
I add codes below in bash_profile
alias gcc='gcc-11'
alias cc='gcc-11'
alias g++='g++-11'
alias c++='c++-11'
I create a Makevars which is
VER=-11
CC=gcc$(VER)
CXX=g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
FLIBS=-L/usr/local/Cellar/gcc/11.2.0/lib/gcc/11
I thought the make: ***[fusion/calvin_files/fusion/src/FusionCELData.o] Error 1 might be the problem, but I don't know how to fix it. Hope for anyone answer.
I fix this problem with hiding away those codes in my Makevars and bash_profile showed above, which turn my profiler into default clang to profile codes in affxparser. Finally, finish this.
I'm on a MacBook Air with an Apple M1 chip, using macOS 11.6 Big Sur. I'm on R 4.1.1. I have Xtools and gfortran for the Apple M1 installed:
markwhite#marks-air ~ % which xcode-select
/usr/bin/xcode-select
markwhite#marks-air ~ % which gfortran
/usr/local/bin/gfortran
I am able to successfully install and run R—but installing some packages is giving me trouble:
> install.packages("mvtnorm")
There is a binary version available but the source version is later:
binary source needs_compilation
mvtnorm 1.1-2 1.1-3 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘mvtnorm’
trying URL 'https://cran.rstudio.com/src/contrib/mvtnorm_1.1-3.tar.gz'
Content type 'application/x-gzip' length 166421 bytes (162 KB)
==================================================
downloaded 162 KB
* installing *source* package ‘mvtnorm’ ...
** package ‘mvtnorm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c miwa.c -o miwa.o
/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c mvt.f -o mvt.o
make: /opt/R/arm64/bin/gfortran: No such file or directory
make: *** [mvt.o] Error 1
ERROR: compilation failed for package ‘mvtnorm’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/mvtnorm’
Warning in install.packages :
installation of package ‘mvtnorm’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/fx/f46lfqf56_df59fvzgqhcbyr0000gn/T/RtmpfGZUAF/downloaded_packages’
>
I believe the key line is: make: /opt/R/arm64/bin/gfortran: No such file or directory where it is looking in the wrong location for gfortran.
Confirming it is not there:
markwhite#marks-air ~ % cd /opt/R/arm64/
markwhite#marks-air arm64 % ls -la
total 0
drwxrwxr-x 8 root wheel 256 Oct 18 11:04 .
drwxrwxr-x 3 root wheel 96 May 13 20:40 ..
drwxrwxr-x 14 root wheel 448 Oct 19 21:34 bin
drwxrwxr-x 29 root wheel 928 May 13 20:47 include
drwxrwxr-x 20 root wheel 640 May 14 18:50 lib
drwxrwxr-x 5 root wheel 160 May 13 20:40 man
drwxr-xr-x 3 root wheel 96 May 14 18:28 pkg
drwxrwxr-x 5 root wheel 160 Oct 18 11:04 share
markwhite#marks-air arm64 %
So, I just move gfortran from where it is to where R wants it to be:
markwhite#marks-air gfortran % sudo mv /usr/local/bin/gfortran /opt/R/arm64/bin
Password:
markwhite#marks-air gfortran %
Then, I restart R and try again:
> install.packages("mvtnorm")
There is a binary version available but the source version is later:
binary source needs_compilation
mvtnorm 1.1-2 1.1-3 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘mvtnorm’
trying URL 'https://cran.rstudio.com/src/contrib/mvtnorm_1.1-3.tar.gz'
Content type 'application/x-gzip' length 166421 bytes (162 KB)
==================================================
downloaded 162 KB
* installing *source* package ‘mvtnorm’ ...
** package ‘mvtnorm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c miwa.c -o miwa.o
/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c mvt.f -o mvt.o
mvt.f:861:11:
861 | hs = sign( one, dh - r*dk )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
mvt.f:862:11:
862 | ks = sign( one, dk - r*dh )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
mvt.f:1155:16:
1155 | K = MOD( C(NP, MIN(NDIM-1,KLIM-1))*DBLE(K), DBLE(P(NP)) )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
mvt.f:1215:17:
1215 | JP = 1 + J*R(J)
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
mvt.f:94:39:
94 | DOUBLE PRECISION COV(NL*(NL+1)/2), A(NL), B(NL), DL(NL), Y(NL)
| 1
Warning: Array ‘cov’ at (1) is larger than limit set by ‘-fmax-stack-var-size=’, moved from stack to static storage. This makes the procedure unsafe when called recursively, or concurrently from multiple threads. Consider using ‘-frecursive’, or increase the ‘-fmax-stack-var-size=’ limit, or change the code to use an ALLOCATABLE array. [-Wsurprising]
mvt.f:86:33:
86 | SUBROUTINE MVSUBR( N, W, NF, F )
| 1
Warning: Unused dummy argument ‘nf’ at (1) [-Wunused-dummy-argument]
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c mvtnorm-init.c -o mvtnorm-init.o
/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c tvpack.f -o tvpack.o
tvpack.f:395:14:
395 | HS = SIGN( ONE, DH - R*DK )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
tvpack.f:396:14:
396 | KS = SIGN( ONE, DK - R*DH )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
tvpack.f:60:52:
60 | DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT, TVTL
| 1
Warning: Unused variable ‘hs’ declared at (1) [-Wunused-variable]
tvpack.f:60:45:
60 | DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT, TVTL
| 1
Warning: Unused variable ‘zros’ declared at (1) [-Wunused-variable]
tvpack.f:220:72:
220 | END
| ^
Warning: ‘fin’ may be used uninitialized in this function [-Wmaybe-uninitialized]
tvpack.f:196:58:
196 | DOUBLE PRECISION EI(NL), AI(NL), BI(NL), FI(NL), FIN, ERR, KRNRDT
| ^
note: ‘fin’ was declared here
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o mvtnorm.so C_FORTRAN_interface.o miwa.o mvt.o mvtnorm-init.o tvpack.o -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0'
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mvtnorm.so] Error 1
ERROR: compilation failed for package ‘mvtnorm’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/mvtnorm’
Warning in install.packages :
installation of package ‘mvtnorm’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/fx/f46lfqf56_df59fvzgqhcbyr0000gn/T/RtmpmlhiE8/downloaded_packages’
>
It looks like it is still getting confused with directory paths, or mv didn't actually move what it needed to move.
How can I point R to the correct directory or install gfortran in the correct directory?
I know this problem is a mess right now, I've looked at other threads, but can't quite get anything anyone suggests to work.
Here is what has worked for me on a Mac OS M1 system. R version 4.2.1 (modified from the solution here which will probably work for Intel Macs)
Install gcc which includes gfortran with brew install gcc
Create a file ~/.R/Makevars (if it does not exist yet). See for example here.
Add the following lines to ~/.R/Makevars
FC = /opt/homebrew/Cellar/gcc/11.3.0_2/bin/gfortran
F77 = /opt/homebrew/Cellar/gcc/11.3.0_2/bin/gfortran
FLIBS = -L/opt/homebrew/Cellar/gcc/11.3.0_2/lib/gcc/11
Note that you might have to change gcc version 11.3.0_2 to whatever your gcc version is.
I deleted everything gfortran related and started over.
I downloaded the .tar.xz file here using the browser, which dumped the file into my Downloads folder. I double-clicked it to unpack it.
I moved that directory to where R wanted it:
markwhite#marks-air ~ % sudo mv Downloads/gfortran /opt/R/arm64/
Then I restarted R and tried again. It threw me some Fortran compilation messages—which I will not pretend to comprehend here—but it successfully installed:
> install.packages("mvtnorm")
There is a binary version available but the source version is later:
binary source needs_compilation
mvtnorm 1.1-2 1.1-3 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘mvtnorm’
trying URL 'https://cran.rstudio.com/src/contrib/mvtnorm_1.1-3.tar.gz'
Content type 'application/x-gzip' length 166421 bytes (162 KB)
==================================================
downloaded 162 KB
* installing *source* package ‘mvtnorm’ ...
** package ‘mvtnorm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c miwa.c -o miwa.o
/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c mvt.f -o mvt.o
mvt.f:861:11:
861 | hs = sign( one, dh - r*dk )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
mvt.f:862:11:
862 | ks = sign( one, dk - r*dh )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
mvt.f:1155:16:
1155 | K = MOD( C(NP, MIN(NDIM-1,KLIM-1))*DBLE(K), DBLE(P(NP)) )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
mvt.f:1215:17:
1215 | JP = 1 + J*R(J)
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
mvt.f:94:39:
94 | DOUBLE PRECISION COV(NL*(NL+1)/2), A(NL), B(NL), DL(NL), Y(NL)
| 1
Warning: Array ‘cov’ at (1) is larger than limit set by ‘-fmax-stack-var-size=’, moved from stack to static storage. This makes the procedure unsafe when called recursively, or concurrently from multiple threads. Consider using ‘-frecursive’, or increase the ‘-fmax-stack-var-size=’ limit, or change the code to use an ALLOCATABLE array. [-Wsurprising]
mvt.f:86:33:
86 | SUBROUTINE MVSUBR( N, W, NF, F )
| 1
Warning: Unused dummy argument ‘nf’ at (1) [-Wunused-dummy-argument]
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c mvtnorm-init.c -o mvtnorm-init.o
/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c tvpack.f -o tvpack.o
tvpack.f:395:14:
395 | HS = SIGN( ONE, DH - R*DK )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
tvpack.f:396:14:
396 | KS = SIGN( ONE, DK - R*DH )
| 1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
tvpack.f:60:52:
60 | DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT, TVTL
| 1
Warning: Unused variable ‘hs’ declared at (1) [-Wunused-variable]
tvpack.f:60:45:
60 | DOUBLE PRECISION ONE, ZRO, EPS, ZROS(3), HS(3), TVT, TVTL
| 1
Warning: Unused variable ‘zros’ declared at (1) [-Wunused-variable]
tvpack.f:220:72:
220 | END
| ^
Warning: ‘fin’ may be used uninitialized in this function [-Wmaybe-uninitialized]
tvpack.f:196:58:
196 | DOUBLE PRECISION EI(NL), AI(NL), BI(NL), FI(NL), FIN, ERR, KRNRDT
| ^
note: ‘fin’ was declared here
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o mvtnorm.so C_FORTRAN_interface.o miwa.o mvt.o mvtnorm-init.o tvpack.o -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: could not create compact unwind for _mvkrsv_: register 75 saved somewhere other than in frame
ld: warning: could not create compact unwind for _mvkbrv_: stack size is too large for frameless function
ld: warning: could not create compact unwind for _mvstdt_: register 75 saved somewhere other than in frame
ld: warning: could not create compact unwind for _mvbvtl_: registers 78 and 79 not saved contiguously in frame
ld: warning: could not create compact unwind for _pntgnd_: registers 72 and 73 not saved contiguously in frame
ld: warning: could not create compact unwind for _mvbvu_: registers 72 and 73 not saved contiguously in frame
ld: warning: could not create compact unwind for _tvtmfn_: register 73 saved somewhere other than in frame
ld: warning: could not create compact unwind for _krnrdt_: registers 74 and 75 not saved contiguously in frame
ld: warning: could not create compact unwind for _mvbvn_: registers 21 and 22 not saved contiguously in frame
ld: warning: could not create compact unwind for _bvnd_: registers 78 and 79 not saved contiguously in frame
ld: warning: could not create compact unwind for _bvtl_: registers 78 and 79 not saved contiguously in frame
ld: warning: could not create compact unwind for _tvtlrcall_: registers 72 and 73 not saved contiguously in frame
ld: warning: could not create compact unwind for _mvbvt_: registers 21 and 22 not saved contiguously in frame
ld: warning: could not create compact unwind for _mvspcl_: register 73 saved somewhere other than in frame
ld: warning: could not create compact unwind for _mvsort_: register 77 saved somewhere other than in frame
ld: warning: could not create compact unwind for _mvvlsb_: registers 27 and 28 not saved contiguously in frame
ld: warning: could not create compact unwind for _mvtdst_: registers 23 and 24 not saved contiguously in frame
ld: warning: could not create compact unwind for _mvbvtc_: register 73 saved somewhere other than in frame
installing to /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/00LOCK-mvtnorm/00new/mvtnorm/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (mvtnorm)
The downloaded source packages are in
‘/private/var/folders/fx/f46lfqf56_df59fvzgqhcbyr0000gn/T/RtmptXzvKK/downloaded_packages’
I have met the similar problem when installing other packages but I tried to do the following choice and it allowed me to go on:
Update all/some/none? [a/s/n]:
n
Have you tried to answer "no" to the question:
Do you want to install from sources the package which needs compilation? (Yes/no/cancel)
?
Except if you really need the latest version of the package you are trying to download, it seems to be working without having to install gfortran in the specified folder like you did.
I came across a similar problem when trying to install a package from source. My solution was
Install the Homebrew version of gcc (this includes gfortran)
brew install gcc
Tell R where it should look for gfortran
This information is stored in the file "Makeconf" which in my case can be found here:
/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/etc/Makeconf
In "Makeconf" change the line
FLIBS = -L/Volumes/Builds/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/Volumes/Builds/opt/R/arm64/gfortran/lib/gcc -L/Volumes/Builds/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm
to
FLIBS = -L/opt/homebrew/Cellar/gcc/11.3.0/lib/gcc/11/gcc/aarch64-apple-darwin21/11 -L/opt/homebrew/Cellar/gcc/11.3.0/lib/gcc/11 -lgfortran -lquadmath -lm
You may need to adapt the path according to the gcc version installed on your system.
Restart R
I followed the instruction in this tutorial, and it worked:
https://www.cynkra.com/blog/2021-03-16-gfortran-macos/
I created a file ~/.R/Makevars
and following the tutorial, type the following lines (using my own gfortran directory):
FC = /usr/local/bin/gfortran
F77 = /usr/local/bin/gfortran
FLIBS = -L/usr/local/bin/gfortran/lib
I installed PostgreSQL 9.6 with PostGIS 2.3 using one click installer of Enterprise DB available here on my CentOS 7 (x64) Linux based machine. Now I am trying to connect R Studio to Postgres. To do so, I tried to install RPostgreSQL package in R Studio but I am getting following error:
> install.packages("RPostgreSQL")
Installing package into ‘/home/jk/R/x86_64-redhat-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RPostgreSQL_0.4-1.tar.gz'
Content type 'unknown' length 476204 bytes (465 KB)
==================================================
downloaded 465 KB
* installing *source* package ‘RPostgreSQL’ ...
** package ‘RPostgreSQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for pg_config... no
configure: checking for PostgreSQL header files
configure: Checking include /usr/include.
configure: Checking include /usr/include/pgsql.
configure: Checking include /usr/include/postgresql.
configure: Checking include /usr/local/include.
configure: Checking include /usr/local/include/pgsql.
configure: Checking include /usr/local/include/postgresql.
configure: Checking include /usr/local/pgsql/include.
configure: Checking include /usr/local/postgresql/include.
configure: Checking include /opt/include.
configure: Checking include /opt/include/pgsql.
configure: Checking include /opt/include/postgresql.
configure: Checking include /opt/local/include.
configure: Checking include /opt/local/include/postgresql.
configure: Checking include /opt/local/include/postgresql84.
configure: Checking include /sw/opt/postgresql-8.4/include.
configure: Checking include /Library/PostgresPlus/8.4SS/include.
configure: Checking include /sw/include/postgresql.
configure: Checking lib /usr/lib.
configure: Checking lib /usr/lib/pgsql.
configure: Checking lib /usr/lib/postgresql.
configure: Checking lib /usr/local/lib.
configure: Checking lib /usr/local/lib/pgsql.
configure: Checking lib /usr/local/lib/postgresql.
configure: Checking lib /usr/local/pgsql/lib.
configure: Checking lib /usr/local/postgresql/lib.
configure: Checking lib /opt/lib.
configure: Checking lib /opt/lib/pgsql.
configure: Checking lib /opt/lib/postgresql.
configure: Checking lib /opt/local/lib.
configure: Checking lib /opt/local/lib/postgresql.
configure: Checking lib /opt/local/lib/postgresql84.
configure: Checking lib /sw/opt/postgresql-8.4/lib.
configure: Checking lib /Library/PostgresPlus/8.4SS/lib.
configure: Checking lib /sw/lib.
checking for "/libpq-fe.h"... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-DBI.c -o RS-DBI.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-PQescape.c -o RS-PQescape.o
In file included from RS-PQescape.c:7:0:
RS-PostgreSQL.h:23:26: fatal error: libpq-fe.h: No such file or directory
# include "libpq-fe.h"
^
compilation terminated.
make: *** [RS-PQescape.o] Error 1
ERROR: compilation failed for package ‘RPostgreSQL’
* removing ‘/home/jk/R/x86_64-redhat-linux-gnu-library/3.3/RPostgreSQL’
Warning in install.packages :
installation of package ‘RPostgreSQL’ had non-zero exit status
The installation directory of PostgreSQL 9.6 is /opt/PostgreSQL/9.6/bin which doesn't seem to be in the error above. Could someone help me to resolve this error?
EDIT 1:
Thanks to the suggestion of #lavajumper, I got rid of above error. But now getting this error which shows some missing html links.
> install.packages("RPostgreSQL")
Installing package into ‘/home/jk/R/x86_64-redhat-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RPostgreSQL_0.4-1.tar.gz'
Content type 'unknown' length 476204 bytes (465 KB)
==================================================
downloaded 465 KB
* installing *source* package ‘RPostgreSQL’ ...
** package ‘RPostgreSQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for pg_config... no
configure: checking for PostgreSQL header files
configure: Checking include /usr/include.
configure: Checking lib /usr/lib.
configure: Checking lib /usr/lib/pgsql.
configure: Checking lib /usr/lib/postgresql.
configure: Checking lib /usr/local/lib.
configure: Checking lib /usr/local/lib/pgsql.
configure: Checking lib /usr/local/lib/postgresql.
configure: Checking lib /usr/local/pgsql/lib.
configure: Checking lib /usr/local/postgresql/lib.
configure: Checking lib /opt/lib.
configure: Checking lib /opt/lib/pgsql.
configure: Checking lib /opt/lib/postgresql.
configure: Checking lib /opt/local/lib.
configure: Checking lib /opt/local/lib/postgresql.
configure: Checking lib /opt/local/lib/postgresql84.
configure: Checking lib /sw/opt/postgresql-8.4/lib.
configure: Checking lib /Library/PostgresPlus/8.4SS/lib.
configure: Checking lib /sw/lib.
checking for "/usr/include/libpq-fe.h"... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-DBI.c -o RS-DBI.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-PQescape.c -o RS-PQescape.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-PostgreSQL.c -o RS-PostgreSQL.o
RS-PostgreSQL.c: In function ‘RS_PostgreSQL_createDataMappings’:
RS-PostgreSQL.c:446:5: warning: passing argument 1 of ‘Rf_protect’ from incompatible pointer type [enabled by default]
PROTECT(flds = RS_DBI_allocFields(num_fields));
^
In file included from /usr/include/R/Rdefines.h:36:0,
from S4R.h:64,
from RS-DBI.h:29,
from RS-PostgreSQL.h:25,
from RS-PostgreSQL.c:17:
/usr/include/R/Rinternals.h:1348:6: note: expected ‘SEXP’ but
argument is of type ‘struct RS_DBI_fields *’
SEXP Rf_protect(SEXP);
^
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-pgsql-copy.c -o RS-pgsql-copy.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-pgsql-getResult.c -o RS-pgsql-getResult.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-pgsql-pqexec.c -o RS-pgsql-pqexec.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-pgsql-pqexecparams.c -o RS-pgsql-pqexecparams.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o RPostgreSQL.so RS-DBI.o RS-PQescape.o RS-PostgreSQL.o RS-pgsql-copy.o RS-pgsql-getResult.o RS-pgsql-pqexec.o RS-pgsql-pqexecparams.o -L -lpq -L/usr/lib64/R/lib -lR
installing to /home/jk/R/x86_64-redhat-linux-gnu-library/3.3/RPostgreSQL/libs
** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘format’ from package ‘base’ in package ‘RPostgreSQL’
Creating a generic function for ‘print’ from package ‘base’ in package ‘RPostgreSQL’
Creating a generic function for ‘summary’ from package ‘base’ in package ‘RPostgreSQL’
** help
*** installing help indices
converting help for package ‘RPostgreSQL’
finding HTML links ... done
PostgreSQL html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL /man/PostgreSQL.Rd:26: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQL.Rd:76: missing file link ‘dbUnloadDriver’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQL.Rd:84: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQL.Rd:89: missing file link ‘dbCommit’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQL.Rd:90: missing file link ‘dbRollback’
PostgreSQLConnection-class html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLConnection-class.Rd:20: missing file link ‘dbCommit’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLConnection-class.Rd:32: missing file link ‘dbRollback’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLConnection-class.Rd:34: missing file link ‘dbWriteTable’
PostgreSQLDriver-class html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLDriver-class.Rd:25: missing file link ‘dbUnloadDriver’
PostgreSQLObject-class html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLObject-class.Rd:20: missing file link ‘isSQLKeyword’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLObject-class.Rd:22: missing file link ‘SQLKeywords’
PostgreSQLResult-class html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLResult-class.Rd:31: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLResult-class.Rd:32: missing file link ‘fetch’
S4R html
dbApply-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbApply-methods.Rd:27: missing file link ‘fetch’
dbApply html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbApply.Rd:37: missing file link ‘fetch’
dbCallProc-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbCallProc-methods.Rd:31: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbCallProc-methods.Rd:32: missing file link ‘dbCommit’
dbCommit-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbCommit-methods.Rd:36: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbCommit-methods.Rd:37: missing file link ‘dbCommit’
dbConnect-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbConnect-methods.Rd:58: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbConnect-methods.Rd:59: missing file link ‘dbCommit’
dbDataType-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbDataType-methods.Rd:33: missing file link ‘isSQLKeyword’
dbDriver-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbDriver-methods.Rd:26: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbDriver-methods.Rd:44: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbDriver-methods.Rd:45: missing file link ‘dbCommit’
dbGetInfo-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbGetInfo-methods.Rd:47: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbGetInfo-methods.Rd:48: missing file link ‘dbCommit’
dbListTables-methods html
dbObjectId-class html
dbReadTable-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbReadTable-methods.Rd:119: missing file link ‘isSQLKeyword’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbReadTable-methods.Rd:124: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbReadTable-methods.Rd:125: missing file link ‘dbCommit’
dbSendQuery-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbSendQuery-methods.Rd:40: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbSendQuery-methods.Rd:41: missing file link ‘dbCommit’
dbSetDataMappings-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbSetDataMappings-methods.Rd:33: missing file link ‘fetch’
fetch-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/fetch-methods.Rd:46: missing file link ‘dbCommit’
isPostgresqlIdCurrent html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/isPostgresqlIdCurrent.Rd:34: missing file link ‘fetch’
make.db.names-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/make.db.names-methods.Rd:69: missing file link ‘dbWriteTable’
postgresqlBuildTableDefinition html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/postgresqlBuildTableDefinition.Rd:41: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/postgresqlBuildTableDefinition.Rd:42: missing file link ‘dbCommit’
postgresqlDBApply html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/postgresqlDBApply.Rd:75: missing file link ‘fetch’
postgresqlSupport html
summary-methods html
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/jk/R/x86_64-redhat-linux-gnu-library /3.3/RPostgreSQL/libs/RPostgreSQL.so':
/home/jk/R/x86_64-redhat-linux-gnu-library/3.3/RPostgreSQL/libs/RPostgreSQL.so: undefined symbol: PQfmod
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/jk/R/x86_64-redhat-linux-gnu-library/3.3/RPostgreSQL’
Warning in install.packages :
installation of package ‘RPostgreSQL’ had non-zero exit status
Okay, I figured out the problem by myself. Answer given by #Manoj at this link helped me to resolve the second error. According to the mentioned link, RPostgreSQL checks for libraries in these directories only:
/usr/lib
/usr/lib/pgsql
/usr/lib/postgresql
/usr/local/lib
/usr/local/lib/pgsql
/usr/local/lib/postgresql
/usr/local/pgsql/lib
/usr/local/postgresql/lib
/opt/lib
/opt/lib/pgsql
/opt/lib/postgresql
/opt/local/lib
/opt/local/lib/postgresql
/opt/local/lib/postgresql84
/sw/opt/postgresql-8.4/lib
/Library/PostgresPlus/8.4SS/lib
/sw/lib
So as a superuser I copied library files from Postgres installation directory to /usr/lib and run the command again like this in R Studio:
install.packages('RPostgreSQL', dependencies=TRUE, repos='http://cran.rstudio.com/')
and it worked! :)
I had a similar issue (but with RPostgres, you may consider switching to that package) building a container through docker for API use : RPostgres was installed but the library couldn't load libpq.so.5, "unable to load shared object '/usr/local/lib/R/site-library/RPostgres/libs/RPostgres.so':\n libpq.so.5: cannot open shared object file: No such file or directory". Since I had already installed Postgres on my machine, I figure the problem was worked around therefore I had no such message on local ; but here's how I solved this in my dockerfile (thanks to this post), 100% verified on a machine with nothing related to R installed (Centos, server) :
RUN apt-get update && apt-get install libpq5 -y before installing any package.
So executing apt-get update && apt-get install libpq5 -y on your terminal should do the trick. Light and efficient.
This error also happens on Mac sometimes, and on that platform, one option is to NOT install this from source and instead pull a binary.
You can do this via specifying a type in the install.packages command.
install.packages("RPostgreSQL", type="mac.binary")
here you can find a list of other type vals
Possible values of type are (currently) "source", "mac.binary", "mac.binary.el-capitan" and "win.binary": the appropriate binary type where supported can also be selected as "binary".
I tried to install rgdal with configure.args but no luck.
Installed gdal version:
gdal-config --version
1.11.2
ogrinfo --version
GDAL 1.11.2, released 2015/02/10
found gdal binary tools:
ls /usr/bin | grep gdal
gdal2tiles.py
gdal2xyz.py
gdaladdo
gdal_auth.py
gdalbuildvrt
gdal_calc.py
gdalchksum.py
gdalcompare.py
gdal-config
gdal_contour
gdaldem
gdal_edit.py
gdalenhance
gdal_fillnodata.py
gdal_grid
gdalident.py
gdalimport.py
gdalinfo
gdallocationinfo
gdalmanage
gdal_merge.py
gdalmove.py
gdal_polygonize.py
gdal_proximity.py
gdal_rasterize
gdal_retile.py
gdalserver
gdal_sieve.py
gdalsrsinfo
gdaltindex
gdaltransform
gdal_translate
gdalwarp
found proj header files:
ls /usr/include | grep proj
libprojectM
libprojectM-qt
org_proj4_Projections.h
proj_api.h
projects.h
found proj lib files:
ls /usr/lib | grep proj
libproj.a
libprojectM-qt.so
libprojectM-qt.so.1
libprojectM-qt.so.1.10
libprojectM.so
libprojectM.so.2
libprojectM.so.2.1.0
libproj.la
libproj.so
libproj.so.0
libproj.so.0.7.0
installed packages about gdal:
dpkg -l | grep gdal
ii gdal-bin 1.11.2+dfsg-1~exp2~trusty amd64 Geospatial Data Abstraction Library - Utility programs
ii libgdal-dev 1.11.2+dfsg-1~exp2~trusty amd64 Geospatial Data Abstraction Library - Development files
ii libgdal1-dev 1.11.2+dfsg-1~exp2~trusty all Geospatial Data Abstraction Library - Transitional package
ii libgdal1h 1.11.2+dfsg-1~exp2~trusty amd64 Geospatial Data Abstraction Library
ii python-gdal 1.11.2+dfsg-1~exp2~trusty amd64 Python bindings to the Geospatial Data Abstraction Library
dpkg -l | grep proj
ii libgeo-proj4-perl 1.05-1 amd64 PROJ.4 library for cartographic projections
ii libproj-dev 4.8.0-2ubuntu2 amd64 Cartographic projection library (development files)
ii libproj0 4.8.0-2ubuntu2 amd64 Cartographic projection library
ii libprojectm-dev 2.1.0+dfsg-1build2 amd64 Advanced Milkdrop-compatible music visualization library - dev
ii libprojectm-qt-dev 2.1.0+dfsg-1build2 amd64 projectM Qt4 (development files)
ii libprojectm-qt1 2.1.0+dfsg-1build2 amd64 projectM Qt4 bindings
ii libprojectm2 2.1.0+dfsg-1build2 amd64 Advanced Milkdrop-compatible music visualization library
ii proj-bin 4.8.0-2ubuntu2 amd64 Cartographic projection library (tools)
ii proj-data 4.8.0-2ubuntu2 amd64 Cartographic projection filter and library (datum package)
ii projectm-data 2.1.0+dfsg-1build2 all Advanced Milkdrop-compatible music visualization library - data
ii xfwm4 4.11.1-2ubuntu2 amd64 window manager of the Xfce project
install.packages('rgdal',type='source',
configure.args = paste('--with-gdal-config=/usr/bin/gdal-config',
'--with-proj-lib=/usr/lib',
'--with-proj-include=/usr/include') )
Installing package into ‘/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'http://mirrors.ustc.edu.cn/CRAN/src/contrib/rgdal_0.9-2.tar.gz'
Content type 'application/gzip' length 1627386 bytes (1.6 MB)
==================================================
downloaded 1.6 MB
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgdal: 0.9-2
checking for /usr/bin/svnversion... no
configure: svn revision: 526
configure: gdal-config set to /usr/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... yes
configure: GDAL: 1.11.2
checking GDAL version >= 1.6.3... yes
checking GDAL version < 2... yes
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/share/gdal/1.11/pcs.csv readable... yes
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
checking for pj_init_plus in -lproj... yes
configure: PROJ.4 version: > 4.8.0
/tmp/ccsGVxP9.o: In function `main':
/tmp/RtmpOqwz92/R.INSTALL23317ae38fc4/rgdal/proj_conf_test.c:20: undefined reference to `pj_ctx_fclose'
collect2: error: ld returned 1 exit status
./configure: line 3735: ./proj_conf_test: No such file or directory
checking PROJ.4: epsg found and readable... yes
/tmp/ccaNfCUo.o: In function `main':
/tmp/RtmpOqwz92/R.INSTALL23317ae38fc4/rgdal/proj_conf_test.c:20: undefined reference to `pj_ctx_fclose'
collect2: error: ld returned 1 exit status
./configure: line 3810: ./proj_conf_test: No such file or directory
checking PROJ.4: conus found and readable... yes
configure: Package CPP flags: -I/usr/include/gdal -I/usr/include
configure: Package LIBS: -L/usr/lib -lgdal -L/usr/lib -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c OGR_write.cpp -o OGR_write.o
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c gdal-bindings.cpp -o gdal-bindings.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c local_stubs.c -o local_stubs.o
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogr_geom.cpp -o ogr_geom.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogr_polygons.c -o ogr_polygons.o
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogr_proj.cpp -o ogr_proj.o
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogrdrivers.cpp -o ogrdrivers.o
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogrsource.cpp -o ogrsource.o
g++ -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I/usr/include -I"/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/sp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c projectit.cpp -o projectit.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o rgdal.so OGR_write.o gdal-bindings.o init.o local_stubs.o ogr_geom.o ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o -L/usr/lib -lgdal -L/usr/lib -lproj -L/usr/lib/R/lib -lR
installing to /home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs
** R
** data
** 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/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs/rgdal.so':
/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs/rgdal.so: undefined symbol: pj_ctx_fgets
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal’
Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status
EDIT:
I have tried install.packages('rgdal') without any configure.args. I got the same error.
Now, I am tring to install rgdal with a compiled proj4 4.9.1 and export LD_LIBRARY_PATH to proj4 4.9.1. Unfortunately, it failed again.
Here is my new script.sh:
export LD_LIBRARY_PATH=/home/wangchl/R-scripting/R-install/proj-4.9.1/ccc/lib:/usr/lib:$LD_LIBRARY_PATH
sudo R CMD REMOVE rgdal
R CMD INSTALL rgdal_0.9-2.tar.gz --byte-compile --configure-args='--with-gdal-config=/usr/bin/gdal-config --with-proj-lib=/home/wangchl/R-scripting/R-install/proj-4.9.1/ccc/lib --with-proj-include=/home/wangchl/R-scripting/R-install/proj-4.9.1/ccc/include --with-proj-share=/home/wangchl/R-scripting/R-install/proj-4.9.1/ccc/share/proj'
Everything is fine but failed when testing:
installing to /home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs
** R
** data
** inst
** byte-compile and prepare 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/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs/rgdal.so':
/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal/libs/rgdal.so: undefined symbol: pj_ctx_fgets
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/wangchl/R/x86_64-pc-linux-gnu-library/3.2/rgdal’
Update:
Finally, I sovled this issue . Firstly, removing proj4-4.8 by apt-get.
sudo apt-get remove libproj-dev
Secondly, adding my compiled proj4-4.9 lib path into a new conf file (such as rgdal.conf) under the path of '/etc/ld.so.conf.d/'.
cd /etc/ld.so.conf.d
sudo touch rgdal.conf
echo 'the lib path of proj4-4.9' | sudo tee -a rgdal.conf
And then, installing rgdal with configure.args referencing the compiled lib path of proj4-4.9.
export LD_LIBRARY_PATH=the lib path of proj4-4.9:$LD_LIBRARY_PATH
sudo R CMD REMOVE rgdal
R CMD INSTALL rgdal_0.9-2.tar.gz --byte-compile --configure-args='--with-gdal-config=/usr/bin/gdal-config --with-proj-lib=compiled path of proj4-4.9/lib --with-proj-include=compiled path of proj4-4.9/include --with-proj-share=compiled path of proj4-4.9/share/proj'
Right now, everything is fine. But I am failed to install any version of rgdal with proj4-4.8 and default configure.args. I have already cleaned files of proj4 following the suggestion of #Pascal . So I am not sure the exact reason about this issue.
Do you have libgdal-dev and libproj-dev installed?
In terminal:
sudo apt-get update && sudo apt-get install libgdal-dev libproj-dev
Then in R try and install rgdal again.
Finally, I sovled this issue . Firstly, removing proj4-4.8 by apt-get.
sudo apt-get remove libproj-dev
Secondly, adding my compiled proj4-4.9 lib path into a new conf file (such as rgdal.conf) under the path of '/etc/ld.so.conf.d/'.
cd /etc/ld.so.conf.d
sudo touch rgdal.conf
echo 'the lib path of proj4-4.9' | sudo tee -a rgdal.conf
And then, installing rgdal with configure.args referencing the compiled lib path of proj4-4.9.
export LD_LIBRARY_PATH=the lib path of proj4-4.9:$LD_LIBRARY_PATH
sudo R CMD REMOVE rgdal
R CMD INSTALL rgdal_0.9-2.tar.gz --byte-compile --configure-args='--with-gdal-config=/usr/bin/gdal-config --with-proj-lib=compiled path of proj4-4.9/lib --with-proj-include=compiled path of proj4-4.9/include --with-proj-share=compiled path of proj4-4.9/share/proj'
Right now, everything is fine. But I am failed to install any version of rgdal with proj4-4.8 and default configure.args. I have already cleaned files of proj4 following the suggestion of #Pascal . So I am not sure the exact reason about this issue.