Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation from source fails on linux R/3.2.1. #47

Closed
andreadega opened this issue Jul 16, 2018 · 14 comments
Closed

Installation from source fails on linux R/3.2.1. #47

andreadega opened this issue Jul 16, 2018 · 14 comments
Labels
Milestone

Comments

@andreadega
Copy link

@andreadega andreadega commented Jul 16, 2018

This is what I obtain if try to install fansi:

* installing *source* package ‘fansi’ ...
** package ‘fansi’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/local/Cluster-Apps/R/3.2.1/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -O3 -mtune=native  -c assumptions.c -o assumptions.o
gcc -std=gnu99 -I/usr/local/Cluster-Apps/R/3.2.1/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -O3 -mtune=native  -c has.c -o has.o
gcc -std=gnu99 -I/usr/local/Cluster-Apps/R/3.2.1/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -O3 -mtune=native  -c init.c -o init.o
gcc -std=gnu99 -I/usr/local/Cluster-Apps/R/3.2.1/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -O3 -mtune=native  -c nchar.c -o nchar.o
gcc -std=gnu99 -I/usr/local/Cluster-Apps/R/3.2.1/lib64/R/include -DNDEBUG  -I/usr/local/include    -fpic  -O3 -mtune=native  -c read.c -o read.o
read.c: In function ‘read_utf8’:
read.c:547:7: warning: implicit declaration of function ‘R_nchar’ [-Wimplicit-function-declaration]
       disp_size = R_nchar(
       ^
read.c:548:18: error: ‘Width’ undeclared (first use in this function)
         str_chr, Width, state.allowNA, state.keepNA, mb_err_str
                  ^
read.c:548:18: note: each undeclared identifier is reported only once for each function it appears in
make: *** [read.o] Error 1
ERROR: compilation failed for package ‘fansi’
* removing ‘/home/ad923/R/x86_64-unknown-linux-gnu-library/3.2/fansi’

The downloaded source packages are in
	‘/tmp/RtmpZm4VeX/downloaded_packages’
Warning message:
In install.packages("fansi") :
  installation of package ‘fansi’ had non-zero exit status

In particular, note the read.c:548:18: error: ‘Width’ undeclared.

Best Wishes,
Andrea

@gfairchild
Copy link

@gfairchild gfairchild commented Jul 16, 2018

I'm getting the same error on macOS 10.13.6.

@brodieG
Copy link
Owner

@brodieG brodieG commented Jul 16, 2018

Thanks for reporting. I will investigate over the next week. R_nchar changed around 3.2, so it is possible that the version in 3.2.1 in particular is not what I was expecting it to be, hence the error.

Any reason though why you are not using 3.2.5 instead of 3.2.1? All the testing platforms are going to test the lastest 3.x.y versions for any given x, so I'm not surprised something like this snuck through.

The answer to this might end up being "only the most recent 'y' version of z.x.y" is supported, but I will review and confirm one way or the other.

@gfairchild
Copy link

@gfairchild gfairchild commented Jul 16, 2018

Any reason though why you are not using 3.2.5 instead of 3.2.1? All the testing platforms are going to test the lastest 3.x.y versions for any given x, so I'm not surprised something like this snuck through.

I can't speak for @andreadega, but in my case, I'm installing tidyverse, which in turn eventually needs fansi at some point:

> install.packages("tidyverse")
also installing the dependenciesfansi’, ‘tidyselect’, ‘pillar’, ‘broom’, ‘dplyr’, ‘dbplyr’, ‘forcats’, ‘ggplot2’, ‘haven’, ‘modelr’, ‘purrr’, ‘readxl’, ‘tibble’, ‘tidyr’, ‘xml2There are binary versions available but the source versions are later:
           binary source needs_compilation
tidyselect  0.2.3  0.2.4              TRUE
broom       0.4.3  0.4.5             FALSE
dplyr       0.7.4  0.7.6              TRUE
dbplyr      1.1.0  1.2.1             FALSE
forcats     0.2.0  0.3.0             FALSE
ggplot2     2.2.1  3.0.0             FALSE
haven       1.1.0  1.1.2              TRUE
modelr      0.1.1  0.1.2             FALSE
purrr       0.2.4  0.2.5              TRUE
readxl      1.0.0  1.1.0              TRUE
tibble      1.3.4  1.4.2              TRUE
tidyr       0.7.2  0.8.1              TRUE
xml2        1.1.1  1.2.0              TRUE
tidyverse   1.1.1  1.2.1             FALSE

Do you want to install from sources the packages which need compilation?
y/n: y
Package which is only available in source form, and may need compilation of C/C++/Fortran:fansiDo you want to attempt to install these from sources?
y/n: y

So that's how I'm personally installing it. Here's what happens if I try to install fansi on its own:

> install.packages("fansi")
Package which is only available in source form, and may need compilation of C/C++/Fortran:fansiDo you want to attempt to install these from sources?
y/n: y
installing the source packagefansi’

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  179k  100     0  179k    0     0   421k      0 --:--:-- --:--::-- --:--:-- --:--:--  422k
* installing *source* packagefansi...
** packagefansisuccessfully unpacked and MD5 sums checked
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c assumptions.c -o assumptions.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c has.c -o has.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c init.c -o init.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c nchar.c -o nchar.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c read.c -o read.o
read.c:547:19: warning: implicit declaration of function 'R_nchar' is invalid in C99 [-Wimplicit-function-declaration]
      disp_size = R_nchar(
                  ^
read.c:548:18: error: use of undeclared identifier 'Width'
        str_chr, Width, state.allowNA, state.keepNA, mb_err_str
                 ^
1 warning and 1 error generated.
make: *** [read.o] Error 1
ERROR: compilation failed for packagefansi* removing/Library/Frameworks/R.framework/Versions/3.2/Resources/library/fansiWarning in install.packages :
  installation of packagefansihad non-zero exit status

The downloaded source packages are in/private/var/folders/nq/kmqwxhns4lzdv64kp1lcts9r0000gp/T/RtmpLfK0vo/downloaded_packages
@andreadega
Copy link
Author

@andreadega andreadega commented Jul 16, 2018

Thanks for the quick reply. I am currently constrained to use R/3.2.1 as it is the most recent version I was able to load and run on my local HPC infrastructure.
For me the error came once I tried to update the R package NMF, which seems that down a maze of dependencies now requires fansi, which fails to compile. I traced this issue to the R package pillar, which was recently updated (2018-07-14), and now requires fansi. I got around this issue for now by installing an older version of pillar (pillar_1.2.3.tar.gz), which does not seem require fansi. At the same time, I thought it better to report that I was not able to install fansi.

@brodieG
Copy link
Owner

@brodieG brodieG commented Jul 16, 2018

Okay, so it looks like R3.2.1 is the one version of R (not fansi, R) for which this package won't build because the C function R_nchar was not made available until R3.2.2. I have workaround code to support R3.1.x that I should be able to relatively easily extend to support R3.2.1, with the caveats that it will be a little while before the new version is up on CRAN, and additionally the functionality of fansi under R < 3.2.2 even when working is slightly degraded (see the notes in re R 3.1.0 in ?fansi::fansi).

@brodieG
Copy link
Owner

@brodieG brodieG commented Jul 16, 2018

@gfairchild note that if you can update to a version of R that is either greater than R3.2.1 (e.g. R3.2.5), or downgrade to R3.1.0, this should work.

@brodieG brodieG added the bug label Jul 16, 2018
@brodieG brodieG added this to the 0.2.4 milestone Jul 16, 2018
@brodieG
Copy link
Owner

@brodieG brodieG commented Jul 16, 2018

@krlmlr, fyi in case others complain of this issue on pillar.

@gfairchild
Copy link

@gfairchild gfairchild commented Jul 16, 2018

Upgrading R worked! I'm now on 3.5.1, and everything just installed no problem. Thanks for the suggestion. I'm an R novice and thought that R Studio automatically included the latest R. I didn't realize I had to upgrade R separately.

@krlmlr
Copy link

@krlmlr krlmlr commented Jul 21, 2018

Thanks for tracking down this weird problem. When do you plan to push an update to CRAN?

@brodieG
Copy link
Owner

@brodieG brodieG commented Jul 21, 2018

@krlmr Next week or so.

@brodieG
Copy link
Owner

@brodieG brodieG commented Jul 29, 2018

This is fixed in the "development" branch. Probably still a week away from CRAN.

@andreadega
Copy link
Author

@andreadega andreadega commented Jul 31, 2018

Thank you very much!

@brodieG brodieG closed this in 10b3a65 Aug 13, 2018
@edmarmunhoz
Copy link

@edmarmunhoz edmarmunhoz commented Jan 19, 2019

I am using the RStudio Version 1.1.463 and R Version 1.1.463

> install.packages("/tmp/Rtmph1WQtZ/downloaded_packages/fansi_0.4.0.tar.gz", repos = NULL, type = "source")
Installing package into ‘/home/edmar/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
* installing *source* package ‘fansi’ ...
** package ‘fansi’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c assumptions.c -o assumptions.o
In file included from assumptions.c:20:0:
/usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h:9:16: fatal error: stdint.h: No such file or directory
 # include_next <stdint.h>
                ^~~~~~~~~~
compilation terminated.
/usr/lib/R/etc/Makeconf:159: recipe for target 'assumptions.o' failed
make: *** [assumptions.o] Error 1
ERROR: compilation failed for package ‘fansi’
* removing ‘/home/edmar/R/x86_64-pc-linux-gnu-library/3.4/fansi’
Warning in install.packages :
  installation of package ‘/tmp/Rtmph1WQtZ/downloaded_packages/fansi_0.4.0.tar.gz’ had non-zero exit status
@brodieG
Copy link
Owner

@brodieG brodieG commented Jan 19, 2019

I'm not super familiar with compilation errors, but it looks like your system can't find stdint.h, which is a standard C library. Your compilation toolchain may be incomplete or not properly configured. If you have reason to think this is an actual error specific to this package, feel free to explain why.

I just compiled it in linux from source and it was fine.

Aside: why don't you just use install.packages('fansi')? Version 0.4.0 is on CRAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.