From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "aneesh.kumar@linux.ibm.com" <aneesh.kumar@linux.ibm.com>,
"Williams, Dan J" <dan.j.williams@intel.com>,
"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>,
"vaibhav@linux.ibm.com" <vaibhav@linux.ibm.com>
Subject: Re: [PATCH] util/parse: Fix build error on ubuntu
Date: Tue, 15 Mar 2022 17:03:32 +0000 [thread overview]
Message-ID: <b03ba8900a24a58fa47139761f9bce400eadfdc3.camel@intel.com> (raw)
In-Reply-To: <87zglrb1tu.fsf@vajain21.in.ibm.com>
On Tue, 2022-03-15 at 22:16 +0530, Vaibhav Jain wrote:
> "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
>
> > Vaibhav Jain <vaibhav@linux.ibm.com> writes:
> >
> > > 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.
> >
Sigh, yeah, that's an unfortunate situation.
> >
>
> Agree, above patch can fix this issue. Though I really wanted to avoid
> trickling changes to the parse-configs.c since the real problem is with
> non consistent location for iniparser.h header across distros.
>
> I gave it some thought and came up with this patch to meson.build that can
> pick up appropriate '/usr/include' or '/usr/include/iniparser' directory
> as include path to the compiler.
>
> Also since there seems to be no standard location for this header file
> I have included a meson build option named 'iniparser-includedir' that
> can point to the dir where 'iniparser.h' can be found.
This approach sounds fine, do you want to send it as a proper patch.
>
> diff --git a/meson.build b/meson.build
> index 42e11aa25cba..8c347e64ca2d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -158,9 +158,27 @@ endif
>
> cc = meson.get_compiler('c')
>
> -# keyutils and iniparser lack pkgconfig
> +# keyutils lack pkgconfig
s/lack/lacks/
> keyutils = cc.find_library('keyutils', required : get_option('keyutils'))
> -iniparser = cc.find_library('iniparser', required : true)
> +
> +# iniparser lacks pkgconfig and its header files are either at '/usr/include' or '/usr/include/iniparser'
> +# First use the path provided by user via meson configure -Diniparser-includedir=<somepath>
> +# if thats not provided than try searching for 'iniparser.h' in default system include path
> +# and if that not found than as a last resort try looking at '/usr/include/iniparser'
> +
> +if get_option('iniparser-includedir') == ''
> + iniparser = cc.find_library('iniparser', required : false, has_headers : 'iniparser.h')
> + # if not available at the default path try '/usr/include/iniparser'
> + if not iniparser.found()
> + iniparser = cc.find_library('iniparser', required : true, has_headers : 'iniparser/iniparser.h')
> + iniparser = declare_dependency(include_directories:'/usr/include/iniparser', dependencies:iniparser)
> + endif
> +else
> + iniparser_incdir = include_directories(get_option('iniparser-includedir'))
> + iniparser = cc.find_library('iniparser', required : true, has_headers : 'iniparser.h',
> + header_include_directories:iniparser_incdir)
> + iniparser = declare_dependency(include_directories:iniparser_incdir, dependencies:iniparser)
> +endif
>
> conf = configuration_data()
> check_headers = [
> diff --git a/meson_options.txt b/meson_options.txt
> index aa4a6dc8e12a..d08151691553 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -23,3 +23,5 @@ option('pkgconfiglibdir', type : 'string', value : '',
> description : 'directory for standard pkg-config files')
> option('bashcompletiondir', type : 'string',
> description : '''${datadir}/bash-completion/completions''')
> +option('iniparser-includedir', type : 'string',
> + description : '''Path containing the iniparser header files''')
>
>
next prev parent reply other threads:[~2022-03-15 17:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 6:04 [PATCH] util/parse: Fix build error on ubuntu Aneesh Kumar K.V
2022-03-15 8:55 ` Vaibhav Jain
2022-03-15 10:15 ` Aneesh Kumar K.V
2022-03-15 16:46 ` Vaibhav Jain
2022-03-15 17:03 ` Verma, Vishal L [this message]
2022-03-15 17:19 ` Dan Williams
2022-03-16 3:50 ` Aneesh Kumar K V
2022-03-16 5:33 ` Vaibhav Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b03ba8900a24a58fa47139761f9bce400eadfdc3.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=nvdimm@lists.linux.dev \
--cc=vaibhav@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.