2017-01-17 1 views
0

우분투 14.04를 찾을 수 없음, GLFW 3.2.1, OpenGL은 내가 OpenGL을 예 http://antongerdelan.net/opengl/hellotriangle.html 에서 발견 된 "안녕하세요 삼각형"을 구축을 위해 노력하고 367.57은 CMake, GLFW : X11는 포함하지만 'XConvertSelection가'

NVIDIA를 4.5.0 그러나 나는 곤경에 처해있다. GLFW 소스를 다운로드하고 소스를 빌드하고 추가 플래그 또는 옵션없이 설치했습니다.

다음은 GLFW 및 SO 답변에서 모두 조합 된 Hello Triangle 용 파일 src/CMakeLists.txt입니다. 조금 순서를 연결 씨름 한 후, 빌드 프로세스는 나에게 하나의 오류 제공 :

/usr/bin/ld: //usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection' /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libX11.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status

XConvertSelection는 X11에서 온 나타납니다하지만, 아래 그림과 같이 I는 포함 X11에 연결 한 . X11이 포함되어 있고 링크되어 있다면이 항목을 찾을 수없는 이유는 무엇입니까?

===의 SRC/CMakeLists.txt의 ===

# SOURCE CMAKELISTS 

cmake_minimum_required(VERSION 2.6) 
project(HelloTriangle) 

# ~ Special Libraries ~ 

# First you need to find the PkgConfig package. If this fails, you may need to install the pkg-config package for your distribution. 
find_package(PkgConfig REQUIRED) 

find_package(X11 REQUIRED) 
if(NOT X11_FOUND) 
    message("ERROR: x11 not found") 
endif(NOT X11_FOUND) 

# Note that the dependencies do not include OpenGL or GLU, as GLFW loads any OpenGL, OpenGL ES or Vulkan libraries it needs at runtime and does not use GLU. If your application calls OpenGL directly, instead of using a modern extension loader library you can find it by requiring the OpenGL package. 
find_package(OpenGL REQUIRED) 
if(NOT OPENGL_FOUND) 
    message("ERROR: OpenGL not found") 
endif(NOT OPENGL_FOUND) 

# With just a few changes to your CMakeLists.txt, you can locate the package and target files generated when GLFW is installed. 
find_package(glfw3 3.2 REQUIRED) 

# This creates the CMake commands to find pkg-config packages. Then you need to find the GLFW package. 
pkg_search_module(GLFW REQUIRED glfw3) 

include_directories(${X11_INCLUDE_DIR}) 

# This creates the CMake variables you need to use GLFW. To be able to include the GLFW header, you need to tell your compiler where it is. 
include_directories(${GLFW_INCLUDE_DIRS}) 

# After everything is included, add the executable so that we can link 
add_executable(HelloTriangle hello_triangle.cpp) 

target_link_libraries(HelloTriangle ${X11_LIBRARIES}) 

# Seems like a similar issue: http://stackoverflow.com/questions/14772681/c-compile-error-when-includeing-irrlicht-static-lib 
target_link_libraries(HelloTriangle /usr/lib/x86_64-linux-gnu/libX11.so) 
target_link_libraries(HelloTriangle /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1) 
# target_link_libraries(HelloTriangle /usr/lib/x86_64-linux-gnu/libXxf86vm.so) 

# If OpenGL is found, the OPENGL_FOUND variable is true and the OPENGL_INCLUDE_DIR and OPENGL_gl_LIBRARY cache variables can be used. 
target_include_directories(HelloTriangle PUBLIC ${OPENGL_INCLUDE_DIR}) 

target_link_libraries(HelloTriangle ${OPENGL_gl_LIBRARY}) 

target_link_libraries(HelloTriangle ${GL_LIBRARY}) 

# The OpenGL CMake package also looks for GLU. If GLU is found, the OPENGL_GLU_FOUND variable is true and the OPENGL_INCLUDE_DIR and OPENGL_glu_LIBRARY cache variables can be used. 
target_link_libraries(HelloTriangle ${OPENGL_glu_LIBRARY}) 

