gpt4 book ai didi

c++ - 在 CentOS 上使用 OpenGL 支持从源代码编译 Qt 4.8.3

转载 作者:太空狗 更新时间:2023-10-29 23:16:20 24 4
gpt4 key购买 nike

尝试编译支持 opengl 的 Qt 4.8.4 以安装 Visit。我跑

./configure -opengl -verbose

控制台给我:

OpenGL auto-detection... ()
g++ -c -m64 -pipe -O2 -Wall -W -I../../../mkspecs/linux-g++-64 -I. -I/usr/include/GL -I/usr/X11R6/include -o opengl.o opengl.cpp
g++ -m64 -Wl,-O1 -o opengl opengl.o -L/usr/lib64/X11 -L/usr/lib64 -lGL -lXext -lX11 -lm
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /usr/lib/libGL.so when searching for -lGL
/usr/bin/ld: cannot find -lGL
collect2: ld returned 1 exit status
gmake: *** [opengl] Error 1
OpenGL disabled.
OpenGL ES 2.x auto-detection... ()
g++ -c -m64 -pipe -O2 -Wall -W -I../../../mkspecs/linux-g++-64 -I. -I/usr/X11R6/include -o opengles2.o opengles2.cpp
opengles2.cpp:45:25: error: GLES2/gl2.h: No such file or directory
opengles2.cpp: In function ‘int main(int, char**)’:
opengles2.cpp:50: error: ‘GLfloat’ was not declared in this scope
opengles2.cpp:50: error: ‘glUniform1f’ was not declared in this scope
opengles2.cpp:51: error: ‘GL_COLOR_BUFFER_BIT’ was not declared in this scope
opengles2.cpp:51: error: ‘glClear’ was not declared in this scope
gmake: *** [opengles2.o] Error 1
OpenGL ES 2.x disabled.
OpenGL ES 1.x auto-detection... ()
g++ -c -m64 -pipe -O2 -Wall -W -I../../../mkspecs/linux-g++-64 -I. -I/usr/X11R6/include -o opengles1.o opengles1.cpp
opengles1.cpp:45:23: error: GLES/gl.h: No such file or directory
opengles1.cpp: In function ‘int main(int, char**)’:
opengles1.cpp:50: error: ‘GLfloat’ was not declared in this scope
opengles1.cpp:50: error: expected ‘;’ before ‘a’
opengles1.cpp:51: error: ‘a’ was not declared in this scope
opengles1.cpp:51: error: ‘glColor4f’ was not declared in this scope
opengles1.cpp:52: error: ‘GL_COLOR_BUFFER_BIT’ was not declared in this scope
opengles1.cpp:52: error: ‘glClear’ was not declared in this scope
gmake: *** [opengles1.o] Error 1
OpenGL ES 1.x disabled.
All the OpenGL functionality tests failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in
/home/.../Downloads/qt-everywhere-opensource-src-4.8.3/mkspecs/linux-g++-64.

所以,我查看/mkspecs/linux-g++-64,只有一个文件,qmake.conf

#
# qmake configuration for linux-g++
#
# Written for GNU/Linux platforms that have both lib and lib64 directories,
# like the AMD Opteron.
#

MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib

QMAKE_CFLAGS = -m64
QMAKE_LFLAGS = -m64

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)


QMAKE_LIBDIR_X11 = /usr/X11R6/lib64
QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib64

我没有/usr/X11R6 目录,但 X_11 报告输出中的一切正常。

我添加变量:

QMAKE_INCDIR_OPENGL   = /usr/include/GL
QMAKE_LIBDIR_OPENGL = /usr/lib64
QMAKE_LIBS_OPENGL = -lGLU -lGL

/usr/include/GL 的内容:

drwxr-xr-x.  3 root root 4.0K Jun 29 14:26 .
drwxr-xr-x. 46 root root 12K Jun 29 16:07 ..
-rw-r--r--. 1 root root 7.7K Nov 12 2010 freeglut_ext.h
-rw-r--r--. 1 root root 681 Nov 12 2010 freeglut.h
-rw-r--r--. 1 root root 26K Nov 12 2010 freeglut_std.h
-rw-r--r--. 1 root root 710K Dec 13 2013 glext.h
-rw-r--r--. 1 root root 83K Dec 13 2013 gl.h
-rw-r--r--. 1 root root 126K Dec 13 2013 gl_mangle.h
-rw-r--r--. 1 root root 17K Dec 13 2013 glu.h
-rw-r--r--. 1 root root 3.3K Dec 13 2013 glu_mangle.h
-rw-r--r--. 1 root root 639 Nov 12 2010 glut.h
-rw-r--r--. 1 root root 44K Dec 13 2013 glxext.h
-rw-r--r--. 1 root root 17K Dec 13 2013 glx.h
-rw-r--r--. 1 root root 4.6K Feb 23 2013 glxint.h
-rw-r--r--. 1 root root 3.4K Dec 13 2013 glx_mangle.h
-rw-r--r--. 1 root root 2.1K Feb 23 2013 glxmd.h
-rw-r--r--. 1 root root 80K Feb 23 2013 glxproto.h
-rw-r--r--. 1 root root 12K Feb 23 2013 glxtokens.h
drwxr-xr-x. 2 root root 4.0K Jun 25 17:20 internal

/usr/lib64 的内容

lrwxrwxrwx.   1 root root    15 Jun 25 17:20 libGLU.so -> libGLU.so.1.3.1
lrwxrwxrwx. 1 root root 15 Jun 25 15:59 libGLU.so.1 -> libGLU.so.1.3.1
-rwxr-xr-x. 1 root root 514K Dec 13 2013 libGLU.so.1.3.1
-rw-r--r--. 1 root root 656 Jun 25 16:20 libGL.la
lrwxrwxrwx. 1 root root 14 Jun 25 17:20 libGL.so -> libGL.so.1.2.0
lrwxrwxrwx. 1 root root 15 Jun 25 16:20 libGL.so.1 -> libGL.so.331.79
-rwxr-xr-x. 1 root root 1.2M Jun 25 16:20 libGL.so.331.79
lrwxrwxrwx. 1 root root 15 Jun 25 17:20 libGLU.so -> libGLU.so.1.3.1
lrwxrwxrwx. 1 root root 15 Jun 25 15:59 libGLU.so.1 -> libGLU.so.1.3.1
-rwxr-xr-x. 1 root root 514K Dec 13 2013 libGLU.so.1.3.1

./configure -opengl -verbose 给出相同的结果

此外

glxgears

工作正常。

我做错了什么?

最佳答案

我猜你可能安装了提供 libGL.so.1.2.0 的 mesa 驱动程序并更改了 libGL.so 符号链接(symbolic link)。

libGL.so -> libGL.so.1.2.0
libGL.so.1 -> libGL.so.331.79
libGL.so.331.79

在/usr/lib64中,

rm libGL.so
ln -s libGL.so.1 libGL.so

给你

libGL.so -> libGL.so.1 -> libGL.so.331.79

关于c++ - 在 CentOS 上使用 OpenGL 支持从源代码编译 Qt 4.8.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24477196/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com