【问题标题】:Lua compilation link errorLua编译链接错误
【发布时间】:2012-07-11 22:22:07
【问题描述】:

当我尝试编译一个小 lua 程序时,我得到了这些错误:

/usr/lib//liblua52.so: undefined reference to `dlsym'
/usr/lib//liblua52.so: undefined reference to `dlerror'
/usr/lib//liblua52.so: undefined reference to `dlopen'
/usr/lib//liblua52.so: undefined reference to `dlclose'

当然,我用 -ldl 链接。我的 ubuntu 上安装了 lua5.2-dev。 如果您需要更多信息,请询问我。

谢谢!

【问题讨论】:

  • 产生此错误的确切编译器/链接器命令行是什么?
  • g++ -o client Box.o ConnexionException.o GameData.o LuaManager.o main.o Parser.o ParsingException.o Player.o Socket.o -L/usr/lib/ -ldl -Llib /lib/ -Wl,--rpath=lib/lib -llua52 -Wl,--rpath=lib/lib -lSLB /usr/lib//liblua52.so: 未定义引用dlsym' /usr/lib//liblua52.so: undefined reference to dlerror' /usr/lib/ /liblua52.so: 未定义引用dlopen' /usr/lib//liblua52.so: undefined reference to dlclose'
  • -ldl放在链接命令行的末尾。
  • 已经有了,不是在最后,而是还在。

标签: linker compiler-errors lua


【解决方案1】:

当我尝试编译一个小 lua 程序时,我得到了这些错误

没有。 链接程序时会出现这些错误。

解决方法是在链接行末尾添加-ldl

【讨论】:

【解决方案2】:

获取此错误的简单方法是在 Makefile 中设置错误的 PLAT 变量。需要在顶层 Makefile 和 src/Makefile 中设置。

合法值显示在定义后面大约 10 行。

【讨论】:

    【解决方案3】:

    确保 -ldl 正好位于您的链接行的末尾,正如 Employed Russian 所提到的那样

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-01
      • 1970-01-01
      • 2011-07-26
      • 1970-01-01
      • 2014-01-14
      • 2014-02-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多