ERROR:'S_IFLINK'未声明(首次在此函数中使用)
Building C object Utilities/vtkhdf5/src/CMakeFiles/vtkhdf5.dir/H5F.c.o
/build/src/VTK/Utilities/vtkhdf5/src/H5F.c: In function 'H5F_build_actual_name':
/build/src/VTK/Utilities/vtkhdf5/src/H5F.c:2224:12: error: 'S_IFLNK' undeclared (first use in this function)
百度搜索了一番,按照“ubuntu16.04 源码编译安装vtk5.8.0ERROR” 的说明,无法解决问题。不过参照其中的指导思想,参照vtk-5.10.1版本中的 Utilities\vtkhdf5\ConfigureChecks.cmake内容,将vtk-5.8.0中的 Utilities\vtkhdf5\ConfigureChecks.cmake对应内容:
SET (LINUX_LFS 0)
IF (CMAKE_SYSTEM MATCHES "Linux-([3-9]\\.[0-9]|2\\.[4-9])\\.")
# Linux Specific flags
ADD_DEFINITIONS (-D_POSIX_SOURCE -D_BSD_SOURCE)
OPTION (HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
IF (HDF5_ENABLE_LARGE_FILE)
SET (LARGEFILE 1)
ENDIF (HDF5_ENABLE_LARGE_FILE)
ENDIF (CMAKE_SYSTEM MATCHES "Linux-([3-9]\\.[0-9]|2\\.[4-9])\\.")
SET (HDF5_EXTRA_FLAGS)
IF (LINUX_LFS)
SET (HDF5_EXTRA_FLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
SET (CMAKE_REQUIRED_DEFINITIONS ${HDF5_EXTRA_FLAGS})
ENDIF (LINUX_LFS)
ADD_DEFINITIONS (${HDF5_EXTRA_FLAGS})
修改为:
SET (LINUX_LFS 0)
IF (CMAKE_SYSTEM MATCHES "Linux")
# Linux Specific flags
ADD_DEFINITIONS (-D_POSIX_SOURCE -D_BSD_SOURCE)
OPTION (HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
IF (HDF5_ENABLE_LARGE_FILE)
SET (LARGEFILE 1)
ENDIF (HDF5_ENABLE_LARGE_FILE)
ENDIF (CMAKE_SYSTEM MATCHES "Linux")
SET (HDF5_EXTRA_FLAGS)
IF (LINUX_LFS)
SET (HDF5_EXTRA_FLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
SET (CMAKE_REQUIRED_DEFINITIONS ${HDF5_EXTRA_FLAGS})
ENDIF (LINUX_LFS)
ADD_DEFINITIONS (${HDF5_EXTRA_FLAGS})
然后,重新编译,执行:make
[ 68%] Building CXX object Rendering/CMakeFiles/vtkRendering.dir/vtkXOpenGLRenderWindow.cxx.o
In file included from /usr/include/GL/glx.h:333:0,
from /home/user1/Downloads/vtk-5.8.0/Rendering/vtkXOpenGLRenderWindow.cxx:31:
/usr/include/GL/glxext.h:480:143: error: ‘GLintptr’ has not been declared
typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
网上搜到的Ubuntu 16.04中解决方法:取消如下内容所在行的注释:
// #define GLX_GLXENT_LEGACY
但是在CenOS 7中没有效果,照样报错。
CentOS 7中的解决办法:
切换到root用户下, gedit /usr/local/include/GL/glxext.h
在打开的文件第479行,添加如下2句:
typedef ptrdiff_t GLsizeiptr;
typedef ptrdiff_t GLintptr;
保存,关闭。
再次编译:make
文章来源:https://www.toymoban.com/news/detail-781637.html
100% 编译成功。文章来源地址https://www.toymoban.com/news/detail-781637.html
到了这里,关于CentOS-7.3编译VTK-5.8.0,报错:ERROR:‘S_IFLINK‘未声明(首次在此函数中使用)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!