linux - 未定义对 `clock_gettime' 的引用,修改 makefile?

标签 linux installation ipopt

<分区>

我知道这个问题已经在别处问过,例如here ,但我在那里找不到我的具体问题的解决方案。

我一直在尝试安装软件Ipopt在 Linux 上,按照文档中的说明进行操作,但是当我运行 make 时出现以下错误:

/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

根据上面的帖子,解决这个问题的方法是包括 -lrt 标志,但我不知道我是否应该将它插入 make 文件中,在什么 makefile 中,以及在 makefile 中的确切位置。仅供引用,这里是 Ipopt archive我一直在使用的,你可以在哪里找到 Makefile,这里有一些关于我的 linux 发行版的信息

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

谢谢。

最佳答案

我看到的 ipopt 配置为 configure script , 阅读 help from that script我猜你可以只添加 ADD_CFLAGS 编译器标志:

ADD_CFLAGS=-lrt ./configure

然后运行 ​​make。

关于linux - 未定义对 `clock_gettime' 的引用,修改 makefile?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51209116/

相关文章:

julia - JuMP 非线性优化约束被打破到 O(1e-9)

c++ - Carla Python/C++扩展-导入错误: undefined symbol Ipopt

python - Gekko非线性优化,目标函数错误

java - 在不更改默认 Java 的情况下安装 Oracle JRE 的最佳方法?

r - 无法在没有 root 权限的集群上安装 nloptr/nlopt

"num_online_cpus()"能否在同一次运行中返回不同的值?

php - 需要在托管服务器上为我的 php 文件运行 cron 作业

.net - 安装 Windows 服务以虚拟用户身份运行

linux - 在 Ubuntu 上使用 gnome-terminal --tab 选项打开选项卡并运行脚本

linux - dotnet 核心中的 SocketCAN