Package Details: nlopt 2.4.2-2

Git Clone URL: https://aur.archlinux.org/nlopt.git (read-only)
Package Base: nlopt
Description: nonlinear optimization library
Upstream URL: http://ab-initio.mit.edu/wiki/index.php/NLopt
Licenses: LGPL
Submitter: dkremer
Maintainer: xantares
Last Packager: xantares
Votes: 22
Popularity: 0.675843
First Submitted: 2010-10-31 19:17
Last Updated: 2017-07-18 19:12

Dependencies (8)

Required by (10)

Sources (2)

Latest Comments

aphirst commented on 2018-05-25 20:46

Update: It seems that removing "--without-python" DOES generate the needed files for calling from python... from the system default python 3, at least. The .py I was running was using python 2, where of course the module "nlopt" doesn't exist.

Would it be possible (either via nlopt's build system itself, or otherwise) to also build for python2; and also, why is --without-python set in the first place, if python is a build dependency (similarly --without-guile and --without-matlab)?

aphirst commented on 2018-05-24 23:15

I'm trying to test someone else's python code which uses nlopt, but it seems that the PKGBUILD here disables python.

Stranger, is that even if I remove that flag, rebuild, and reinstall, I am still get the dreaded "ImportError: No module named nlopt" error.

Is anyone successfully using nlopt here with python?

dacko commented on 2017-07-18 10:47

My build unfortunately fails. I tried to change the PKGBUILD by disabling octave (I also installed octave) by adding to the lines 26 and 31: "--without-octave".

That's the relevant error message:
mex -output nlopt_optimize -O -DHAVE_CONFIG_H -I. -I../../octave -I.. -I../../api -I../../util ../../octave/nlopt_optimize-mex.c -Wl,-O1,--sort-common,-z,relro,-z,now -L../.libs -lnlopt_cxx
Unknown MEX argument '-Wl,-O1,--sort-common,-z,relro,-z,now'.
make[3]: *** [Makefile:733: nlopt_optimize.mexa64] Error 255

pie86 commented on 2017-07-10 17:19

I believe Octave should be an optional dependency. I compiled the package without it and I did not encounter problems.

StefanHamminga commented on 2017-04-24 05:33

The package build breaks for me if guile is present. In the PKGBUILD guile is disabled for the 'regular' build, but not for the C++ one. Adding '--without-guile' to line 26 as well builds the package properly.

aphirst commented on 2017-03-12 03:49

tl;dr If you use this with Octave, make sure to rebuild this package whenever Octave gets an update.

NLopt generates files for Octave at build-time, and the folder is dependent on the Octave version at that time. When I installed this originally, Octave 4.0.1 was the most recent version, so I had files in:
/usr/share/octave/4.0.1/site/m/

Now the most recent version is 4.2.1, so obviously, I had issues running NLopt from Octave until I realised what was going on. After a rebuild of nlopt, the required files were in
/usr/share/octave/4.2.1/site/m/
and things worked as expected.

poluyan commented on 2015-09-11 12:07

There is a problem in file nlopt_optimize-oct.cc. Octave_map class is deprecated and must be replaced by octave_map. With this change the package builds successfully.

bchretien commented on 2014-03-10 18:54

+1 on linker error and on kett's fix.

kett commented on 2014-01-22 19:46

The LDFLAG --as-needed prevents it from being built, which is a part of /etc/makepkg.conf by default. To remove it, add the following line to the PKGBUILD:

export LDFLAGS="${LDFLAGS//,--as-needed}"

It should be inserted before configure is called either time.

lmccl commented on 2014-01-19 23:38

I'm getting a link error when trying to build the package with makepkg:

[...]
/bin/sh ../libtool --tag=CXX --mode=link g++ -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fpermissive -Wl,-O1,--sort-common,--as-needed,-z,relro -o testopt testfuncs.o testopt.o ../libnlopt_cxx.la -lm
libtool: link: g++ -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fpermissive -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z -Wl,relro -o .libs/testopt testfuncs.o testopt.o ../.libs/libnlopt_cxx.so -lm
../.libs/libnlopt_cxx.so: undefined reference to `std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long)'
[...]

dtag commented on 2013-08-11 09:31

Thank you. Works again.

xantares commented on 2013-08-09 20:58

My bad, fixed.
x.

dtag commented on 2013-08-08 10:50

In the build_cxx folder, the ./configure call needs a --with-cxx parameter. Otherwise the cxx library is not built correctly.

xantares commented on 2013-07-30 07:42

Ok, it's fixed.

xantares commented on 2013-07-30 07:42

Ok, it's fixed.

xantares commented on 2013-07-30 07:42

Ok, it's fixed.

xantares commented on 2013-07-30 07:42

Ok, it's fixed.

xantares commented on 2013-07-30 07:42

Ok, it's fixed.

xantares commented on 2013-07-25 21:07

Hi,

There are several problems with this package:

1. out-of-source build bug:
sed -i "s|top_builddir)/api|top_srcdir)/api|g" swig/Makefile.am
autoreconf --verbose --install --symlink --force

2. should depend on gcc libs:
depends=('gcc-libs')

3. should makedepend on autotools, python-numpy, octave:
makedepends=('libtool' 'automake' 'autoconf' 'gcc' 'python2-numpy' 'octave')

4. I wouldn't optdepend on matlab:
optdepends=('octave: for use with octave',
'python2: for use with python',
'python-numpy: for use with python')

5. the guile module doesn't build, disable it:
--without-guile

6. unwanted libtool files:
rm $pkgdir/usr/lib/*.la

Below is the complete file.

Regards.


# Maintainer: David Kremer <david.kremer.dk@gmail.com>

pkgname=nlopt
pkgver=2.3
pkgrel=2
pkgdesc="nlopt : a non-linear optimization package, callable from C, C++, Fortran, Matlab \
or GNU Octave, Python, GNU Guile, and GNU R."
arch=('i686' 'x86_64')
url="http://ab-initio.mit.edu/wiki/index.php/NLopt"
license=('LGPL')
depends=('gcc-libs')
makedepends=('libtool' 'automake' 'autoconf' 'gcc' 'python2-numpy' 'octave')
optdepends=('octave: for use with octave',
'python2: for use with python',
'python-numpy: for use with python')
source=("http://ab-initio.mit.edu/nlopt/$pkgname-$pkgver.tar.gz")
md5sums=('811a9f1c7a7f879c7d7b4caa059eb8d6')

build() {
cd $srcdir/$pkgname-$pkgver
sed -i "s|top_builddir)/api|top_srcdir)/api|g" swig/Makefile.am
autoreconf --verbose --install --symlink --force
mkdir build_cxx
cd build_cxx
../configure --prefix=/usr --enable-shared PYTHON=python2 --with-cxx --without-guile
cd ..
mkdir build
cd build
../configure --prefix=/usr --enable-shared PYTHON=python2 --without-guile
}

package() {
cd $srcdir/$pkgname-$pkgver/build_cxx
make DESTDIR=$pkgdir install
cd ../build
make DESTDIR=$pkgdir install
rm $pkgdir/usr/lib/*.la
}

dreieck commented on 2013-03-08 10:51

For me, makepkg fails:

==>
[...]
make[2]: Entering directory `/var/tmp/yaourt-tmp-root/aur-nlopt/src/nlopt-2.3/build_cxx/test'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/var/tmp/yaourt-tmp-root/aur-nlopt/src/nlopt-2.3/build_cxx/test'
make[1]: Leaving directory `/var/tmp/yaourt-tmp-root/aur-nlopt/src/nlopt-2.3/build_cxx/test'
Making install in swig
make[1]: Entering directory `/var/tmp/yaourt-tmp-root/aur-nlopt/src/nlopt-2.3/build_cxx/swig'
make install-am
make[2]: Entering directory `/var/tmp/yaourt-tmp-root/aur-nlopt/src/nlopt-2.3/build_cxx/swig'
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../swig -I.. -pthread -I../api -g0 -march=x86-64 -mtune=generic -O3 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fpermissive -Wwrite-strings -fomit-frame-pointer -MT libnlopt_cxx_guile_la-nlopt-guile.lo -MD -MP -MF .deps/libnlopt_cxx_guile_la-nlopt-guile.Tpo -c -o libnlopt_cxx_guile_la-nlopt-guile.lo `test -f 'nlopt-guile.cpp' || echo '../../swig/'`nlopt-guile.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../swig -I.. -pthread -I../api -g0 -march=x86-64 -mtune=generic -O3 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fpermissive -Wwrite-strings -fomit-frame-pointer -MT libnlopt_cxx_guile_la-nlopt-guile.lo -MD -MP -MF .deps/libnlopt_cxx_guile_la-nlopt-guile.Tpo -c ../../swig/nlopt-guile.cpp -fPIC -DPIC -o .libs/libnlopt_cxx_guile_la-nlopt-guile.o
../../swig/nlopt-guile.cpp:1274:21: fatal error: nlopt.hpp: No such file or directory
compilation terminated.
make[2]: *** [libnlopt_cxx_guile_la-nlopt-guile.lo] Error 1
make[2]: Leaving directory `/var/tmp/yaourt-tmp-root/aur-nlopt/src/nlopt-2.3/build_cxx/swig'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/var/tmp/yaourt-tmp-root/aur-nlopt/src/nlopt-2.3/build_cxx/swig'
make: *** [install-recursive] Error 1

<==

svitenti commented on 2012-09-20 12:39

This solution don't work since it reconfigure in the same dir and always install last version (configured) only (the pure C). The problem is in the package itself, they use $(top_builddir)/api instead of $(top_srcdir)/api . I made a patch to solve this and already sent to the packager maintainer.

tnoo commented on 2012-09-20 03:52

Building from within ./build does not work for me (Symbol Error). Building within the source directory works fine, though.

build() {
cd $srcdir/$pkgname-$pkgver
./configure --prefix=/usr --enable-shared PYTHON=python2 --with-cxx
make
./configure --prefix=/usr --enable-shared PYTHON=python2
make
}

dkremer commented on 2012-09-17 20:47

ok done

svitenti commented on 2012-09-17 20:04

Ok, I'm using the modified PKGBUILD for a while and didn't had any problems, however, I've been testing it with C projects only. Since it distributes different headers and libraries for each build I don't think that any conflicts will occur.

Other people already experienced similar problems (http://article.gmane.org/gmane.science.analysis.nlopt.general/358). Therefore, the best solution would be to contact the nlopt developers to try to figure this out.

Thank you for your time.

dkremer commented on 2012-09-17 19:52

Ok, I can see at least two problems.

1) the PKGBUILD file is not more really regular, maybe it fits anyway the AUR standards, but I am not sure, I need to check.
2) Are they some file conflicts between the regular C compilation and the C++ compilation ?