# You also need to link against the correct libraries. If you are using the shared library version of GLFW, use the GLFW_LIBRARIES variable. 
target_link_libraries(HelloTriangle ${GLFW_LIBRARIES}) # DYNAMIC: Does not find: XConvertSelection 
# If you are using the static library version of GLFW, use the GLFW_STATIC_LIBRARIES variable instead. 
# target_link_libraries(HelloTriangle ${GLFW_STATIC_LIBRARIES}) # STATIC: Does not find: glewExperimental , glewInit 
+1

'DSO가 명령 줄에서 누락되었습니다. '라는 말은 링크 **의 잘못된 라이브러리 순서를 의미합니다. 출력 결과에 따르면 * GLFW * 라이브러리는 * X11 * 라이브러리의 일부 기호를 사용하므로 * GLFW * **를 ** * X11 * 앞에 연결해야합니다. – Tsyvarev

+0

@Tsyvarev,'XConvertSelection' 오류는 없지만 이제는'dlclose @@ GLIBC_2.2.5'라는 기호를 찾을 수 없습니다. 'VERBOSE = 1'을 사용하는 경우에도'make '결과에 따라 누락 된 부분을 해결하는 것은 매우 어렵습니다. – SquareCrow

+0

'dlclose @@ GLIBC_2.2.5' 문제는 으로 해결되었습니다. http://stackoverflow.com/questions/23171894/cant-compile-easy-source-in-c-and-opengl-glfw-in-linux-in -netbeans – SquareCrow

답변

0

SO에 더욱 파고 몇 시간 위해 연결 레슬링 후, 다음 가지고

= == SRC/CMakeLists.txt의 ===

# SOURCE CMAKELISTS 

cmake_minimum_required(VERSION 2.6) 
project(HelloTriangle) 

# ~ Special Libraries ~ 
find_package(PkgConfig REQUIRED) # First you need to find the PkgConfig package 

find_package(X11 REQUIRED) # Make sure x is there 
if(NOT X11_FOUND) 
    message("ERROR: x11 not found") 
endif(NOT X11_FOUND) 

find_package(OpenGL REQUIRED) # Make sure OpenGL is available for direct calls 
if(NOT OPENGL_FOUND) 
    message("ERROR: OpenGL not found") 
endif(NOT OPENGL_FOUND) 

find_package(glfw3 3.2 REQUIRED) # locate the package and target files generated when GLFW is installed. 

pkg_search_module(GLFW REQUIRED glfw3) # CMake commands to find pkg-config packages 

include_directories(${GLFW_INCLUDE_DIRS}) # creates the CMake variables you need to use GLFW. 
include_directories(${X11_INCLUDE_DIR}) # Get all the x stuff 

add_executable(HelloTriangle hello_triangle.cpp) # After everything is included, add the executable 

target_include_directories(HelloTriangle PUBLIC ${OPENGL_INCLUDE_DIR}) # Obviously 

target_link_libraries(HelloTriangle ${GLFW_LIBRARIES}) # If using the shared library, GLFW_LIBRARIES 
# target_link_libraries(HelloTriangle ${GLFW_STATIC_LIBRARIES}) # If using the static library, GLFW_STATIC_LIBRARIES 
target_link_libraries(HelloTriangle ${OPENGL_gl_LIBRARY}) # More OpenGL stuff I guess? 
target_link_libraries(HelloTriangle ${GL_LIBRARY}) 
target_link_libraries(HelloTriangle ${OPENGL_glu_LIBRARY}) # The OpenGL CMake package also looks for GLU. 
# http://stackoverflow.com/questions/23171894/cant-compile-easy-source-in-c-and-opengl-glfw-in-linux-in-netbeans 
target_link_libraries(HelloTriangle GLEW m dl Xinerama Xrandr Xi Xcursor pthread) # GLFW misses this stuff! 
# Seems like a similar issue: http://stackoverflow.com/questions/14772681/c-compile-error-when-includeing-irrlicht-static-lib 
target_link_libraries(HelloTriangle /usr/lib/x86_64-linux-gnu/libX11.so) # x11 linking misses this stuff! 
target_link_libraries(HelloTriangle /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1) 
target_link_libraries(HelloTriangle ${X11_LIBRARIES}) # x11 ! 

이 정확한 설치는 린에 보편적하지 않을 수 있습니다 ux 시스템을 사용했지만 누군가가 성공적인 연결 순서를 찾는데 도움이 될 것이라고 생각했습니다.