linux noob here-将会感激任何帮助。
某些背景:
我试图在RHEL 6.5上从源代码构建程序,该程序的依赖项具体是:
我们已经在/ usr / libexec / gcc中安装了GCC 4.4.7,所以我们的linux人员在/ usr / local / libexec / gcc(版本4.9)中构建并安装了新版本
我们没有CMake,所以我从头开始安装unizipping / usr / local中的源并按照此处的说明进行操作: http://www.cmake.org/install/
./自举
使
make install
到目前为止一直很好,并且在CMake的CMakeOutput.log中它正确地指向了新的GCC路径,[COMPILER PATH = / usr / local / libexec / gcc /.../ 4.9.2 /
我必须将.so文件从/ usr / lib64复制到/ usr / local / lib64才能成功引导/制作它但我不认为这是我的来源问题
问题:
现在我遇到了麻烦:所以当我最终尝试使用" cmake构建此程序时。"
我遇到以下问题:
- C编译器标识是GNU 4.4.7
- 执行测试COMPILER_SUPPORTS_CXX11 - 失败
编译器标识应该是版本4.9并且测试应该已经成功但是它没有...
- 找不到ZLIB(缺少:ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
- 找不到PNG(缺少:PNG_LIBRARY PNG_PNG INCLUDE_ DIR)
Cmake在/usr/local/cmake-3.0.2/Modules中有FindPNG cmake模块文件,但它似乎不知道它在哪里,我试图将FindPNG.cmake文件复制到本地cmake该程序的目录,我一个接一个地不断丢失模块文件...
现在 - 我认为所有这些错误可能只是因为没有正确指向某些东西,可能没有为某些东西设置环境变量,在CMakeList文件中丢失或错误的CMake命令/变量或者其他什么,但我已经花了很多试图通过尝试不同的方法来修复它的时间量,但是无法弄明白......任何帮助都将非常感谢!!!
这是我尝试构建的程序的顶级CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
project(COLLADA2GLTF)
if (NOT WIN32)
#http://www.guyrutenberg.com/2014/01/05/enabling-c11-c0x-in-cmake/
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
message("-- C++11 Enabled")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
message("-- C++0x Enabled")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
endif()
set(USE_OPEN3DGC "ON")
set(WITH_IN_SOURCE_BUILD "ON")
set(COLLADA2GLTF_BINARY_DIR, COLLADA2GLTF_SOURCE_DIR)
set(BUILD_SHARED_LIBS "OFF")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp" @ONLY)
set(TARGET_LIBS GeneratedSaxParser_static OpenCOLLADABaseUtils_static UTF_static ftoa_static MathMLSolver_static OpenCOLLADASaxFrameworkLoader_static OpenCOLLADAFramework_static buffer_static)
if (NOT WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .so .a .dylib)
endif()
# Lets libxml2 work in a shared library
add_definitions(-DLIBXML_STATIC_FOR_DLL)
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ADD_DEFINITIONS(-fPIC)
ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
include_directories(${COLLADA2GLTF_SOURCE_DIR})
.......
include_directories(${COLLADA2GLTF_SOURCE_DIR}/dependencies/OpenCOLLADA/COLLADABaseUtils/include)
include_directories(${COLLADA2GLTF_SOURCE_DIR}/dependencies/OpenCOLLADA/COLLADASaxFrameworkLoader/include)
include_directories(${COLLADA2GLTF_SOURCE_DIR}/dependencies/OpenCOLLADA/GeneratedSaxParser/include)
if (WIN32)
include_directories(${COLLADA2GLTF_SOURCE_DIR}/dependencies/misc)
endif()
if (USE_OPEN3DGC)
add_definitions( -DUSE_OPEN3DGC )
include_directories(${COLLADA2GLTF_SOURCE_DIR}/extensions/o3dgc-compression)
include_directories(${COLLADA2GLTF_SOURCE_DIR}/dependencies/o3dgc/src)
include_directories(${COLLADA2GLTF_SOURCE_DIR}/dependencies/o3dgc/src/o3dgc_common_lib/inc)
include_directories(${COLLADA2GLTF_SOURCE_DIR}/dependencies/o3dgc/src/o3dgc_encode_lib/inc)
include_directories(${COLLADA2GLTF_SOURCE_DIR}/dependencies/o3dgc/src/o3dgc_decode_lib/inc)
endif()
find_package(PNG)
if (PNG_FOUND)
include_directories(${PNG_INCLUDE_DIR})
include_directories(${ZLIB_INCLUDE_DIR})
add_definitions(-DUSE_LIBPNG)
else()
message(WARNING "libpng or one of its dependencies couldn't be found. Transparency may not be correctly detected.")
endif()
link_directories(${COLLADA2GLTF_BINARY_DIR}/lib)
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DWIN32)
add_definitions(-EHsc)
endif()
add_subdirectory(dependencies/OpenCOLLADA)
if (USE_OPEN3DGC)
add_subdirectory(dependencies/o3dgc/src)
endif()
set(GLTF_SOURCES
COLLADA2GLTFWriter.h
COLLADA2GLTFWriter.cpp
......
assetModifiers/GLTFFlipUVModifier.cpp
${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp
GitSHA1.h)
if (USE_OPEN3DGC)
LIST(APPEND GLTF_SOURCES
extensions/o3dgc-compression/GLTF-Open3DGC.cpp
extensions/o3dgc-compression/GLTF-Open3DGC.h)
endif()
option(CONVERT_SHARED "CONVERT_SHARED" OFF)
if (CONVERT_SHARED)
add_library(collada2gltfConvert SHARED ${GLTF_SOURCES})
#Make sure the dll is in the same directory as the executable
if (WIN32)
set_target_properties(collada2gltfConvert PROPERTIES RUNTIME_OUTPUT_DIRECTORY "bin")
endif()
else()
add_library(collada2gltfConvert STATIC ${GLTF_SOURCES})
add_definitions(-DSTATIC_COLLADA2GLTF)
endif()
if (PNG_FOUND)
LIST(APPEND TARGET_LIBS ${PNG_LIBRARY} ${ZLIB_LIBRARY})
endif()
if (USE_OPEN3DGC)
LIST(APPEND TARGET_LIBS o3dgc_common_lib o3dgc_enc_lib o3dgc_dec_lib)
endif()
IF("${CMAKE_SYSTEM}" MATCHES "Linux")
LIST(APPEND TARGET_LIBS rt)
endif("${CMAKE_SYSTEM}" MATCHES "Linux")
target_link_libraries (collada2gltfConvert ${TARGET_LIBS})
set(GLTF_EXE_SOURCES main.cpp
${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp
GitSHA1.h)
if (WIN32)
LIST(APPEND GLTF_EXE_SOURCES ${COLLADA2GLTF_SOURCE_DIR}/dependencies/misc/getopt_long.c ${COLLADA2GLTF_SOURCE_DIR}/dependencies/misc/getopt.c ${COLLADA2GLTF_SOURCE_DIR}/dependencies/misc/getopt.h)
endif()
add_executable(collada2gltf ${GLTF_EXE_SOURCES})
target_link_libraries (collada2gltf collada2gltfConvert)
答案 0 :(得分:1)
我想你只是面对不满意的依赖问题。 RHEL / CentOS 6是一个相当古老的发行版,具有旧的内核和应用程序;由于向后兼容性的需要,它最近的版本与已弃用的软件包一起分发(就像你的情况一样)。那么你有什么重要的理由使用它吗?
我花了一年时间在我们开发RHEL 6.4下的软件的项目中,我建议你为自己设定一个不可能的目标:你需要在你的操作系统上安装不仅是编译器,还要安装所有的库(用于实例,实际的C ++标准库.so等)和标题。由于您的发行版中未提供这些版本,因此存在相同但不同的库会遇到困难。由于所有系统软件都依赖于旧库,因此操作可能会导致系统崩溃。
但是,如果您想继续,可以尝试使用这些命令安装缺少的依赖项ZLIB
和PNG
(仅提示):
yum install zlib-devel libpng-devel
但我肯定建议你节省时间并部署一些新的发行版:CentOS 7(如果你想要服务器)或Fedora 21(将发布tommorow)。