![OpenGL 코드를 컴파일할 수 없습니다](https://linux55.com/image/147301/OpenGL%20%EC%BD%94%EB%93%9C%EB%A5%BC%20%EC%BB%B4%ED%8C%8C%EC%9D%BC%ED%95%A0%20%EC%88%98%20%EC%97%86%EC%8A%B5%EB%8B%88%EB%8B%A4.png)
내 노트북에서 Linux Mint 19.1을 실행하고 있는데 이 문제가 발생했습니다. OpenGL 라이브러리를 사용하여 C++ 프로그램을 컴파일하려고 하면 다음과 같이 표시됩니다.
$ make
g++ solsys.cpp -lglut -lGLEW -lGL -lGLU -fpermissive -o solsys
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'solsys' failed
make: *** [solsys] Error 1
이전에 컴파일한 프로그램을 실행하려고 하는데 이 컴퓨터에서는 다음과 같은 메시지가 나타납니다.
./rotation: error while loading shared libraries: libGLEW.so.1.13: cannot open shared object file: No such file or directory
실제로 라이브러리가 제대로 설치되지 않은 것이 문제라는 것을 알고 있지만 알 수는 없습니다.
glxino | grep OpenGL
이것을 출력하다
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.0.5
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 18.0.5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 18.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
그런데 노트북에 Nvidia 드라이버를 설치하는 데 문제가 있었지만 포기했습니다.
$lspci | grep "NVIDIA"
04:00.0 3D controller: NVIDIA Corporation GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] (rev a1)
고쳐 쓰다:
$ sudo apt-get install libglew-dev libgl1-mesa-dev libglu1-mesa-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libglu1-mesa-dev is already the newest version (9.0.0-2.1build1).
libglu1-mesa-dev set to manually installed.
libglew-dev is already the newest version (2.0.0-5).
libgl1-mesa-dev is already the newest version (18.0.5-0ubuntu0~18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 36 not upgraded.
...
$ dpkg -l | grep mesa
ii libegl-mesa0:amd64 18.0.5-0ubuntu0~18.04.1 amd64 free implementation of the EGL API -- Mesa vendor library
ii libegl1-mesa:amd64 18.0.5-0ubuntu0~18.04.1 amd64 transitional dummy package
ii libegl1-mesa-dev:amd64 18.0.5-0ubuntu0~18.04.1 amd64 free implementation of the EGL API -- development files
ii libgl1-mesa-dev:amd64 18.0.5-0ubuntu0~18.04.1 amd64 free implementation of the OpenGL API -- GLX development files
ii libgl1-mesa-dri:amd64 18.0.5-0ubuntu0~18.04.1 amd64 free implementation of the OpenGL API -- DRI modules
ii libgl1-mesa-dri:i386 18.0.5-0ubuntu0~18.04.1 i386 free implementation of the OpenGL API -- DRI modules
ii libgl1-mesa-glx:amd64 18.0.5-0ubuntu0~18.04.1 amd64 transitional dummy package
ii libgl1-mesa-glx:i386 18.0.5-0ubuntu0~18.04.1 i386 transitional dummy package
ii libglapi-mesa:amd64 18.0.5-0ubuntu0~18.04.1 amd64 free implementation of the GL API -- shared library
ii libglapi-mesa:i386 18.0.5-0ubuntu0~18.04.1 i386 free implementation of the GL API -- shared library
ii libgles2-mesa:amd64 18.0.5-0ubuntu0~18.04.1 amd64 transitional dummy package
ii libgles2-mesa-dev:amd64 18.0.5-0ubuntu0~18.04.1 amd64 free implementation of the OpenGL|ES 2.x API -- development files
ii libglu1-mesa:amd64 9.0.0-2.1build1 amd64 Mesa OpenGL utility library (GLU)
ii libglu1-mesa:i386 9.0.0-2.1build1 i386 Mesa OpenGL utility library (GLU)
ii libglu1-mesa-dev:amd64 9.0.0-2.1build1 amd64 Mesa OpenGL utility library -- development files
ii libglx-mesa0:amd64 18.0.5-0ubuntu0~18.04.1 amd64 free implementation of the OpenGL API -- GLX vendor library
ii libglx-mesa0:i386 18.0.5-0ubuntu0~18.04.1 i386 free implementation of the OpenGL API -- GLX vendor library
ii libosmesa6:amd64 18.0.5-0ubuntu0~18.04.1 amd64 Mesa Off-screen rendering extension
ii libosmesa6:i386 18.0.5-0ubuntu0~18.04.1 i386 Mesa Off-screen rendering extension
ii libwayland-egl1-mesa:amd64 18.0.5-0ubuntu0~18.04.1 amd64 implementation of the Wayland EGL platform -- runtime
ii mesa-common-dev:amd64 18.0.5-0ubuntu0~18.04.1 amd64 Developer documentation for Mesa
ii mesa-utils 8.4.0-1 amd64 Miscellaneous Mesa GL utilities
체인:
$ ls -l /usr/lib/x86_64-linux-gnu/libGL.so*
lrwxrwxrwx 1 root root 14 Jan 16 19:09 /usr/lib/x86_64-linux-gnu/libGL.so.1 -> libGL.so.1.0.0
-rw-r--r-- 1 root root 567624 Aug 15 12:20 /usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
답변1
나는 Nvidia 포럼에 질문하기로 결정했고 답변을 받았습니다. 나는 여기를 완전히 떠날 것이다철사그래서 누구나 주변의 모든 것을 이해할 수 있습니다.