Unable to compile opengl programs at CentOS 7

Issues related to applications and software problems
Locked
voronoit
Posts: 1
Joined: 2014/08/26 08:42:28

Unable to compile opengl programs at CentOS 7

Post by voronoit » 2014/08/26 08:51:22

Hi, I want to compile very basic opengl program on centos 7. Actually, I'm pretty sure (I'm not novice in opengl) I'm doing what I did before. But it fails on CentOS 7. Looks like the linker trying to find 32 bit opengl.so but the system is 64 bit. so thats why it fails in my opinion. I installed libraries, devel packages of opengl, glut, glu etc., compilers but no way.

My command is :

Code: Select all

g++ main.cpp  -lGL -lGLU -lglut
The output is (without verbose):

Code: Select all

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /lib/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: error: ld returned 1 exit status
libGL at /lib/libGL.so is 32 bit, I think it should look /lib64 or /usr/lib64.

When i compile in verbose mode, it shows:

Code: Select all

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1plus -quiet -v -D_GNU_SOURCE main.cpp -quiet -dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase main -version -o /tmp/ccmm1o4j.s
GNU C++ (GCC) version 4.8.2 20140120 (Red Hat 4.8.2-16) (x86_64-redhat-linux)
	compiled by GNU C version 4.8.2 20140120 (Red Hat 4.8.2-16), GMP version 5.1.1, MPFR version 3.1.1, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2
 /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/backward
 /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include
 /usr/local/include
 /usr/include
End of search list.
GNU C++ (GCC) version 4.8.2 20140120 (Red Hat 4.8.2-16) (x86_64-redhat-linux)
	compiled by GNU C version 4.8.2 20140120 (Red Hat 4.8.2-16), GMP version 5.1.1, MPFR version 3.1.1, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9385e644babc7ac95203cd5ae8cf3bbf
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 as -v --64 -o /tmp/ccyxckuQ.o /tmp/ccmm1o4j.s
GNU assembler version 2.23.52.0.1 (x86_64-redhat-linux) using BFD version version 2.23.52.0.1-16.el7 20130226
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/:/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.8.2/:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.8.2/collect2 --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.8.2/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../.. /tmp/ccyxckuQ.o -lGL -lGLU -lglut -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.8.2/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crtn.o
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /lib/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: error: ld returned 1 exit status
I'm getting crazy. Please thank you in advance guys.

chemal
Posts: 586
Joined: 2013/12/08 19:44:49

Re: Unable to compile opengl programs at CentOS 7

Post by chemal » 2014/08/26 22:35:27

libGL at /lib/libGL.so is 32 bit, I think it should look /lib64 or /usr/lib64.
It is looking there. But there is nothing to be found because you didn't install mesa-libGL-devel.x86_64.

deligkaris
Posts: 3
Joined: 2014/08/28 21:01:26

Re: Unable to compile opengl programs at CentOS 7

Post by deligkaris » 2014/08/28 22:06:46

Dear all,

I have encountered the same problem. While compiling Pymol on centos 7 I get:

****************
/usr/bin/ld: skipping incompatible /usr/lib/libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /lib/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: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
***************

and I do have the x86_64 libraries installed:

***************
[root@localhost ld.so.conf.d]# yum info mesa-libGL-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos-mirror.jchost.net
* epel: mirror.compevo.com
* extras: mirror.compevo.com
* rpmforge: mirror.team-cymru.org
* updates: centos.hostingxtreme.com
Installed Packages
Name : mesa-libGL-devel
Arch : x86_64
Version : 9.2.5
Release : 5.20131218.el7
Size : 1.0 M
Repo : installed
From repo : base
Summary : Mesa libGL development package
URL : http://www.mesa3d.org
License : MIT
Description : Mesa libGL development package

Available Packages
Name : mesa-libGL-devel
Arch : i686
Version : 9.2.5
Release : 5.20131218.el7
Size : 129 k
Repo : base/7/x86_64
Summary : Mesa libGL development package
URL : http://www.mesa3d.org
License : MIT
Description : Mesa libGL development package
*************************

Has anyone found the solution on this problem?

Thank you

User avatar
toracat
Forum Moderator
Posts: 7380
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: Unable to compile opengl programs at CentOS 7

Post by toracat » 2014/08/28 23:57:17

