Code Monkey home page Code Monkey logo

Comments (10)

astamm avatar astamm commented on August 30, 2024

Thanks for reporting that. Might it be possible that you have a file ~/.Rprofile or a file ~/.Renviron? If you have such a file or files, can you copy their content please?

from nloptr.

astamm avatar astamm commented on August 30, 2024

Also, it seems you already have nlopt as a system build but of version < 2.7.0. This triggers a cmake build of v2.7.1 and I suspect with all your includes and linking libraries that the compiler might have to choose between both versions and might be a bit lost. If that were to be the case, we should definitely improve upon this situation. In the meantime, I think that if you either upgrade or delete your older version of nlopt, then you should be able to install nloptr successfully.
Alternatively, it might be an issue with the files I mentioned above.

from nloptr.

milanmlft avatar milanmlft commented on August 30, 2024

Thanks for the help!

Thanks for reporting that. Might it be possible that you have a file ~/.Rprofile or a file ~/.Renviron? If you have such a file or files, can you copy their content please?

I checked and I don't see anything that could interfere with the installation. The problem also occurred when running the installation through Rscript --vanilla.

However, removing my previous nlopt installation did the trick! So it seems that there was indeed some confusion between the different versions.

from nloptr.

astamm avatar astamm commented on August 30, 2024

We might need to dig into this. @eddelbuettel: is the current strategy in configure.ac supposed to avoid this or is there something we missed?

from nloptr.

eddelbuettel avatar eddelbuettel commented on August 30, 2024

We made a decision to fail when the version is too low:

nloptr/configure.ac

Lines 54 to 63 in 69bfb77

## And if we have pkg-config, use it to test minimal version
if test x"${have_pkg_config}" != x"no"; then
AC_MSG_CHECKING([for pkg-config checking NLopt version])
if pkg-config --atleast-version=2.7.0 nlopt; then
AC_MSG_RESULT([>= 2.7.0])
need_to_build="no"
else
AC_MSG_RESULT([insufficient: NLopt 2.7.0 or later is preferred.])
fi
fi

We then still force a build. Turns out that those can turn sour. Maybe that can be improved by reordering -I and -L flags to point to 'our' rather than system nlopt. I don't know -- you are the one who thinks we should always build :)

from nloptr.

astamm avatar astamm commented on August 30, 2024

Actually, I think the issue comes from here:

nloptr/configure.ac

Lines 38 to 52 in 69bfb77

AC_PATH_PROG(have_pkg_config, pkg-config, no)
## If yes, also check for whether pkg-config knows nlopt
if test x"${have_pkg_config}" != x"no"; then
AC_MSG_CHECKING([if pkg-config knows NLopt])
if pkg-config --exists nlopt; then
AC_MSG_RESULT([yes])
nlopt_include=$(pkg-config --cflags nlopt)
nlopt_libs=$(pkg-config --libs nlopt)
AC_SUBST([NLOPT_INCLUDE], "${nlopt_include}")
AC_SUBST([NLOPT_LIBS], "${nlopt_libs}")
else
AC_MSG_RESULT([no])
have_pkg_config="no"
fi
fi

It seems we update PKG_CPPFLAGS and PKG_LIBS variables regardless of whether the system nlopt is recent enough.
I think moving the if statement which tests minimal version within the if statement that tests whether nlopt already exists should do the trick.

from nloptr.

astamm avatar astamm commented on August 30, 2024

Something like that should do the trick:

## But: Can we use pkg-config?
AC_PATH_PROG(have_pkg_config, pkg-config, no)
## If yes, also check for whether pkg-config knows nlopt
if test x"${have_pkg_config}" != x"no"; then
    AC_MSG_CHECKING([if pkg-config knows NLopt])
    if pkg-config --exists nlopt; then
        AC_MSG_RESULT([yes])
        ## Since nlopt has been found, test for minimal version requirement
        AC_MSG_CHECKING([for pkg-config checking NLopt version])
        if pkg-config --atleast-version=2.7.0 nlopt; then
            AC_MSG_RESULT([>= 2.7.0])
            nlopt_include=$(pkg-config --cflags nlopt)
            nlopt_libs=$(pkg-config --libs nlopt)
            AC_SUBST([NLOPT_INCLUDE], "${nlopt_include}")
            AC_SUBST([NLOPT_LIBS],    "${nlopt_libs}")
            need_to_build="no"
        else
            AC_MSG_RESULT([insufficient: NLopt 2.7.0 or later is preferred.])
        fi
    else
        AC_MSG_RESULT([no])
        have_pkg_config="no"
    fi
fi

from nloptr.

eddelbuettel avatar eddelbuettel commented on August 30, 2024

(Next time, could you make it easier and show a diff?)

Is the change you are proposing the inner else? Whichmessages but does not error, so inexperienced users may again be lost in front of too much output if it fails later?

PS And I missed that you were posting two tickets at once. Yes -- the propagation of what was found may be related, that is a good catch as we didn't really consider that case.

PPS Yep, agree. Combining tests for 'does it exist and is it new enough' should help!

from nloptr.

astamm avatar astamm commented on August 30, 2024

We might also remove the setting of have_pkg_config="no" in the else part of the outer if statement since this variable is then not used anymore.
Yes, I'll show a diff next time, sorry.

from nloptr.

eddelbuettel avatar eddelbuettel commented on August 30, 2024

Agreed on the have_pkg_config="no", that was just to hop into the next block and all that did not account for crossover effects.

from nloptr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.