From 3c1135fe842ca1854c12b05209ed85b82679f1b3 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 13 Mar 2025 21:03:02 -0600 Subject: [PATCH] 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)