1

I know that this question has been asked elsewhere, for example here, but I could not find the solution to my specific problem in there.

I have been trying to install the software Ipopt on Linux, followed the instructions in the documentation, but when I run make I obtain the following error:

/obs/xxx/Ipopt-3.12.8/build/ThirdParty/ASL/.libs/libcoinasl.so: undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make[3]: *** [ipopt] Error 1
make[3]: Leaving directory `/xxx_home/xxx/Ipopt-3.12.8/build/Ipopt/src/Apps/AmplSolver'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/xxx_home/xxx/Ipopt-3.12.8/build/Ipopt/src/Apps'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/xxx_home/xxx/Ipopt-3.12.8/build/Ipopt'
make: *** [all-recursive] Error 1

According to the posts above, the way around this is to include the -lrt flag, but I do not know whether I should insert it in the make file, in what makefile, and where exactly in the makefile. FYI, here is the Ipopt archive that I have been using, where you can find the Makefile, and here is some information about my linux distribution

$ uname -or
3.2.0-0.bpo.4-amd64 GNU/Linux
$ lsb_release -irc
Distributor ID: Debian
Release:    6.0.10
Codename:   squeeze

Thank you.

James
  • 383
  • 1
  • 4
  • 15
  • Possible duplicate of [C++ error: undefined reference to 'clock\_gettime' and 'clock\_settime'](https://stackoverflow.com/q/2418157/608639) and [GCC with -std=c99 complains about not knowing struct timespec](https://stackoverflow.com/q/3875197/608639), [Append compile flags to CFLAGS and CXXFLAGS while configuration/make](https://stackoverflow.com/q/23407635/608639), [Where to add a CFLAG, such as -std=gnu99, into an autotools project](https://stackoverflow.com/q/11647208/608639), etc. Your compile command may need `-D_XOPEN_SOURCE=600`. – jww Jul 08 '18 at 02:42

1 Answers1

2

ipopt i see is configured with configure script, reading help from that script i guess you can just ADD_CFLAGS compiler flags:

ADD_CFLAGS=-lrt ./configure

and then run make.

KamilCuk
  • 120,984
  • 8
  • 59
  • 111