Second hunk of this diff seems to be a revert of [1]  which might
break the ndctl build on Arch Linux.

AFAIS for Centos/Fedora/RHEL etc the iniparser.h file is present in the
default include path('/usr/include') as a softlink to
'/usr/include/iniparser/iniparser.h' . Ubuntu/Debian seems to an
exception where path '/usr/include/iniparser.h' is not present.

I guess thats primarily due to no 'make install' target available in
iniparser makefiles [1] that fixes a single include patch. This may have led
to differences across distros where to place these header files.

I would suggest changing to this in meson.build to atleast catch if the
iniparser.h is not present at the expected path during meson setup:

    iniparser = cc.find_library('iniparser', required : true, has_headers: 
'iniparser.h')

[1] addc5fd8511('Fix iniparser.h include')
[2] https://github.com/ndevilla/iniparser/blob/master/Makefile

"Aneesh Kumar K.V" <[email protected]> writes:

> Fix the below build error on ubuntu:
> ../util/parse-configs.c:7:10: fatal error: iniparser.h: No such file or 
> directory
>     7 | #include <iniparser.h>
>       |          ^~~~~~~~~~~~~
>
> The same error is not observed on other OS because they do create symlinks as
> below
>
> lrwxrwxrwx. 1 root root 21 Jul 22  2021 /usr/include/iniparser.h -> 
> iniparser/iniparser.h
>
> the error can be avoided by using the correct include path. Also, catch the 
> error
> during setup instead of the build by adding the check for meson.build
>
> Signed-off-by: Aneesh Kumar K.V <[email protected]>
> ---
>  meson.build          | 2 +-
>  util/parse-configs.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 42e11aa25cba..a4c4c1cd3df3 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -160,7 +160,7 @@ cc = meson.get_compiler('c')
>  
>  # keyutils and iniparser lack pkgconfig
>  keyutils = cc.find_library('keyutils', required : get_option('keyutils'))
> -iniparser = cc.find_library('iniparser', required : true)
> +iniparser = cc.find_library('iniparser', required : true, has_headers: 
> 'iniparser/iniparser.h')
>  
>  conf = configuration_data()
>  check_headers = [
> diff --git a/util/parse-configs.c b/util/parse-configs.c
> index c834a07011e5..1b7ffa69f05f 100644
> --- a/util/parse-configs.c
> +++ b/util/parse-configs.c
> @@ -4,7 +4,7 @@
>  #include <dirent.h>
>  #include <errno.h>
>  #include <fcntl.h>
> -#include <iniparser.h>
> +#include <iniparser/iniparser.h>
>  #include <sys/stat.h>
>  #include <util/parse-configs.h>
>  #include <util/strbuf.h>
> -- 
> 2.35.1
>
>

-- 
Cheers
~ Vaibhav

Reply via email to