for 1) , that's not a so big problem, but I'll check. For 2) also it doesn't seem to be a problem, since I suppose you tested your stuff better than I will.

So, I will probably do that change, let me know if you experiment some problems with this method.

svitenti commented on 2012-09-17 11:28

It is not the case, the C library is not built when you pass --with-cxx. The point is to not have to compile my C project using g++, this would slow down a lot the compilation time. Of course I can always modify PKGBUILD myself, which is what I do, however, as there are people using nlopt for both C and C++ project I don't see why the distribution has to be C++ only, adding the fact that the solution is so simple.

dkremer commented on 2012-09-17 10:33

@svitenti:

I can't understand what's the point. I thought that the C lib was built along with the C++ lib but now you tell me that it is not the case.

If you feel the need for the C library only, please modify the PKGBUILD for yourself.

svitenti commented on 2012-07-10 16:25

Hi, is it possible to change the PKGBUILD build and package
to match the following. This is necessary to build both
libnlopt and libnlopt_cxx.

build() {
cd $srcdir/$pkgname-$pkgver
mkdir build_cxx
cd build_cxx
../configure --prefix=/usr --enable-shared PYTHON=python2 --with-cxx
cd ..
mkdir build
cd build
../configure --prefix=/usr --enable-shared PYTHON=python2
}

package() {
cd $srcdir/$pkgname-$pkgver/build_cxx
make DESTDIR=$pkgdir install
cd ../build
make DESTDIR=$pkgdir install
}