I was able to build and run pymol on my RHEL-7 box. It should work on CentOS-7, too. I took the tar file from my EL6 box (pymol-v1.7.1.3.tar.bz2) and installed a bunch of required packages. First try:

yum install freeglut-devel glew-devel libpng-devel numpy freetype-devel tkinter

It will pull all the dependencies. Building pymol binary will go through at this point, but this may depend on what you already have installed on your system. If it still fails, look through the output from the command (python setup.py build ...) and see if there are any file(s) that are "not found".

To actually run pymol. you need python-pmw which is not available (the el6 version is in EPEL). I did a rebuild of python-pmw-1.3.2-14 from Fedora-19's src.rpm and installed it.

After that pymol worked just fine under EL7.
CentOS Forum FAQ

deligkaris
Posts: 3
Joined: 2014/08/28 21:01:26

Re: Unable to compile opengl programs at CentOS 7

Post by deligkaris » 2014/08/29 16:11:12

I do have all the dependencies installed and the python setup.py build command fails with the error message I included in my previous message.

After installing centos 7 I installed the NVIDIA drivers on my system. Is this perhaps the reason why the "python setup.py build" command fails at that point? Do you have any suggestions for fixing this?

Since it seemed that it is not searching in /usr/lib64/ I tried the following: in the /etc/ld.so.conf.d directory I made a lib64.conf file with /usr/lib64 as the content and then run ldconfig. This did not help, the "python setup.py build" command got stuck again at the same point.

I did this because the command "locate *libGL.so*" returned the following:
/usr/lib/libGL.so
/usr/lib/libGL.so.1
/usr/lib/libGL.so.340.32
/usr/lib64/libGL.so
/usr/lib64/libGL.so.1
/usr/lib64/libGL.so.340.32

I would appreciate any suggestions...

User avatar
toracat
Forum Moderator
Posts: 7380
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: Unable to compile opengl programs at CentOS 7

Post by toracat » 2014/08/29 16:27:41

The systems I used to built pymol do not have Nvidia. Also, as you can see, I do not have 32-bit libGL files:

$ locate *libGL.so*
/usr/lib64/libGL.so
/usr/lib64/libGL.so.1
/usr/lib64/libGL.so.1.2.0

Did you install the Nvidia driver by running a script from the Nvidia site? If so, I suggest you use ELRepo's kmod-nvidia. It is supposed to install libGL in its own directory like:

/usr/lib64/libGL.so
/usr/lib64/libGL.so.1
/usr/lib64/libGL.so.1.2.0
/usr/lib64/nvidia/libGL.so
/usr/lib64/nvidia/libGL.so.1
/usr/lib64/nvidia/libGL.so.331.20
CentOS Forum FAQ

deligkaris
Posts: 3
Joined: 2014/08/28 21:01:26

Re: Unable to compile opengl programs at CentOS 7

Post by deligkaris » 2014/08/29 22:12:32

Yes, I downloaded the drivers from NVIDIA's website and run the executable on my system. I am concerned that by getting the package from ELREPO now after having installed NVIDIA's drivers may affect the functionality of the system (without NVIDIA's drivers CENTOS would freeze once I opened firefox or chrome). I will try your suggestion in a few months when I will have free time in case something goes really wrong.

Thank you.

lcod
Posts: 1
Joined: 2015/02/19 10:54:41

Re: Unable to compile opengl programs at CentOS 7

Post by lcod » 2015/02/19 11:04:29

Hi there,
I had the same problem you had: could not compile pymol with proprietary Nvidia drivers.
I did install nvidia proprietary drivers on centos 7 kernel 3.10.0-123.el7.x86_64 , following the nvidia installation guide. This deactivates the original nouveau drivers and blacklists them at the kernel level. After installing the required packages for pymol, I noticed that there is a broken link in /lib64/ for libGL.so which redirects it to an older version (deleted?) of libGL. just remove the link and make a new one

ln -s libGL.so.1 libGL.so

compiling now works fine for me.

all the best

mkcent
Posts: 1
Joined: 2015/08/31 23:10:18

Re: Unable to compile opengl programs at CentOS 7

Post by mkcent » 2015/08/31 23:15:16

Thanks lcod that fixed it for me as well.

Locked

Return to “CentOS 7 - Software Support”