Cmake和make,错误编译scribus

时间:2013-04-10 12:53:44

标签: makefile cmake qmake

我在尝试编译Scribus 1.5 svn时总是发现错误。我尝试了Qt4和Qt5,但错误似乎并不依赖于它们。

这是cmake输出:

cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/fabio/scribusinstall .. -DUSE_QT5=1 -DQT_PREFIX="/opt/qt5/bin"
-- Shared Library Flags: 
-- Scribus 1.5.0.svn will be built to install into /home/fabio/scribusinstall
-- Machine: x86_64-linux-gnu, void pointer size: 8
-- Found target X86
-- Found target X86_64
-- Building for target x86_64-linux-gnu
-- Using standard ApplicationDataDir. You can change it with -DAPPLICATION_DATA_DIR
-- ----- USE QT 5-----
-- ----- USE QT Widgets-----
-- ----- USE Qt5Gui -----
-- ----- USE QT 5 XML -----
-- ----- USE Qt5WebKit -----
-- ----- USE Qt5WebKitWidgets -----
-- ----- USE Qt5Network -----
-- ----- USE Qt5OpenGL -----
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so  
ZLIB Library Found OK
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so  
Using PNG Library: /usr/lib/x86_64-linux-gnu/libpng.so
PNG Library Found OK
OSG found OK
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so  
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so  
JPEG Library Found OK
-- Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so  
TIFF Library Found OK
-- Found PythonLibs: /usr/lib/libpython2.7.so (found suitable version "2.7.3", required is "2") 
Python Library Found OK
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.4.8") 
-- FreeType2 Library Found OK
-- Looking for FT_Get_First_Char in /usr/lib/x86_64-linux-gnu/libfreetype.so
-- Looking for FT_Get_First_Char in /usr/lib/x86_64-linux-gnu/libfreetype.so - found
-- Looking for FT_Get_Next_Char in /usr/lib/x86_64-linux-gnu/libfreetype.so
-- Looking for FT_Get_Next_Char in /usr/lib/x86_64-linux-gnu/libfreetype.so - found
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- checking for one of the modules 'libcairo>=1.2.0;cairo>=1.2.0'
CAIRO Library Found OK
-- Found Cups: /usr/lib/x86_64-linux-gnu/libcups.so (found version "1.5.3") 
CUPS Library Found OK
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.7.8") 
LIBXML2 Library Found OK
LCMS ReleaseLibrary: /usr/lib/x86_64-linux-gnu/liblcms.so
LCMS Debug Library: LCMS_LIBRARY_DEBUG-NOTFOUND
LCMS Library: /usr/lib/x86_64-linux-gnu/liblcms.so
LCMS 2 ReleaseLibrary: LCMS2_LIBRARY_RELEASE-NOTFOUND
LCMS 2 Debug Library: LCMS2_LIBRARY_DEBUG-NOTFOUND
LCMS 2 Library: LCMS2_LIBRARY_RELEASE-NOTFOUND
LCMS ReleaseLibrary: /usr/lib/x86_64-linux-gnu/liblcms.so
LCMS Debug Library: LCMS_LIBRARY_DEBUG-NOTFOUND
LCMS Library: /usr/lib/x86_64-linux-gnu/liblcms.so
LittleCMS Library Found OK
-- checking for one of the modules 'fontconfig'
FontConfig Found OK
-- Could NOT find HUNSPELL (missing:  HUNSPELL_LIBRARIES HUNSPELL_INCLUDE_DIR) 
Hunspell or its developer libraries NOT found - Disabling support for spell checking
PoDoFo found OK
-- Boost version: 1.46.1
Boost Library Found OK
Building without GraphicksMagick (use -DWANT_GRAPHICSMAGICK=1 to enable)
-- checking for one of the modules 'libpoppler>=0.19.0;poppler>=0.19.0'
-- Found poppler
-- Found poppler libs: /usr/lib/x86_64-linux-gnu/libpoppler.so
-- Found poppler includes: /usr/include/poppler
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for include file endian.h
-- Looking for include file endian.h - found
-- Looking for include file fcntl.h
-- Looking for include file fcntl.h - found
RPATH: lib/scribus/plugins/;
-- Qt5::CoreQt5::WidgetsQt5::GuiQt5::XmlQt5::WebKitQt5::WebKitWidgetsQt5::NetworkQt5::OpenGL/usr/lib/x86_64-linux-gnu/libxml2.so/usr/lib/x86_64-linux-gnu/libz.so
-- Building with Scripter 1
-- Source header files will be installed
-- /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/resources/translations/po
-- The following GUI languages will be installed: 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir
然后我做了:

