rodlie / qtfm

Qt File Manager
https://qtfm.eu
GNU General Public License v2.0
156 stars 43 forks source link

Build failure when enabling Magick++ due to leading -fopenmp cflag from pc file #161

Closed Earnestly closed 3 years ago

Earnestly commented 4 years ago

When attempting to build with cmake using the following:

CFLAGS+=" -fmacro-prefix-map=$PWD/=" cmake -DCMAKE_INSTALL_PREFIX=/usr \
   -DENABLE_MAGICK=ON \
   -DENABLE_FFMPEG=ON \
   -DENABLE_TRAY=OFF \
   -DENABLE_DBUS=OFF .

I get the following error:

/usr/bin/c++ -dM -E -c /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -D-fopenmp "-DAPP=\"qtfm\"" "-DAPP_NAME=\"QtFM\"" "-DAPP_VERSION=\"6.3.0\"" -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DNO_DBUS -DNO_UDISKS -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQtFM_EXPORTS -DWITH_FFMPEG -DWITH_MAGICK -I/tmp/makepkg/qtfm-git/src/qtfm -I/tmp/makepkg/qtfm-git/src/qtfm/libfm -I/tmp/makepkg/qtfm-git/src/qtfm/libfm/qtcopydialog -I/usr/include/ImageMagick-7 -I/usr/include/qt -I/usr/include/qt/QtCore -I/usr/lib/qt/mkspecs/linux-g++ -I/usr/include/qt/QtGui -I/usr/include/qt/QtWidgets -I/usr/include/qt/QtConcurrent -I/usr/include -I/usr/include/c++/9.3.0 -I/usr/include/c++/9.3.0/x86_64-pc-linux-gnu -I/usr/include/c++/9.3.0/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include-fixed

Output
------
<command-line>: error: macro names must be identifiers
...

This appears to be caused by the cmake command target_compile_definitions:

target_compile_definitions(QtFM PRIVATE ${MAGICK_CFLAGS_OTHER})

On my system pkg-config for this yeilds:

% pkg-config --cflags-only-other Magick++
-fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16

Cmake seems to be appending -D to -fopenmp causing the (fortunately harmless) error (due to the macro containing hyphens).

I'm not sure how to deal with this as I don't know cmake well enough to say.

rodlie commented 4 years ago

Will take a look when I get the time (I need to dedicate some hours to qtfm this week), do you get the same issue with qmake?

On Thu, Mar 19, 2020 at 4:22 PM Earnestly notifications@github.com wrote:

  • building: 6.1.6-rc1-224-gc073bfe

When attempting to build with cmake using the following:

CFLAGS+=" -fmacro-prefix-map=$PWD/=" cmake -DCMAKE_INSTALL_PREFIX=/usr \ -DENABLE_MAGICK=ON \ -DENABLE_FFMPEG=ON \ -DENABLE_TRAY=OFF \ -DENABLE_DBUS=OFF .

I get the following error:

/usr/bin/c++ -dM -E -c /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -D-fopenmp "-DAPP=\"qtfm\"" "-DAPP_NAME=\"QtFM\"" "-DAPP_VERSION=\"6.3.0\"" -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DNO_DBUS -DNO_UDISKS -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQtFM_EXPORTS -DWITH_FFMPEG -DWITH_MAGICK -I/tmp/makepkg/qtfm-git/src/qtfm -I/tmp/makepkg/qtfm-git/src/qtfm/libfm -I/tmp/makepkg/qtfm-git/src/qtfm/libfm/qtcopydialog -I/usr/include/ImageMagick-7 -I/usr/include/qt -I/usr/include/qt/QtCore -I/usr/lib/qt/mkspecs/linux-g++ -I/usr/include/qt/QtGui -I/usr/include/qt/QtWidgets -I/usr/include/qt/QtConcurrent -I/usr/include -I/usr/include/c++/9.3.0 -I/usr/include/c++/9.3.0/x86_64-pc-linux-gnu -I/usr/include/c++/9.3.0/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include-fixed

Output

: error: macro names must be identifiers ... This appears to be caused by the cmake command target_compile_definitions : target_compile_definitions(QtFM PRIVATE ${MAGICK_CFLAGS_OTHER}) On my system pkg-config for this yeilds: % pkg-config --cflags-only-other Magick++ -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 Cmake seems to be appending -D to D-fopenmp causing the (fortunately harmless) error (due to the macro containing hyphens). I'm not sure how to deal with this as I don't know cmake well enough to say. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or unsubscribe .
Earnestly commented 4 years ago

It seems with an equivalent build config qmake works without issue.