Bug 239169

Summary: math/R package needs readline (rl_sort_completion_matches)
Product: Ports & Packages Reporter: Nicola Mingotti <nmingotti>
Component: Individual Port(s)Assignee: Joseph Mingrone <jrm>
Status: Closed Not A Bug    
Severity: Affects Some People CC: pkg, rhurlin, xenomorph
Priority: --- Flags: bugzilla: maintainer-feedback? (jrm)
Version: Latest   
Hardware: Any   
OS: Any   

Description Nicola Mingotti 2019-07-12 16:56:23 UTC
Hi,

I just installed R from package in FreeBSD-12. It does not work out of the box, giving the error :

---------------------------
ld-elf.so.1: /usr/local/lib/R/lib/libR.so.3.6: Undefined symbol "rl_sort_completion_matches"
---------------------------

It all works as expected if is install readline:
$> sudo pkg install readline 

bye
Nicola
Comment 1 Joseph Mingrone freebsd_committer freebsd_triage 2019-07-13 18:45:47 UTC
Hi Nicola,

This is strange.  The R package should depend on devel/readline.  To confirm this, I just started a clean jail and built the package.

# pkg info -d R | grep readline
        readline-8.0.0

# pkg info -r readline | grep R
readline-8.0.0:
        R-3.6.0_1

Next, I removed all packages from the jail, set pkg to use the default repository and installed the default R package.  I see the same as above, that is, R depends on readline.

Could you provide more hints as to why your installation of R did not depend on readline?

Regards,

Joseph
Comment 2 Nicola Mingotti 2019-07-15 10:44:59 UTC
(In reply to Joseph Mingrone from comment #1)

Hi Joseph,

Luckily i was able to reproduce the exact same behaviour in another system I have. 

My first test was on:
$> uname -a
FreeBSD fbs-slacmac 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  amd64

My second test is in:
$> uname -a
FreeBSD nise1 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  amd64

All commands from here are in machine nise1.

#> pkg info | grep readline
readline-7.0.5                 

#> pkg install R

#> R 
ld-elf.so.1: /usr/local/lib/R/lib/libR.so.3.6: Undefined symbol "rl_sort_completion_matches"

#>  pkg info | grep readline
readline-7.0.5                 

#>  pkg install readline
# this updates the readline 

#> R 
==> Now works

#>  pkg info | grep readline
readline-8.0.0                 

In conclusion, if there is readline-7.X already installed in the system, the new one will not be installed with R, and R will not work with the old one.

bye
Nicola
Comment 3 Joseph Mingrone freebsd_committer freebsd_triage 2019-07-15 20:39:56 UTC
Thanks for clarifying.

1. Are you using the official packages?

2. Based on your command snippets below, I assume you have not `pkg lock`ed any packages?
Comment 4 Joseph Mingrone freebsd_committer freebsd_triage 2019-07-15 20:56:32 UTC
I confirmed your issue by running a little test in a jail.  Unfortunately I can't see a problem with math/R itself, since it depends on devel/readline [1].  It's more of a 'feature/limitation' of the ports tree and pkg.  I'll dig a little deeper and see if I can provide more information.

[1] More specifically, it has USES=readline:port, which in turn has LIB_DEPENDS+=libreadline.so.8:devel/readline.
Comment 5 Joseph Mingrone freebsd_committer freebsd_triage 2019-07-16 12:45:34 UTC
Adding pkg@ because I am unclear if it is expected behavior for `pkg install R` to ignore the missing libreadline.so.8 library dependency.  I would have guessed that pkg would either complain or try to upgrade the readline package to version 8.0.0.

A summary of the problem:

- Start with an older version of the readline package installed, version 7.0.5.
- `pkg install R`, which requires the shared library libreadline.so.8
- Installing R does not complain or try to upgrade the readline package
- R fails to run
Comment 6 Xenomorph 2019-07-31 17:54:36 UTC
I found this page looking for why R wouldn't run. Count me in as an impacted user!


No locked packages. 

# uname -a
FreeBSD hostname.local 12.0-RELEASE-p7 FreeBSD 12.0-RELEASE-p7 GENERIC  amd64

# pkg install R

# R

ld-elf.so.1: /usr/local/lib/R/lib/libR.so.3.6: Undefined symbol "rl_sort_completion_matches"

# pkg install redline


redline gets upgraded from 7.0.5 to 8.0.0, and then R runs.
Comment 7 Joseph Mingrone freebsd_committer freebsd_triage 2020-09-29 14:37:51 UTC
Closing this as it's not an issue with math/R and it's not a bug, but simply a current limitation with our packages.  Package repositories are meant to work as a set (a snapshot of the repository at any given time).  This means one-off installations or upgrades are not supported.  

In this case you would have to do a `pkg upgrade` before `pkg install R`.