cd ..
make
Scanning dependencies of target scribus_pgf_lib
[  0%] Building CXX object scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/Decoder.cpp.o
<command-line>:0:1: error: macro names must be identifiers
/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/scribus/third_party/pgf/Decoder.cpp:583:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
make[2]: *** [scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/Decoder.cpp.o] Errore 1
make[1]: *** [scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/all] Errore 2
make: *** [all] Errore 2

它似乎不是一个依赖性问题,因为我在Ubuntu Precise(Linux Mint 13)中使用apt-get build-dep命令安装它们。可能是什么问题,我该如何解决?

非常感谢你!

编辑添加make VERBOSE = 1

fabio@fabio-EasyNote-TS11HR ~/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir $ make VERBOSE=1/usr/bin/cmake -H/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810 -B/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/CMakeFiles /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: ingresso nella directory "/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir"
make -f scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/build.make scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/depend
make[2]: ingresso nella directory "/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir"
cd /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810 /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/scribus/third_party/pgf /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/scribus/third_party/pgf /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/DependInfo.cmake --color=
make[2]: uscita dalla directory "/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir"
make -f scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/build.make scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/build
make[2]: ingresso nella directory "/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir"
/usr/bin/cmake -E cmake_progress_report /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/CMakeFiles 
[  0%] Building CXX object scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/Decoder.cpp.o
cd /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/scribus/third_party/pgf && /usr/bin/c++   -DNDEBUG -DQT_CORE_LIB -DQT_WIDGETS_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_WEBKITWIDGETS_LIB -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_LOCATION_LIB -DQT_SENSORS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_OPENGL_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DUSE_QT5 -DHAVE_DLFCN_H -DHAVE_UNISTD_H -DHAVE_CONFIG_H -O2 -Wall -fPIC -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/scribus/third_party/pgf -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/scribus/third_party/pgf -I/opt/qt5/include -I/opt/qt5/include/QtCore -I/opt/qt5/mkspecs/default -I/opt/qt5/include/QtWidgets -I/opt/qt5/include/QtGui -I/opt/qt5/include/QtXml -I/opt/qt5/include/QtWebKit -I/opt/qt5/include/QtOpenGL -I/opt/qt5/include/QtNetwork -I/usr/include/qt5 -I/usr/include/qt5/QtWebKitWidgets -I/usr/include/qt5/QtQuick -I/usr/include/qt5/QtQml -I/usr/include/qt5/QtPrintSupport -I/usr/include/qt5/QtLocation -I/usr/include/qt5/QtSensors -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/scribus -I/usr/include/libxml2 -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810 -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/scribus    -DSHAREDIR=\"/home/fabio/scribusinstall/share/scribus/\" -DDOCDIR=\"/home/fabio/scribusinstall/share/doc/scribus/\" -DICONDIR=\"/home/fabio/scribusinstall/share/scribus/icons/\" -DSAMPLESDIR=\"/home/fabio/scribusinstall/share/scribus/samples/\" -DSCRIPTSDIR=\"/home/fabio/scribusinstall/share/scribus/scripts/\" -DTEMPLATEDIR=\"/home/fabio/scribusinstall/share/scribus/templates/\" -DDESKTOPDIR=\"/home/fabio/scribusinstall/share/applications/\" -DLIBDIR=\"/home/fabio/scribusinstall/lib/scribus/\" -DPLUGINDIR=\"/home/fabio/scribusinstall/lib/scribus/plugins/\" -D -D -DCOMPILE_SCRIBUS_MAIN_APP -o CMakeFiles/scribus_pgf_lib.dir/Decoder.cpp.o -c /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/scribus/third_party/pgf/Decoder.cpp
<command-line>:0:1: error: macro names must be identifiers
/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/scribus/third_party/pgf/Decoder.cpp:583:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
make[2]: *** [scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/Decoder.cpp.o] Errore 1
make[2]: uscita dalla directory "/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir"
make[1]: *** [scribus/third_party/pgf/CMakeFiles/scribus_pgf_lib.dir/all] Errore 2
make[1]: uscita dalla directory "/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir"
make: *** [all] Errore 2

