astamm / nloptr

nloptr provides an R interface to NLopt, a free/open-source library for nonlinear optimization providing a common interface to a number of different optimization routines which can handle nonlinear constraints and lower and upper bounds for the controls.
https://astamm.github.io/nloptr/
Other
105 stars 35 forks source link

Trouble with installing under FreeBSD #20

Closed JiangXD closed 2 years ago

JiangXD commented 8 years ago

Dear Jelmer, I failed to install nloprt package under FreeBSD. I have emailed to you for the same question several months ago, and you had given me a good patch to solve it. But the patch was not merged into the current version of nloptr package on github. It might affected the future version published on CRAN. Could you mind it?

   Thanks so much and best wishes,
    Xiaodong

I attach the previous email for your references.

Dear Jelmer, Your patch for 'nloptr' is so great! I've try it under FreeBSD by your suggestion with sucessul installtion, and it works properly!

Thanks so much and best wishes, Xiaodong

On Sun, 29 Mar 2015 20:48:23 +0200 Jelmer Ypma jelmerypma@gmail.com wrote:

Dear Xiaodong,

Thank you for your message. I may have a patch but do not have access to a FreeBSD system. Would you be willing to try out the patch? That would be very helpful. The patch requires the following three steps:

  1. Change the following lines in configure.ac Old: ed -s isres/isres.c <<< $'H\n,s/sqrt(/sqrt((double) /g\nw'; \ ed -s util/qsort_r.c <<< $'H\n1i\nextern "C" {\n.\nw'; \ ed -s util/qsort_r.c <<< $'H\n$a\n}\n.\nw' ; \ New: echo $'H\n,s/sqrt(/sqrt((double) /g\nw'|ed -s isres/isres.c; \ echo $'H\n1i\nextern "C" {\n.\nw'|ed -s util/qsort_r.c; \ echo $'H\n$a\n}\n.\nw'|ed -s util/qsort_r.c; \
  2. Create a new configure file using autoconf.
  3. Check if installation of the package works.

Many thanks and best wishes, Jelmer

On Fri, Mar 27, 2015 at 9:03 AM, 姜晓东 56946349@qq.com wrote:

Dear Jelmer Ypma, Your package 'nloptr' for R is important for many related packages. I found it can not be installed in FreeBSD, in which Bourne Shell but bash is the default shell. When installing nloptr in R of FreeBSD, such error messages appeared:

./configure: 3314: Syntax error: redirection unexpected (expecting word) ./configure: 3313: Syntax error: Error in command substitution ERROR: configuration failed for package ‘nloptr’

  • removing ‘/usr/home/jxd/R/amd64-portbld-freebsd10.0-library/3.0/nloptr’

    When I changed the first line of configure in nloptr tar file from "#!/bin/sh" to "#!/usr/local/bin/bash", package 'nloptr' could be manually installed by "R CMD INSTALL" sucessfully.

    So, I guess some bash-specific syntax was used in the line 3313-3314 of file 'configure', which is normal under Linux but failed under FreeBSD.

    Could you fix it for Bourne-Shell systems such as FreeBSD?

With best regards, Xiaodong Jiang

State Key Laboratory of Medical Neurobiology, Fudan University, Shanghai, China.

jszhao commented 8 years ago

Yes, I have also encountered the same problem. The version of R on FreeBSD is:

platform       amd64-portbld-freebsd10.1
arch           amd64
os             freebsd10.1
system         amd64, freebsd10.1
status
major          3
minor          2.2
year           2015
month          08
day            14
svn rev        69053
language       R
version.string R version 3.2.2 (2015-08-14)
nickname       Fire Safety
jyypma commented 8 years ago

Thanks for your messages. Does one of you know whether this solution will also work on Solaris?

On Sat, Jan 9, 2016 at 4:10 PM, jszhao notifications@github.com wrote:

Yes, I have also encountered the same problem. The version of R on FreeBSD is:

platform amd64-portbld-freebsd10.1 arch amd64 os freebsd10.1 system amd64, freebsd10.1 status major 3 minor 2.2 year 2015 month 08 day 14 svn rev 69053 language R version.string R version 3.2.2 (2015-08-14) nickname Fire Safety

— Reply to this email directly or view it on GitHub https://github.com/jyypma/nloptr/issues/20#issuecomment-170249853.

dernst commented 8 years ago

Hi, the fix above works for me on Solaris 11.2 with g++ 4.8.2. Haven't tested with solarisstudio since it shouldn't affect the compiler. Someone on freenode in #R was having the same problem on Linux too, so it does not only seem to affect FreeBSD. Thanks in advance if you decide to include the fix in the next release :-)

sgerrand commented 8 years ago

I have the same issue on Alpine Linux v3.3. The above patch works for me. Please merge it in!

leahneukirchen commented 7 years ago

This issue happens on every system where /bin/sh is not bash, e.g. also Void Linux, which uses dash.

yurivict commented 7 years ago

Fix: https://github.com/jyypma/nloptr/pull/31

astamm commented 2 years ago

We just released v2.0.0. We now rely on Cmake when building from source. Can you test and tell us if it fixes whatever issue you had in the past please?

leahneukirchen commented 2 years ago

install.packages("nloptr") works for me now, thanks!