Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build due to invalid g-ir-scanner option #524

Closed
cuihaoleo opened this issue Feb 1, 2024 · 5 comments
Closed

Failed to build due to invalid g-ir-scanner option #524

cuihaoleo opened this issue Feb 1, 2024 · 5 comments

Comments

@cuihaoleo
Copy link

Describe the bug
Git version failed to build on Arch Linux, due to invalid g-ir-scanner option.

To Reproduce

$ mkdir build && cd build
$ cmake ..
$ make

will fail with:

[ 72%] Built target workrave-gtk4-private-1.0
[ 73%] Generating Workrave-2.0.gir
Usage: g-ir-scanner [options] sources

g-ir-scanner: error: no such option: -m
make[2]: *** [ui/applets/common/src/CMakeFiles/gir-girs.dir/build.make:90: ui/applets/common/src/Workrave-2.0.gir] Error 2
make[1]: *** [CMakeFiles/Makefile2:1751: ui/applets/common/src/CMakeFiles/gir-girs.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Expected behavior
It builds.

Linux (please complete the following information in case you encountered the bug on Linux):

  • Distribution: Arch Linux
  • Distribution Version: rolling, latest
  • Desktop Environment: KDE
  • Workrave Version: Git HEAD (bc8ca1a)

Additional context

It seems the problematic options came from GTK relevant CFLAGS:

$ rg fpmath=sse
CMakeCache.txt
1624:GTK4_CFLAGS:INTERNAL=-I/usr/include/gtk-4.0;-I/usr/include/pango-1.0;-I/usr/include/gdk-pixbuf-2.0;-I/usr/include/cairo;-I/usr/include/harfbuzz;-I/usr/include/freetype2;-I/usr/include;-I/usr/include/graphene-1.0;-I/usr/lib/graphene-1.0/include;-mfpmath=sse;-msse;-msse2;-I/usr/include/glib-2.0;-I/usr/lib/glib-2.0/include;-I/usr/include/fribidi;-I/usr/include/libpng16;-I/usr/include/pixman-1;-I/usr/include/libmount;-I/usr/include/blkid;-I/usr/include/sysprof-6;-pthread
1626:GTK4_CFLAGS_OTHER:INTERNAL=-mfpmath=sse;-msse;-msse2;-pthread
1641:GTK4_STATIC_CFLAGS:INTERNAL=-I/usr/include/gtk-4.0;-I/usr/include/pango-1.0;-I/usr/include/gdk-pixbuf-2.0;-I/usr/include/cairo;-I/usr/include/harfbuzz;-I/usr/include/freetype2;-I/usr/include;-I/usr/include/graphene-1.0;-I/usr/lib/graphene-1.0/include;-mfpmath=sse;-msse;-msse2;-I/usr/include/glib-2.0;-I/usr/lib/glib-2.0/include;-I/usr/include/fribidi;-I/usr/include/libpng16;-I/usr/include/pixman-1;-I/usr/include/libmount;-I/usr/include/blkid;-I/usr/include/sysprof-6;-pthread;-DLZMA_API_STATIC
1643:GTK4_STATIC_CFLAGS_OTHER:INTERNAL=-mfpmath=sse;-msse;-msse2;-pthread;-DLZMA_API_STATIC

ui/applets/common/src/CMakeFiles/gir-typelibs.dir/build.make
98:     cd /home/cuihao/dev/aur/workrave/workrave-git/build/ui/applets/common/src && /usr/bin/g-ir-scanner --add-include-path=/home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src --add-include-path=/home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/include --warn-all --namespace=Workrave --nsversion=2.0 --no-libtool --library=workrave-gtk4-private-1.0 --include=GObject-2.0 --include=Gtk-4.0 --include=cairo-1.0 -I/usr/include/gtk-4.0 -I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include -I/usr/include/graphene-1.0 -I/usr/lib/graphene-1.0/include -mfpmath=sse -msse -msse2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/fribidi -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -pthread -I/home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/include /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/control.c /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/timebar.c /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/timerbox.c /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/utils.c /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/../include/timerbox.h /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/../include/timebar.h --output /home/cuihao/dev/aur/workrave/workrave-git/build/ui/applets/common/src/Workrave-2.0.gir

ui/applets/common/src/CMakeFiles/gir-girs.dir/build.make
90:     cd /home/cuihao/dev/aur/workrave/workrave-git/build/ui/applets/common/src && /usr/bin/g-ir-scanner --add-include-path=/home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src --add-include-path=/home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/include --warn-all --namespace=Workrave --nsversion=2.0 --no-libtool --library=workrave-gtk4-private-1.0 --include=GObject-2.0 --include=Gtk-4.0 --include=cairo-1.0 -I/usr/include/gtk-4.0 -I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include -I/usr/include/graphene-1.0 -I/usr/lib/graphene-1.0/include -mfpmath=sse -msse -msse2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/fribidi -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -pthread -I/home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/include /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/control.c /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/timebar.c /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/timerbox.c /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/utils.c /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/../include/timerbox.h /home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/../include/timebar.h --output /home/cuihao/dev/aur/workrave/workrave-git/build/ui/applets/common/src/Workrave-2.0.gir

The CFLAGS then came from /usr/lib/pkgconfig/graphene-1.0.pc:

prefix=/usr
libdir=${prefix}/lib
includedir=${prefix}/include

graphene_has_sse2=1
graphene_has_gcc=1
graphene_has_neon=0
graphene_has_scalar=1

Name: Graphene
Description: Math classes for graphic libraries
URL: https://ebassi.github.io/graphene
Version: 1.10.8
Requires.private: gobject-2.0 >=  2.30.0
Libs: -L${libdir} -lgraphene-1.0
Libs.private: -lm -pthread
Cflags: -I${includedir}/graphene-1.0 -I${libdir}/graphene-1.0/include -mfpmath=sse -msse -msse2

I added a few prints in cmake files and this seems to be where the options were added:

diff --git a/cmake/modules/GObjectIntrospectionMacros.cmake b/cmake/modules/GObjectIntrospectionMacros.cmake
index 93ad3d0b..63f7852d 100644
--- a/cmake/modules/GObjectIntrospectionMacros.cmake
+++ b/cmake/modules/GObjectIntrospectionMacros.cmake
@@ -49,6 +49,9 @@ macro(gir_add_introspections introspections_girs)
     # Reuse the LIBTOOL variable from by automake if it's set
     set(_gir_libtool "--no-libtool")
 
+    message(GIR_NAME="${_gir_name}")
+    message(GIR_CFLAGS="${${_gir_name}_CFLAGS}")
+    message(GIR_LIBS="${${_gir_name}_LIBS}")
     add_custom_command(
       COMMAND ${INTROSPECTION_SCANNER}
               ${INTROSPECTION_SCANNER_ARGS}
GIR_NAME="Workrave_1_0_gir"
GIR_CFLAGS="-I/usr/include/gtkmm-3.0-I/usr/lib/gtkmm-3.0/include-I/usr/include/atkmm-1.6-I/usr/lib/atkmm-1.6/include-I/usr/include/gtk-3.0/unix-print-I/usr/include/gdkmm-3.0-I/usr/lib/gdkmm-3.0/include-I/usr/include/giomm-2.4-I/usr/lib/giomm-2.4/include-I/usr/include/pangomm-1.4-I/usr/lib/pangomm-1.4/include-I/usr/include/glibmm-2.4-I/usr/lib/glibmm-2.4/include-I/usr/include/cairomm-1.0-I/usr/lib/cairomm-1.0/include-I/usr/include/sigc++-2.0-I/usr/lib/sigc++-2.0/include-I/usr/include/gtk-3.0-I/usr/include/pango-1.0-I/usr/include-I/usr/include/cairo-I/usr/include/gdk-pixbuf-2.0-I/usr/include/atk-1.0-I/usr/include/freetype2-I/usr/include/harfbuzz-I/usr/include/glib-2.0-I/usr/lib/glib-2.0/include-I/usr/include/cloudproviders-I/usr/include/at-spi2-atk/2.0-I/usr/include/at-spi-2.0-I/usr/include/dbus-1.0-I/usr/lib/dbus-1.0/include-I/usr/include/fribidi-I/usr/include/pixman-1-I/usr/include/libpng16-I/usr/include/gio-unix-2.0-I/usr/include/libmount-I/usr/include/blkid-I/usr/include/sysprof-6-pthread-I/home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/include"
GIR_LIBS="workrave-private-1.0"
GIR_NAME="Workrave_2_0_gir"
GIR_CFLAGS="-I/usr/include/gtk-4.0-I/usr/include/pango-1.0-I/usr/include/gdk-pixbuf-2.0-I/usr/include/cairo-I/usr/include/harfbuzz-I/usr/include/freetype2-I/usr/include-I/usr/include/graphene-1.0-I/usr/lib/graphene-1.0/include-mfpmath=sse-msse-msse2-I/usr/include/glib-2.0-I/usr/lib/glib-2.0/include-I/usr/include/fribidi-I/usr/include/libpng16-I/usr/include/pixman-1-I/usr/include/libmount-I/usr/include/blkid-I/usr/include/sysprof-6-pthread-I/home/cuihao/dev/aur/workrave/workrave-git/ui/applets/common/src/include"
GIR_LIBS="workrave-gtk4-private-1.0"

I'm not familiar with CMake but hopefully this help to locate the issue!

@jjramsey
Copy link
Contributor

jjramsey commented Feb 7, 2024

Do you have the gobject-introspection package installed?

@cuihaoleo
Copy link
Author

Do you have the gobject-introspection package installed?

Yes. Please see the error message. It was about invaid options being supplied to the command. The command was there.

@cuihaoleo
Copy link
Author

If I remove -mfpmath=sse -msse -msse2 from /usr/lib/pkgconfig/graphene-1.0.pc , which is a dirty workaround, I can confirm that workrave will compile.

@cuihaoleo
Copy link
Author

Another workaround is to disable GTK4:
sed -i 's%(GTK4_FOUND)%(FALSE)%' "$pkgname/ui/applets/common/src/CMakeLists.txt"

@rcaelers
Copy link
Owner

This should be fixed in 1.11 beta 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants