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

error building nloptr on mac #19

Closed
yina opened this issue Dec 30, 2015 · 1 comment
Closed

error building nloptr on mac #19

yina opened this issue Dec 30, 2015 · 1 comment

Comments

@yina
Copy link

yina commented Dec 30, 2015

On my mac, I've installed nlopt with homebrew with the line.

brew install nlopt

The files are placed in /usr/local/Cellar/nlopt/2.4.2.

When I run

install.packages("nloptr")

I get the following errors

...
checking nlopt.h usability... yes
checking nlopt.h presence... yes
checking for nlopt.h... yes
configure: Suitable NLopt library found.
configure: creating ./config.status
config.status: creating src/Makevars
** libs
clang++ -I/usr/local/Cellar/r/3.2.3/R.framework/Resources/include -DNDEBUG -I/usr/local/include  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include  -I/usr/local/include   -fPIC  -g -O2  -c dummy.cpp -o dummy.o
clang -I/usr/local/Cellar/r/3.2.3/R.framework/Resources/include -DNDEBUG -I/usr/local/include  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include  -I/usr/local/include  -I/usr/local/Cellar/nlopt/2.4.2/include -fPIC  -g -O2  -c nloptr.c -o nloptr.o
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/Cellar/r/3.2.3/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -o nloptr.so dummy.o nloptr.o -L/usr/local/Cellar/nlopt/2.4.2/lib -lnlopt -lm -F/usr/local/Cellar/r/3.2.3/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
ld: library not found for -lnlopt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nloptr.so] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/usr/local/lib/R/3.2/site-library/nloptr’
* restoring previous ‘/usr/local/lib/R/3.2/site-library/nloptr’
Warning in install.packages :
  installation of package ‘nloptr’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/x0/y0b_v56j1j79jr55r9yftj580000gn/T/RtmptXK02m/downloaded_packages’

The clang++ compilation clearly has the include and lib directories linked as per L/usr/local/Cellar/nlopt/2.4.2/lib. Help appreciated.

@yina
Copy link
Author

yina commented Dec 30, 2015

I fixed the issue. The brew version was conflicting with the build. I had to uninstall the brew nlopt with

brew uninstall nlopt

and then when I ran

install.packages("nloptr")

the package installer correctly downloaded and installed nlopt.

@yina yina closed this as completed Dec 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant