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
100% 编译成功。
猜你喜欢
网友评论
- 搜索
- 最新文章
- 热门文章