以下只有两个&#34; -D&#34; Makefile中的定义:

# Special rule for the target install/local
install/local: preinstall
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
    /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local


# Special rule for the target install/strip
install/strip: preinstall
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
    /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip

1 个答案:

答案 0 :(得分:2)

你可以从你得到的错误开始:

<command-line>:0:1: error: macro names must be identifiers

<command-line>:0:1表明错误不是来自.cpp文件,而是来自传递给编译器的选项。由于您生成了Makefile并使用make调用它,这意味着生成的Makefile不稳定。

现在,error: macro names must be identifiers可能意味着Makefile尝试使用选项-D创建一个与正确的预处理标识符不对应的宏。例如,如果键入:

g++ foobar.cpp -D1

您将得到完全相同的错误,因为1不是有效的标识符(有效标识符只包含字母,数字和下划线;第一个字符不能是数字)。我无法使用您拥有的内容进行更多推断,但您可以执行的操作是在Makefile搜索无效的-D选项,尝试查找CMakeLists.txt的哪个部分可能已生成这个选项。

-D的宏定义通常使用以下命令add_definitions从cmake文件定义。例如,我可以通过将此行添加到cmake来传递我容易出错的-D1选项:

add_definitions(-D1)

希望您能设法找出错误原因。

编辑:错误出现在这个巨大的界限中:

cd /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/scribus/third_party/pgf && /usr/bin/c++   -DNDEBUG -DQT_CORE_LIB -DQT_WIDGETS_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_WEBKITWIDGETS_LIB -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_LOCATION_LIB -DQT_SENSORS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_OPENGL_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DUSE_QT5 -DHAVE_DLFCN_H -DHAVE_UNISTD_H -DHAVE_CONFIG_H -O2 -Wall -fPIC -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/scribus/third_party/pgf -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/scribus/third_party/pgf -I/opt/qt5/include -I/opt/qt5/include/QtCore -I/opt/qt5/mkspecs/default -I/opt/qt5/include/QtWidgets -I/opt/qt5/include/QtGui -I/opt/qt5/include/QtXml -I/opt/qt5/include/QtWebKit -I/opt/qt5/include/QtOpenGL -I/opt/qt5/include/QtNetwork -I/usr/include/qt5 -I/usr/include/qt5/QtWebKitWidgets -I/usr/include/qt5/QtQuick -I/usr/include/qt5/QtQml -I/usr/include/qt5/QtPrintSupport -I/usr/include/qt5/QtLocation -I/usr/include/qt5/QtSensors -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/builddir/scribus -I/usr/include/libxml2 -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810 -I/home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/scribus    -DSHAREDIR=\"/home/fabio/scribusinstall/share/scribus/\" -DDOCDIR=\"/home/fabio/scribusinstall/share/doc/scribus/\" -DICONDIR=\"/home/fabio/scribusinstall/share/scribus/icons/\" -DSAMPLESDIR=\"/home/fabio/scribusinstall/share/scribus/samples/\" -DSCRIPTSDIR=\"/home/fabio/scribusinstall/share/scribus/scripts/\" -DTEMPLATEDIR=\"/home/fabio/scribusinstall/share/scribus/templates/\" -DDESKTOPDIR=\"/home/fabio/scribusinstall/share/applications/\" -DLIBDIR=\"/home/fabio/scribusinstall/lib/scribus/\" -DPLUGINDIR=\"/home/fabio/scribusinstall/lib/scribus/plugins/\" -D -D -DCOMPILE_SCRIBUS_MAIN_APP -o CMakeFiles/scribus_pgf_lib.dir/Decoder.cpp.o -c /home/fabio/ScribusSVN/scribus-trunk-1.5.0svn201304091810/scribus/third_party/pgf/Decoder.cpp

在该行的中间,有一些选项-D -D会触发您的实际错误。现在,问题是找到生成此命令行的内容以及如何纠正此问题:)