【问题标题】:How to avoid these compile errors?如何避免这些编译错误?
【发布时间】:2019-05-03 12:15:03
【问题描述】:

我正在尝试为我的游戏服务器编译一个插件(更确切地说:click)。 因此,当我尝试使用 make 命令行在我的 linux VM(使用 centos 7+)中编译插件时,出现以下错误:

Compiling plugin..
Compiling plugin SDK..
Linking (dynamic)..
/usr/bin/ld: cannot find -lmysqlclient_r
/usr/bin/ld: skipping incompatible //usr/local/lib/libboost_thread.a when searching for -lboost_thread
/usr/bin/ld: cannot find -lboost_thread
/usr/bin/ld: skipping incompatible //usr/local/lib/libboost_chrono.a when searching for -lboost_chrono
/usr/bin/ld: cannot find -lboost_chrono
/usr/bin/ld: skipping incompatible //usr/local/lib/libboost_date_time.a when searching for -lboost_date_time
/usr/bin/ld: cannot find -lboost_date_time
/usr/bin/ld: skipping incompatible //usr/local/lib/libboost_system.a when searching for -lboost_system
/usr/bin/ld: cannot find -lboost_system
/usr/bin/ld: skipping incompatible //usr/local/lib/libboost_atomic.a when searching for -lboost_atomic
/usr/bin/ld: cannot find -lboost_atomic
collect2: error: ld returned 1 exit status
make: *** [dynamic_link] Error 1

我的问题是如何避免这些错误? 重要提示:编译此插件的教程(在此插件的 github 主页上)适用于此插件的较新版本,但我需要 R37 版本。 该插件是用 C 语言编写的,里面有一个 makefile。 谢谢。

【问题讨论】:

标签: c plugins compiler-errors


【解决方案1】:

Makefile 使用-m32 编译选项由于某种原因导致生成 32 位可执行文件。所以这个可执行文件需要 32 位库。因此,您应该删除 -m32 选项或安装所需的 32 位依赖项。

【讨论】:

  • 有没有办法在centos 7 中安装所有的32 位库?
  • @RaphaAxel 我想你需要寻找 i686 包,尽管我构建本机可执行文件可能是一个更好的主意。
【解决方案2】:

安装发行版附带的 libboost。 /usr/local/lib 中的任何内容都是坏的。

【讨论】:

  • 我已经安装了 libboosts 但还是一样...(boost.org/users/download 并下载了 boost_1_68_0.zip 然后安装了它)
  • 或者我应该在这个位置(/usr/local/lib)上安装这些库吗?也许我不明白你在说什么(是的,我是 linux 的新手和这些东西..)
  • 你应该安装 Fedora 提供的 libboost。 yum install boost-devel 删除您放入 /usr/local/lib 的所有内容。永远不要在那里安装任何东西,除非你找不到yum提供的你想要的东西,或者你在问问题。
猜你喜欢
  • 2012-10-06
  • 1970-01-01
  • 1970-01-01
  • 2016-03-23
  • 1970-01-01
  • 1970-01-01
  • 2020-06-03
  • 2021-07-02
  • 1970-01-01
相关资源
最近更新 更多