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

'cairo/cairo.h' file not found #170

Closed
concatime opened this issue Apr 29, 2021 · 9 comments
Closed

'cairo/cairo.h' file not found #170

concatime opened this issue Apr 29, 2021 · 9 comments

Comments

@concatime
Copy link
Contributor

concatime commented Apr 29, 2021

When building bemenu (and sway too), I face this:

In file included from lib/renderers/wayland/wayland.c:2:
In file included from lib/renderers/wayland/wayland.h:9:
lib/renderers/cairo.h:8:10: fatal error: 'cairo/cairo.h' file not found
#include <cairo/cairo.h>
         ^~~~~~~~~~~~~~~
1 error generated.
In file included from lib/renderers/wayland/registry.c:1:
In file included from lib/renderers/wayland/wayland.h:9:
lib/renderers/cairo.h:8:10: fatal error: 'cairo/cairo.h' file not found
#include <cairo/cairo.h>
         ^~~~~~~~~~~~~~~
1 error generated.
In file included from lib/renderers/wayland/window.c:2:
In file included from lib/renderers/wayland/wayland.h:9:
lib/renderers/cairo.h:8:10: fatal error: 'cairo/cairo.h' file not found
#include <cairo/cairo.h>
         ^~~~~~~~~~~~~~~
1 error generated.

This issue happens because pkgconfig strips the cairo namespace.
Relevant part from/lib/pkgconfig/cairo.pc:

Cflags: -I${includedir}/cairo

You can verify by yourself from Archlinux’s package.

I don’t know if this behaviour is for keeping backward compatibility, or that cairo namespace is deprecated.

Two options:

  1. Rename lib/renderers/cairo.h to lib/renderers/cairo_internal.h, and replace <cairo/cairo.h> by <cairo.h> from it, otherwise we would have two cairo.h in compiler’s search path and probably an issue.
  2. Remove stripping from upstream cairo.
@concatime
Copy link
Contributor Author

Should I open an issue in sway too? This way we can opt for a common solution.

@Cloudef
Copy link
Owner

Cloudef commented Apr 30, 2021

I guess we should rename cairo.h to cairo_renderer.h or something and then use cairo.h, pretty weird the pc file has changed like that.

@concatime
Copy link
Contributor Author

I faced this issue with swaybg too, so I’ve opened an issue upstream https://gitlab.freedesktop.org/cairo/cairo/-/issues/479 once for all. We will wait for their response before any action.

@psychon
Copy link

psychon commented May 7, 2021

You can verify by yourself from Archlinux’s package.

Does anyone know what exactly causes this? I downloaded the Archlinux package and it installs cairo.h to /usr/include/cairo/cairo.h, so shouldn't #include <cairo/cairo.h> still work?

@Cloudef
Copy link
Owner

Cloudef commented May 7, 2021

Screenshot 2021-05-07 at 23 31 07
Seems like it was answered. While unfortunate, we aren't doing the cairo include the documented way so we should fix it. Most likely bemenu won't be the only project where this issue happens.

@Cloudef
Copy link
Owner

Cloudef commented May 7, 2021

maybe fixed here ebd7338

@concatime
Copy link
Contributor Author

concatime commented May 7, 2021

@psychon Well, I didn’t install cairo to /usr, and expected, rightfully, that pkg-config --cflags cairo would be enough (which wasn’t)

so shouldn't #include <cairo/cairo.h> still work?

This is the issue. It should have not worked because that’s not how cairo is meant to be used.

@concatime
Copy link
Contributor Author

I confirm it works. Thank you.

@Cloudef
Copy link
Owner

Cloudef commented May 8, 2021

Thanks, I'll try to prepare new release soon including this fix.

@Cloudef Cloudef pinned this issue May 8, 2021
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