hyprwm / hyprcursor

The hyprland cursor format, library and utilities.
https://standards.hyprland.org/hyprcursor/
BSD 3-Clause "New" or "Revised" License
376 stars 14 forks source link

version mismatched or depency missing for librsvg in Cmake #54

Closed janemba closed 4 months ago

janemba commented 4 months ago

Hello,

I'm using librsvg version 2.58.2 and while building hyprcursor I got the following error:

cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
[  7%] Building CXX object CMakeFiles/hyprcursor.dir/libhyprcursor/hyprcursor.cpp.o
/tmp/hyprcursor/libhyprcursor/hyprcursor.cpp:10:10: fatal error: librsvg/rsvg.h: No such file or directory
   10 | #include <librsvg/rsvg.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/hyprcursor.dir/build.make:90: CMakeFiles/hyprcursor.dir/libhyprcursor/hyprcursor.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:848: CMakeFiles/hyprcursor.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

Issue is the includes are installed in /usr/include/librsvg-2.0/.

Checking with pkg-config I got the following:

$ pkg-config --cflags --libs librsvg-2.0

-pthread -I/usr/include/librsvg-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/webp -I/usr/local/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lcairo

So maybe something must be added to CMakeList.txt but I don't know what.

vaxerski commented 4 months ago

hm, looks correct to me: -I/usr/include/librsvg-2.0 means to include that as an include path, in which on my system: image librsvg/rsvg.h resides.

janemba commented 4 months ago

Yes same for me, but why I cannot build hyprcursor ? Some options at missing from Cmake ?

vaxerski commented 4 months ago

no clue, it builds fine for me and the tests pass

janemba commented 4 months ago

So I tried to compile the faulty file hyprcursor.cpp alone, with the cmake command-line. Without any surprise I got this:

$ c++ -DHYPRCURSOR_VERSION=\"0.1.9\" -Dhyprcursor_EXPORTS -I/tmp/hyprcursor/./include -I/tmp/hyprcursor/./libhyprcursor -O3 -DNDEBUG -std=gnu++23 -fPIC -O3 -pthread -DTOML_HEADER_ONLY=0 -DTOML_SHARED_LIB=1 -MD -MT CMakeFiles/hyprcursor.dir/libhyprcursor/hyprcursor.cpp.o -MF CMakeFiles/hyprcursor.dir/libhyprcursor/hyprcursor.cpp.o.d -o CMakeFiles/hyprcursor.dir/libhyprcursor/hyprcursor.cpp.o -c /tmp/hyprcursor/libhyprcursor/hyprcursor.cpp
/tmp/hyprcursor/libhyprcursor/hyprcursor.cpp:10:10: fatal error: librsvg/rsvg.h: No such file or directory
   10 | #include <librsvg/rsvg.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.

Then I added the require flags for librsvg-2.0 and I got this:

$ pkg-config --cflags librsvg-2.0
-pthread -I/usr/include/librsvg-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/webp -I/usr/local/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1

$ c++ -DHYPRCURSOR_VERSION=\"0.1.9\" -Dhyprcursor_EXPORTS -I/tmp/hyprcursor/./include -I/tmp/hyprcursor/./libhyprcursor -O3 -DNDEBUG -std=gnu++23 -fPIC -O3 -pthread -DTOML_HEADER_ONLY=0 -DTOML_SHARED_LIB=1 -MD -MT CMakeFiles/hyprcursor.dir/libhyprcursor/hyprcursor.cpp.o -MF CMakeFiles/hyprcursor.dir/libhyprcursor/hyprcursor.cpp.o.d -o CMakeFiles/hyprcursor.dir/libhyprcursor/hyprcursor.cpp.o -c /tmp/hyprcursor/libhyprcursor/hyprcursor.cpp -pthread -I/usr/include/librsvg-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/webp -I/usr/local/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1
/tmp/hyprcursor/libhyprcursor/hyprcursor.cpp:768:1: fatal error: opening dependency file CMakeFiles/hyprcursor.dir/libhyprcursor/hyprcursor.cpp.o.d: No such file or directory
  768 | }
      | ^
compilation terminated.

So the error might be nothing as I just compiled the file alone but at least the previous error is gone so maybe some flags are missing for cmake but I don't know cmake so I have no idea where to add the pkg-config flag for librsvg-2.0.

Any clue ?

vaxerski commented 4 months ago

no clue