* [PATCH] dtc: Use pkg-config to locate libyaml
@ 2019-07-12 11:52 Pavel Modilaynen
2019-11-04 17:27 ` Rob Herring
0 siblings, 1 reply; 3+ messages in thread
From: Pavel Modilaynen @ 2019-07-12 11:52 UTC (permalink / raw)
To: robh+dt, frowand.list; +Cc: devicetree, Pavel Modilaynen
From: Pavel Modilaynen <pavel.modilaynen@axis.com>
Using Makefile's wildcard with absolute path to detect
the presence of libyaml results in false-positive
detection when cross-compiling e.g. in yocto environment.
The latter results in build error:
| scripts/dtc/yamltree.o: In function `yaml_propval_int':
| yamltree.c: undefined reference to `yaml_sequence_start_event_initialize'
| yamltree.c: undefined reference to `yaml_emitter_emit'
| yamltree.c: undefined reference to `yaml_scalar_event_initialize'
...
Use pkg-config to locate libyaml to address this scenario.
Signed-off-by: Pavel Modilaynen <pavel.modilaynen@axis.com>
---
scripts/dtc/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 82160808765c..99d51b665432 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -11,7 +11,7 @@ dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
# Source files need to get at the userspace version of libfdt_env.h to compile
HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
-ifeq ($(wildcard /usr/include/yaml.h),)
+ifeq ($(shell pkg-config --exists yaml-0.1 && echo yes),)
ifneq ($(CHECK_DTBS),)
$(error dtc needs libyaml for DT schema validation support. \
Install the necessary libyaml development package.)
@@ -19,7 +19,7 @@ endif
HOST_EXTRACFLAGS += -DNO_YAML
else
dtc-objs += yamltree.o
-HOSTLDLIBS_dtc := -lyaml
+HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs)
endif
# Generated files need one more search path to include headers in source tree
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] dtc: Use pkg-config to locate libyaml
2019-07-12 11:52 [PATCH] dtc: Use pkg-config to locate libyaml Pavel Modilaynen
@ 2019-11-04 17:27 ` Rob Herring
2019-11-08 9:17 ` Pavel Modilaynen
0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2019-11-04 17:27 UTC (permalink / raw)
To: Pavel Modilaynen
Cc: Frank Rowand, devicetree, Pavel Modilaynen, Masahiro Yamada
+Masahiro
On Fri, Jul 12, 2019 at 6:59 AM Pavel Modilaynen
<pavel.modilaynen@axis.com> wrote:
>
> From: Pavel Modilaynen <pavel.modilaynen@axis.com>
Sorry for missing this.
> Using Makefile's wildcard with absolute path to detect
> the presence of libyaml results in false-positive
> detection when cross-compiling e.g. in yocto environment.
As this is a host tool, it's not really about cross-compiling, but
sandboxing the host env? IOW, I cross-compile all the time and don't
have an issue.
> The latter results in build error:
> | scripts/dtc/yamltree.o: In function `yaml_propval_int':
> | yamltree.c: undefined reference to `yaml_sequence_start_event_initialize'
> | yamltree.c: undefined reference to `yaml_emitter_emit'
> | yamltree.c: undefined reference to `yaml_scalar_event_initialize'
> ...
> Use pkg-config to locate libyaml to address this scenario.
The reason I didn't use pkg-config in the first place is it adds
another dependency. AIUI, it's only needed for gconfig/xconfig which
are probably not widely used especially for CI. Looks like objtool
needs it too, but that's x86 only though arm64 support is being worked
on. So I guess it is pretty much becoming a requirement.
So I've applied it. I added suppressing stderr in case pkg-config
isn't present.
Rob
>
> Signed-off-by: Pavel Modilaynen <pavel.modilaynen@axis.com>
> ---
> scripts/dtc/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
> index 82160808765c..99d51b665432 100644
> --- a/scripts/dtc/Makefile
> +++ b/scripts/dtc/Makefile
> @@ -11,7 +11,7 @@ dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
> # Source files need to get at the userspace version of libfdt_env.h to compile
> HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
>
> -ifeq ($(wildcard /usr/include/yaml.h),)
> +ifeq ($(shell pkg-config --exists yaml-0.1 && echo yes),)
> ifneq ($(CHECK_DTBS),)
> $(error dtc needs libyaml for DT schema validation support. \
> Install the necessary libyaml development package.)
> @@ -19,7 +19,7 @@ endif
> HOST_EXTRACFLAGS += -DNO_YAML
> else
> dtc-objs += yamltree.o
> -HOSTLDLIBS_dtc := -lyaml
> +HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs)
> endif
>
> # Generated files need one more search path to include headers in source tree
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] dtc: Use pkg-config to locate libyaml
2019-11-04 17:27 ` Rob Herring
@ 2019-11-08 9:17 ` Pavel Modilaynen
0 siblings, 0 replies; 3+ messages in thread
From: Pavel Modilaynen @ 2019-11-08 9:17 UTC (permalink / raw)
To: Rob Herring; +Cc: Frank Rowand, devicetree, Masahiro Yamada
> From: Rob Herring <robh+dt@kernel.org>
> > Using Makefile's wildcard with absolute path to detect the presence of
> > libyaml results in false-positive detection when cross-compiling e.g.
> > in yocto environment.
>
> As this is a host tool, it's not really about cross-compiling, but sandboxing the
> host env? IOW, I cross-compile all the time and don't have an issue.
Yes, you are correct, this is to address sandboxing, too late to correct?
>
> > Use pkg-config to locate libyaml to address this scenario.
>
> The reason I didn't use pkg-config in the first place is it adds another
> dependency. AIUI, it's only needed for gconfig/xconfig which are probably
> not widely used especially for CI. Looks like objtool needs it too, but that's
> x86 only though arm64 support is being worked on. So I guess it is pretty
> much becoming a requirement.
Exactly, the patch was inspired by usage of pkg-config in that shell scripts
assuming that it's more correct way to handle libyaml dependency...
I see it also used for building tools.
Should I maybe add new patch to fallback to wildcard when pkg-config is not found?
>
> So I've applied it. I added suppressing stderr in case pkg-config isn't present.
Thank you!
Pavel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-08 9:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 11:52 [PATCH] dtc: Use pkg-config to locate libyaml Pavel Modilaynen
2019-11-04 17:27 ` Rob Herring
2019-11-08 9:17 ` Pavel Modilaynen
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.