我正试图在Mac Os El Capitan上安装带有Qt5的CGAL 4.7。在构建目录中进行cmake之后,配置如下:
-- The CXX compiler identification is AppleClang 7.0.0.7000176
-- The C compiler identification is AppleClang 7.0.0.7000176
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
== Setting paths ==
-- Build CGAL from release in directory CGAL-4.7
-- Packagenames: CGAL-4.7
== Setting paths (DONE) ==
== Generate version files ==
-- CGAL_MAJOR_VERSION=4
-- CGAL_MINOR_VERSION=7
-- CGAL_BUGFIX_VERSION=0
-- CGAL_SONAME_VERSION=11
-- CGAL_SOVERSION =11.0.1
-- CGAL_REFERENCE_CACHE_DIR=
-- Building shared libraries
-- Targetting Unix Makefiles
-- Using /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ compiler.
-- DARWIN_VERSION=15
-- Mac Leopard detected
-- USING CMake version: 3.4.3
-- System: Darwin
== Generate version files (DONE) ==
== Set up flags ==
-- Build type: Release
-- USING CXXFLAGS = ' -O3 -DNDEBUG'
-- USING LDFLAGS = ' '
== Set up flags (DONE) ==
== Detect external libraries ==
-- External libraries supported: GMP;GMPXX;MPFR;ZLIB;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;Eigen3;BLAS;LAPACK;QGLViewer;ESBTL;Coin3D;NTL;IPE
-- Preconfiguring library: GMP ...
-- Found GMP: /usr/local/lib/libgmp.dylib
-- GMP has been preconfigured:
-- UseGMP-file:
-- GMP include: /usr/local/include
-- GMP libraries: /usr/local/lib/libgmp.dylib
-- GMP definitions:
-- USING GMP_VERSION = '6.1.0'
-- Preconfiguring library: MPFR ...
-- Found MPFR: /usr/local/lib/libmpfr.dylib
-- MPFR has been preconfigured:
-- UseMPFR-file:
-- MPFR include: /usr/local/include
-- MPFR libraries: /usr/local/lib/libmpfr.dylib
-- MPFR definitions:
-- USING MPFR_VERSION = '3.1.3'
-- Boost version: 1.60.0
-- Found the following Boost libraries:
-- thread
-- system
-- Boost include: /usr/local/include
-- Boost libraries: /usr/local/lib/libboost_thread-mt.dylib;/usr/local/lib/libboost_system-mt.dylib
-- Boost definitions:
-- USING BOOST_VERSION = '1.60.0'
== Detect external libraries (DONE) ==
== Write compiler_config.h ==
-- Performing Test CGAL_CFG_BOOST_VARIANT_SWAP_BUG - Success
-- Performing Test CGAL_CFG_DENORMALS_COMPILE_BUG - Success
-- Performing Test CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG - Success
-- Performing Test CGAL_CFG_IEEE_754_BUG - Success
-- Performing Test CGAL_CFG_ISTREAM_INT_BUG - Success
-- Performing Test CGAL_CFG_MATCHING_BUG_5 - Success
-- Performing Test CGAL_CFG_MATCHING_BUG_6 - Success
-- Performing Test CGAL_CFG_MATCHING_BUG_7 - Success
-- Performing Test CGAL_CFG_MATCHING_BUG_8 - Success
-- Performing Test CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG - Failed
-- Performing Test CGAL_CFG_NO_LIMITS - Success
-- Performing Test CGAL_CFG_NO_NEXTAFTER - Success
-- Performing Test CGAL_CFG_NO_STL - Success
-- Performing Test CGAL_CFG_NO_WARNING_CPP_DIRECTIVE_BUG - Success
-- Performing Test CGAL_CFG_NUMERIC_LIMITS_BUG - Success
-- Performing Test CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG - Success
-- Performing Test CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG - Success
-- Performing Test CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG - Success
-- Performing Test CGAL_CFG_USING_BASE_MEMBER_BUG_2 - Success
== Write compiler_config.h (DONE) ==
== Generating build files ==
Configuring libCGAL
-- Requested component: MPFR
-- Requested component: GMP
libCGAL is configured
-- Sources for CGAL component library 'CGAL_Core' detected
Configuring libCGAL_Core
-- Requested component: MPFR
-- Requested component: GMP
libCGAL_Core is configured
-- Sources for CGAL component library 'CGAL_ImageIO' detected
Configuring libCGAL_ImageIO
-- Found OpenGL: /System/Library/Frameworks/OpenGL.framework
-- Found ZLIB: /opt/local/lib/libz.dylib (found version "1.2.8")
-- OpenGL include: /System/Library/Frameworks/OpenGL.framework
-- OpenGL libraries: /System/Library/Frameworks/AGL.framework;/System/Library/Frameworks/OpenGL.framework
-- USING ZLIB_VERSION = '1.2.8'
-- Requested component: MPFR
-- Requested component: GMP
libCGAL_ImageIO is configured
-- Sources for CGAL component library 'CGAL_Qt3' detected
-- Sources for CGAL component library 'CGAL_Qt5' detected
Configuring libCGAL_Qt5
-- libCGAL_Qt5 is missing the dependencies: Qt5OpenGL Qt5Svg Qt5 cannot be configured.
-- Sources for CGAL component libraries 'CGAL_Core;CGAL_ImageIO;CGAL_Qt3;CGAL_Qt5' detected
== Generating build files (DONE) ==
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/pratyuze/Libraries/CGAL-4.7/build
接下来,我通过ccmake将其指向Qt5安装的正确位置,然后进行制作。这会产生以下输出:
Scanning dependencies of target CGAL
[ 4%] Building CXX object src/CGAL/CMakeFiles/CGAL.dir/all_files.cpp.o
[ 8%] Linking CXX shared library ../../lib/libCGAL.dylib
[ 8%] Built target CGAL
Scanning dependencies of target CGAL_Core
[ 12%] Building CXX object src/CGAL_Core/CMakeFiles/CGAL_Core.dir/all_files.cpp.o
[ 16%] Linking CXX shared library ../../lib/libCGAL_Core.dylib
[ 16%] Built target CGAL_Core
Scanning dependencies of target CGAL_ImageIO
[ 20%] Building CXX object src/CGAL_ImageIO/CMakeFiles/CGAL_ImageIO.dir/all_files.cpp.o
[ 25%] Linking CXX shared library ../../lib/libCGAL_ImageIO.dylib
[ 25%] Built target CGAL_ImageIO
[ 29%] Generating qrc_Triangulation_2.cpp
[ 33%] Generating __/__/include/CGAL/Qt/moc_GraphicsViewNavigation.cpp
[ 37%] Generating __/__/include/CGAL/Qt/moc_DemosMainWindow.cpp
[ 41%] Generating __/__/include/CGAL/Qt/moc_GraphicsItem.cpp
[ 45%] Generating __/__/include/CGAL/Qt/moc_GraphicsViewInput.cpp
[ 50%] Generating qrc_CGAL.cpp
[ 54%] Generating qrc_Input.cpp
[ 58%] Generating qrc_File.cpp
Scanning dependencies of target CGAL_Qt5
[ 62%] Building CXX object src/CGAL_Qt5/CMakeFiles/CGAL_Qt5.dir/all_files.cpp.o
In file included from /Users/pratyuze/Libraries/CGAL-4.7/build/src/CGAL_Qt5/all_files.cpp:1:
In file included from /Users/pratyuze/Libraries/CGAL-4.7/src/CGAL_Qt5/debug.cpp:22:
In file included from /Users/pratyuze/Libraries/CGAL-4.7/src/CGAL_Qt5/../../include/CGAL/Qt/debug.h:28:
In file included from /Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/QString:1:
In file included from /Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:43:
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qrefcount.h:48:22: error: expected ';' at end of declaration list
inline bool ref() Q_DECL_NOTHROW {
^
In file included from /Users/pratyuze/Libraries/CGAL-4.7/build/src/CGAL_Qt5/all_files.cpp:1:
In file included from /Users/pratyuze/Libraries/CGAL-4.7/src/CGAL_Qt5/debug.cpp:22:
In file included from /Users/pratyuze/Libraries/CGAL-4.7/src/CGAL_Qt5/../../include/CGAL/Qt/debug.h:28:
In file included from /Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/QString:1:
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:65:1: error: unknown type name 'Q_FORWARD_DECLARE_CF_TYPE'
Q_FORWARD_DECLARE_CF_TYPE(CFString);
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:86:44: error: expected ';' at end of declaration list
Q_DECL_CONSTEXPR inline QLatin1String() Q_DECL_NOTHROW : m_size(0), m_data(Q_NULLPTR) {}
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:96:51: error: expected ';' at end of declaration list
inline bool operator!=(const QString &s) const Q_DECL_NOTHROW;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:97:50: error: expected ';' at end of declaration list
inline bool operator>(const QString &s) const Q_DECL_NOTHROW;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:98:50: error: expected ';' at end of declaration list
inline bool operator<(const QString &s) const Q_DECL_NOTHROW;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:99:51: error: expected ';' at end of declaration list
inline bool operator>=(const QString &s) const Q_DECL_NOTHROW;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:100:51: error: expected ';' at end of declaration list
inline bool operator<=(const QString &s) const Q_DECL_NOTHROW;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:128:9: error: unknown type name 'QTypedArrayData'
typedef QTypedArrayData<ushort> QStringData;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:128:24: error: expected unqualified-id
typedef QTypedArrayData<ushort> QStringData;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:154:1: error: C++ requires a type specifier for all declarations
Q_STATIC_ASSERT_X(sizeof(qunicodechar) == 2,
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:195:5: error: unknown type name 'QArrayData'
QArrayData str;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:198:5: error: unknown type name 'QStringData'
QStringData *data_ptr() const
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:201:27: error: unknown type name 'QStringData'
return const_cast<QStringData *>(static_cast<const QStringData*>(&str));
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:201:60: error: unknown type name 'QStringData'
return const_cast<QStringData *>(static_cast<const QStringData*>(&str));
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:207:5: error: unknown type name 'QStringData'; did you mean 'QStringDataPtr'?
QStringData *ptr;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:205:8: note: 'QStringDataPtr' declared here
struct QStringDataPtr
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:213:13: error: unknown type name 'QStringData'; did you mean 'QStringDataPtr'?
typedef QStringData Data;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:205:8: note: 'QStringDataPtr' declared here
struct QStringDataPtr
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:215:21: error: expected ';' at end of declaration list
inline QString() Q_DECL_NOTHROW;
^
/Users/pratyuze/Softwares/qt5/qtbase/lib/QtCore.framework/Headers/qstring.h:220:36: error: expected ';' at end of declaration list
inline QString(const QString &) Q_DECL_NOTHROW;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [src/CGAL_Qt5/CMakeFiles/CGAL_Qt5.dir/all_files.cpp.o] Error 1
make[1]: *** [src/CGAL_Qt5/CMakeFiles/CGAL_Qt5.dir/all] Error 2
make: *** [all] Error 2
我们将非常感谢任何关于为什么会发生这种情况的帮助。我的感觉是这是由于我使用的编译器,因为当我试图在linux机器上安装它时,它不会出现故障。
问候
Pratyush
您可以尝试:
我从这个链接中获取的cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix qt5)
。