【问题标题】:Encountering 'undefined reference' and 'error adding symbols' when compiling OpenEXR [duplicate]编译 OpenEXR 时遇到“未定义的引用”和“添加符号时出错”[重复]
【发布时间】:2015-04-29 21:06:49
【问题描述】:

我在Ubuntu 14.04 上安装OpenEXR_Viewers。运行makefile时遇到如下错误:

/usr/bin/ld: ImageView.o: 未定义对符号“glOrtho”的引用 //usr/lib/x86_64-linux-gnu/mesa/libGL.so.1:添加符号时出错:DSO 命令行 collect2 中缺失:错误:ld 返回 1 个退出状态

我的 lib 工具调用是否可能没有调用 GL?如果是这种情况,如何设置我的 libtool 以使用 GL 构建? (编辑 makefile 以查看 OpenGL)

Making all in playexr
make[1]: Entering directory `/home/user/Documents/source/openexr/OpenEXR_Viewers/playexr'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/user/Documents/source/openexr/OpenEXR_Viewers/playexr'
Making all in exrdisplay
make[1]: Entering directory `/home/user/Documents/source/openexr/OpenEXR_Viewers/exrdisplay'
/bin/bash ../libtool  --tag=CXX   --mode=link g++ -pipe -g -O2   -o exrdisplay main.o ImageView.o loadImage.o scaleImage.o applyCtl.o GlWindow3d.o -L/usr/local/lib   -pthread -L/usr/local/lib -lIlmImf -lImath-2_2 -lIexMath-2_2 -lHalf -lIex-2_2 -lIlmThread-2_2 -DHAVE_CTL_INTERPRETER=0 -L/usr/local/lib   -DHAVE_CTL_INTERPRETER=0 -pthread -L/usr/local/lib -lIlmImf -lImath-2_2 -lIexMath-2_2 -lHalf -lIex-2_2 -lIlmThread-2_2 -Wl,-Bsymbolic-functions -lfltk_gl -lfltk -lX11 

*** Warning: Linking the executable exrdisplay against the loadable module
*** libImath-2_2.so is not portable!

*** Warning: Linking the executable exrdisplay against the loadable module
*** libIexMath-2_2.so is not portable!

*** Warning: Linking the executable exrdisplay against the loadable module
*** libHalf.so is not portable!

*** Warning: Linking the executable exrdisplay against the loadable module
*** libIex-2_2.so is not portable!

*** Warning: Linking the executable exrdisplay against the loadable module
*** libIlmThread-2_2.so is not portable!
libtool: link: g++ -pipe -g -O2 -o exrdisplay main.o ImageView.o loadImage.o scaleImage.o applyCtl.o GlWindow3d.o -pthread -DHAVE_CTL_INTERPRETER=0 -DHAVE_CTL_INTERPRETER=0 -pthread -Wl,-Bsymbolic-functions  -L/usr/local/lib /usr/local/lib/libIlmImf.so /usr/local/lib/libImath-2_2.so /usr/local/lib/libIexMath-2_2.so /usr/local/lib/libHalf.so /usr/local/lib/libIex-2_2.so /usr/local/lib/libIlmThread-2_2.so -lfltk_gl -lfltk -lX11 -pthread
/usr/bin/ld: ImageView.o: undefined reference to symbol 'glOrtho'
//usr/lib/x86_64-linux-gnu/mesa/libGL.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [exrdisplay] Error 1
make[1]: Leaving directory `/home/user/Documents/source/openexr/OpenEXR_Viewers/exrdisplay'
make: *** [all-recursive] Error 1

【问题讨论】:

  • 怎么是重复的? '我的 lib 工具调用是否可能没有调用 GL?如果是这种情况,我该如何设置我的 libtool 以使用 GL 构建?请去掉重复的标记。

标签: linux opengl makefile ubuntu-14.04 libtool


【解决方案1】:

尝试将-lglut -lGL(可能还有-lGLU)添加到您的链接器命令中。

(g++ linker: /usr/lib/libGL.so.1: could not read symbols: Invalid operation)

更新:

将其附加到:

FLTK_LDFLAGS = -Wl,-Bsymbolic-functions -lfltk_gl -lfltk -lX11

喜欢

FLTK_LDFLAGS = -Wl,-Bsymbolic-functions -lfltk_gl -lfltk -lX11 -lglut -lGL

【讨论】:

  • 我应该在哪里添加呢?我假设在我的 Makefile 中?
  • 是的,到你的 Makefile,到执行 libtool 的行(结果在命令行 libtool: link: g++ -pipe -g -O2 -o exrdisplay main.o ImageView.o loadImage.o scaleImage.o applyCtl.o GlWindow3d.o -pthread -DHAVE_CTL_INTERPRETER=0 -DHAVE_CTL_INTERPRETER=0 -pthread -Wl,-Bsymbolic-functions -L/usr/local/lib /usr/local/lib/libIlmImf.so /usr/local/lib/libImath-2_2.so /usr/local/lib/libIexMath-2_2.so /usr/local/lib/libHalf.so /usr/local/lib/libIex-2_2.so /usr/local/lib/libIlmThread-2_2.so -lfltk_gl -lfltk -lX11 -pthread
  • 所以看看makefile,我不清楚我会在哪里添加它。这是粘贴箱的链接:pastebin.com/VjdnuM6h 你能指出来吗?
猜你喜欢
  • 1970-01-01
  • 2015-05-10
  • 1970-01-01
  • 1970-01-01
  • 2015-04-24
  • 2021-03-14
  • 2019-06-07
  • 2013-03-07
  • 2015-05-23
相关资源
最近更新 更多