From c8d89d6e5cb019419a9bf3075415248f15c24a39 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 13 Mar 2025 20:05:57 -0600 Subject: [PATCH 1/2] Revert "Fix include paths for LZO headers" LZO headers require LZO's ${includedir} to be in the compiler include path, since they all #include . However, its pkg-config file only specifies -I${includedir}/lzo, so our previous change (to trust the LZO pkg-config file) just caused an include failure later on. Revert it, preparatory to a new fix. This reverts commit 9735309da66d0d9941cf9445ffca09be4cf80fc0. --- util/cairo-script/cairo-script-file.c | 2 +- util/cairo-script/cairo-script-operators.c | 2 +- util/cairo-script/cairo-script-scanner.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/util/cairo-script/cairo-script-file.c b/util/cairo-script/cairo-script-file.c index c45cc5086..7027f6027 100644 --- a/util/cairo-script/cairo-script-file.c +++ b/util/cairo-script/cairo-script-file.c @@ -42,7 +42,7 @@ #include #if HAVE_LZO -#include +#include #endif #define CHUNK_SIZE 32768 diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c index a5eca6ffc..21fba5cc7 100644 --- a/util/cairo-script/cairo-script-operators.c +++ b/util/cairo-script/cairo-script-operators.c @@ -60,7 +60,7 @@ #endif #if HAVE_LZO -#include +#include #endif #ifdef HAVE_MMAP diff --git a/util/cairo-script/cairo-script-scanner.c b/util/cairo-script/cairo-script-scanner.c index 167cd7a1e..a69ae5f5a 100644 --- a/util/cairo-script/cairo-script-scanner.c +++ b/util/cairo-script/cairo-script-scanner.c @@ -46,7 +46,7 @@ #include #if HAVE_LZO -#include +#include #endif #define DEBUG_SCAN 0 From 3c1135fe842ca1854c12b05209ed85b82679f1b3 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 13 Mar 2025 21:03:02 -0600 Subject: [PATCH 2/2] Fix search path for LZO headers LZO expects its headers to be included as , but its pkg-config file specifies only "Cflags: -I${includedir}/lzo". This happens to work if ${includedir} is already on the header search path, e.g. it's /usr/include. However, if lzo2 is in an unusual location and we're depending on pkg-config to tell us where it is, we'll end up looking for ${includedir}/lzo/lzo/lzo2a.h and failing the build: util/cairo-script/cairo-script-file.c:45:10: fatal error: 'lzo/lzo2a.h' file not found Work around the broken pkg-config include path. Reported to LZO upstream on 2025-03-13. --- meson.build | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/meson.build b/meson.build index cc13180ba..021c31310 100644 --- a/meson.build +++ b/meson.build @@ -203,6 +203,18 @@ endif lzo_dep = dependency('lzo2', required: get_option('lzo')) if lzo_dep.found() conf.set('HAVE_LZO', 1) + # LZO <= 2.10 expects its headers to be included as , but + # its pkg-config file specifies -I${includedir}/lzo, so the compiler won't + # find the headers if LZO is installed outside the default include paths. + # Add the correct include path. + lzo_includedir = lzo_dep.get_variable('includedir', default_value: '') + if lzo_includedir != '' + # LZO is not being built as a sibling Meson subproject + lzo_dep = declare_dependency( + compile_args: '-I' + lzo_includedir, + dependencies: lzo_dep, + ) + endif endif dl_dep = cc.find_library('dl', required: false)