configure: check for bison, flex before dtc submodule build
PATCH 1/1 configure: check for bison, flex before dtc submodule build
if fdt is required, and the system DTC (libfdt) is not usable, check for the dtc submodule requirements before trying to build it, and error out with a helpful message in case the dependencies are not met.
--- configure | 8 ++++++++ 1 file changed, 8 insertions(+)
configure +8 -0
@@ -4276,6 +4276,14 @@ EOF git_submodules="${git_submodules} dtc" fi if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then + for binary in ${BISON:-bison} ${LEX:-flex} ; do + if ! has $binary ; then + error_exit "DTC (libfdt) version >= 1.4.2 not present on the system,\n" \ + "and using the dtc submodule replacement requires '${binary}'.\n" \ + "Please install the DTC (libfdt) devel package,\n" \ + "or the required binary '${binary}' to use the dtc submodule instead.\n" + fi + done fdt=git mkdir -p dtc if [ "$pwd_is_source_path" != "y" ] ; then
Signature · 1 line
2.16.4
Quoted 6 lines · Claudio Fontana
if fdt is required, and the system DTC (libfdt) is not usable, check for the dtc submodule requirements before trying to build it, and error out with a helpful message in case the dependencies are not met.
Signed-off-by Claudio Fontana <[email protected]>
Does the dtc module actually need bison/flex, or does it just print an ugly warning about it? We only want the 'libfdt' part of dtc, which doesn't need the parser, we don't need to build the actual dtc compiler.
thanks
-- PMM
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Claudio Fontana
if fdt is required, and the system DTC (libfdt) is not usable, check for the dtc submodule requirements before trying to build it, and error out with a helpful message in case the dependencies are not met.
Signed-off-by Claudio Fontana <[email protected]>
Quoted 8 lines
Does the dtc module actually need bison/flex, or does it just print an ugly warning about it? We only want the 'libfdt' part of dtc, which doesn't need the parser, we don't need to build the actual dtc compiler.
thanks
-- PMM
Hi Peter,
indeed, it was just an ugly warning that I mistook for an actual error.
I'll try to see if I can get rid of the warning somehow by playing with the build system a bit,
but otherwise all green.
Thanks,
Claudio
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Claudio Fontana
if fdt is required, and the system DTC (libfdt) is not usable, check for the dtc submodule requirements before trying to build it, and error out with a helpful message in case the dependencies are not met.
Quoted 6 lines
Quoted 1 line
Signed-off-by Claudio Fontana <[email protected]>Does the dtc module actually need bison/flex, or does it just print an ugly warning about it? We only want the 'libfdt' part of dtc, which doesn't need the parser, we don't need to build the actual dtc compiler.
Assuming we're just invoking "make libfdt" within the submodule, rather than "make" which will build dtc as well, then bison / flex shouldn't be needed.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 9 lines · David Gibson
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Claudio Fontana
if fdt is required, and the system DTC (libfdt) is not usable, check for the dtc submodule requirements before trying to build it, and error out with a helpful message in case the dependencies are not met.
Signed-off-by Claudio Fontana <[email protected]>
Quoted 9 lines
Quoted 4 lines
Does the dtc module actually need bison/flex, or does it just print an ugly warning about it? We only want the 'libfdt' part of dtc, which doesn't need the parser, we don't need to build the actual dtc compiler.
Assuming we're just invoking "make libfdt" within the submodule, rather than "make" which will build dtc as well, then bison / flex shouldn't be needed.
Indeed; I just sent a patch that works for me,
tried a few in-tree and out-of-tree full builds, and it seems to work as intended.
patchew complains about docker builds/tests though, although running the same TEST SCRIPTs manually with docker works for me.
The libfdt target inside dtc/Makefile actually causes more than just libfdt to be built:
~/git/qemu/dtc> make libdtc
DEP tests/dumptrees.c
DEP tests/trees.S
DEP tests/testutils.c
DEP tests/value-labels.c
DEP tests/asm_tree_dump.c
DEP tests/truncated_memrsv.c
DEP tests/truncated_string.c
DEP tests/truncated_property.c
DEP tests/check_full.c
DEP tests/check_header.c
DEP tests/check_path.c
DEP tests/overlay_bad_fixup.c
DEP tests/overlay.c
DEP tests/subnode_iterate.c
DEP tests/property_iterate.c
DEP tests/integer-expressions.c
DEP tests/utilfdt_test.c
DEP tests/path_offset_aliases.c
DEP tests/add_subnode_with_nops.c
DEP tests/dtbs_equal_unordered.c
DEP tests/dtb_reverse.c
DEP tests/dtbs_equal_ordered.c
DEP tests/extra-terminating-null.c
DEP tests/incbin.c
DEP tests/boot-cpuid.c
DEP tests/phandle_format.c
DEP tests/path-references.c
DEP tests/references.c
DEP tests/string_escapes.c
DEP tests/propname_escapes.c
DEP tests/appendprop2.c
DEP tests/appendprop1.c
DEP tests/del_node.c
DEP tests/del_property.c
DEP tests/setprop.c
DEP tests/set_name.c
DEP tests/rw_tree1.c
DEP tests/open_pack.c
DEP tests/nopulate.c
DEP tests/mangle-layout.c
DEP tests/move_and_save.c
DEP tests/sw_states.c
DEP tests/sw_tree1.c
DEP tests/nop_node.c
DEP tests/nop_property.c
DEP tests/setprop_inplace.c
DEP tests/stringlist.c
DEP tests/addr_size_cells2.c
DEP tests/addr_size_cells.c
DEP tests/notfound.c
DEP tests/sized_cells.c
DEP tests/char_literal.c
DEP tests/get_alias.c
DEP tests/node_offset_by_compatible.c
DEP tests/node_check_compatible.c
DEP tests/node_offset_by_phandle.c
DEP tests/node_offset_by_prop_value.c
DEP tests/parent_offset.c
DEP tests/supernode_atdepth_offset.c
DEP tests/get_path.c
DEP tests/get_phandle.c
DEP tests/getprop.c
DEP tests/get_name.c
DEP tests/path_offset.c
DEP tests/subnode_offset.c
DEP tests/find_property.c
DEP tests/root_node.c
DEP tests/get_mem_rsv.c
DEP libfdt/fdt_overlay.c
DEP libfdt/fdt_addresses.c
DEP libfdt/fdt_empty_tree.c
DEP libfdt/fdt_strerror.c
DEP libfdt/fdt_rw.c
DEP libfdt/fdt_sw.c
DEP libfdt/fdt_wip.c
DEP libfdt/fdt_ro.c
DEP libfdt/fdt.c
DEP util.c
DEP fdtoverlay.c
DEP fdtput.c
DEP fdtget.c
DEP fdtdump.c
LEX convert-dtsv0-lexer.lex.c
make: flex: Command not found
DEP srcpos.c
BISON dtc-parser.tab.c
make: bison: Command not found
LEX dtc-lexer.lex.c
make: flex: Command not found
DEP treesource.c
DEP livetree.c
DEP fstree.c
DEP flattree.c
DEP dtc.c
DEP data.c
DEP checks.c
CHK version_gen.h
LEX convert-dtsv0-lexer.lex.c
make: flex: Command not found
BISON dtc-parser.tab.c
make: bison: Command not found
LEX dtc-lexer.lex.c
make: flex: Command not found
make: *** No rule to make target 'libdtc'. Stop.
so I just used dtc/libfdt/Makefile.libfdt directly and removed the recursion altogether.
Let me know what you think about the idea in general, or if anybody knows what is wrong in the patch that makes patchew complain?
Ciao,
Claudio
Quoted 133 lines · Claudio Fontana
Quoted 9 lines · David Gibson
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Claudio Fontana
if fdt is required, and the system DTC (libfdt) is not usable, check for the dtc submodule requirements before trying to build it, and error out with a helpful message in case the dependencies are not met.
Signed-off-by Claudio Fontana <[email protected]>Quoted 9 lines
Quoted 4 lines
Does the dtc module actually need bison/flex, or does it just print an ugly warning about it? We only want the 'libfdt' part of dtc, which doesn't need the parser, we don't need to build the actual dtc compiler.
Assuming we're just invoking "make libfdt" within the submodule, rather than "make" which will build dtc as well, then bison / flex shouldn't be needed.
Indeed; I just sent a patch that works for me,
tried a few in-tree and out-of-tree full builds, and it seems to work as intended.
patchew complains about docker builds/tests though, although running the same TEST SCRIPTs manually with docker works for me.The libfdt target inside dtc/Makefile actually causes more than just libfdt to be built:
~/git/qemu/dtc> make libdtc
DEPtests/dumptrees.c
DEPtests/trees.S
DEPtests/testutils.c
DEPtests/value-labels.c
DEPtests/asm_tree_dump.c
DEPtests/truncated_memrsv.c
DEPtests/truncated_string.c
DEPtests/truncated_property.c
DEPtests/check_full.c
DEPtests/check_header.c
DEPtests/check_path.c
DEPtests/overlay_bad_fixup.c
DEPtests/overlay.c
DEPtests/subnode_iterate.c
DEPtests/property_iterate.c
DEPtests/integer-expressions.c
DEPtests/utilfdt_test.c
DEPtests/path_offset_aliases.c
DEPtests/add_subnode_with_nops.c
DEPtests/dtbs_equal_unordered.c
DEPtests/dtb_reverse.c
DEPtests/dtbs_equal_ordered.c
DEPtests/extra-terminating-null.c
DEPtests/incbin.c
DEPtests/boot-cpuid.c
DEPtests/phandle_format.c
DEPtests/path-references.c
DEPtests/references.c
DEPtests/string_escapes.c
DEPtests/propname_escapes.c
DEPtests/appendprop2.c
DEPtests/appendprop1.c
DEPtests/del_node.c
DEPtests/del_property.c
DEPtests/setprop.c
DEPtests/set_name.c
DEPtests/rw_tree1.c
DEPtests/open_pack.c
DEPtests/nopulate.c
DEPtests/mangle-layout.c
DEPtests/move_and_save.c
DEPtests/sw_states.c
DEPtests/sw_tree1.c
DEPtests/nop_node.c
DEPtests/nop_property.c
DEPtests/setprop_inplace.c
DEPtests/stringlist.c
DEPtests/addr_size_cells2.c
DEPtests/addr_size_cells.c
DEPtests/notfound.c
DEPtests/sized_cells.c
DEPtests/char_literal.c
DEPtests/get_alias.c
DEPtests/node_offset_by_compatible.c
DEPtests/node_check_compatible.c
DEPtests/node_offset_by_phandle.c
DEPtests/node_offset_by_prop_value.c
DEPtests/parent_offset.c
DEPtests/supernode_atdepth_offset.c
DEPtests/get_path.c
DEPtests/get_phandle.c
DEPtests/getprop.c
DEPtests/get_name.c
DEPtests/path_offset.c
DEPtests/subnode_offset.c
DEPtests/find_property.c
DEPtests/root_node.c
DEPtests/get_mem_rsv.c
DEPlibfdt/fdt_overlay.c
DEPlibfdt/fdt_addresses.c
DEPlibfdt/fdt_empty_tree.c
DEPlibfdt/fdt_strerror.c
DEPlibfdt/fdt_rw.c
DEPlibfdt/fdt_sw.c
DEPlibfdt/fdt_wip.c
DEPlibfdt/fdt_ro.c
DEPlibfdt/fdt.c
DEPutil.c
DEPfdtoverlay.c
DEPfdtput.c
DEPfdtget.c
DEPfdtdump.c
LEXconvert-dtsv0-lexer.lex.c
make: flex: Command not found
DEPsrcpos.c
BISONdtc-parser.tab.c
make: bison: Command not found
LEXdtc-lexer.lex.c
make: flex: Command not found
DEPtreesource.c
DEPlivetree.c
DEPfstree.c
DEPflattree.c
DEPdtc.c
DEPdata.c
DEPchecks.c
CHKversion_gen.h
LEXconvert-dtsv0-lexer.lex.c
make: flex: Command not found
BISONdtc-parser.tab.c
make: bison: Command not found
LEXdtc-lexer.lex.c
make: flex: Command not found
make: *** No rule to make target 'libdtc'. Stop.
Quoted 2 lines
so I just used dtc/libfdt/Makefile.libfdt directly and removed the recursion altogether.
The Makefile setup of dtc/libfdt is a bit weird (mostly to allow for Makefile fragments to be used in weird build environments). But for this case you might be better off still doing the recursion, but just changing the target from 'all' to 'libfdt'.
Quoted 6 lines
Let me know what you think about the idea in general, or if anybody knows what is wrong in the patch that makes patchew complain?
Ciao,
Claudio
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 134 lines · David Gibson
Quoted 133 lines · Claudio Fontana
Quoted 9 lines · David Gibson
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Claudio Fontana
if fdt is required, and the system DTC (libfdt) is not usable, check for the dtc submodule requirements before trying to build it, and error out with a helpful message in case the dependencies are not met.
Signed-off-by Claudio Fontana <[email protected]>Quoted 9 lines
Quoted 4 lines
Does the dtc module actually need bison/flex, or does it just print an ugly warning about it? We only want the 'libfdt' part of dtc, which doesn't need the parser, we don't need to build the actual dtc compiler.
Assuming we're just invoking "make libfdt" within the submodule, rather than "make" which will build dtc as well, then bison / flex shouldn't be needed.
Indeed; I just sent a patch that works for me,
tried a few in-tree and out-of-tree full builds, and it seems to work as intended.
patchew complains about docker builds/tests though, although running the same TEST SCRIPTs manually with docker works for me.The libfdt target inside dtc/Makefile actually causes more than just libfdt to be built:
~/git/qemu/dtc> make libdtc
DEPtests/dumptrees.c
DEPtests/trees.S
DEPtests/testutils.c
DEPtests/value-labels.c
DEPtests/asm_tree_dump.c
DEPtests/truncated_memrsv.c
DEPtests/truncated_string.c
DEPtests/truncated_property.c
DEPtests/check_full.c
DEPtests/check_header.c
DEPtests/check_path.c
DEPtests/overlay_bad_fixup.c
DEPtests/overlay.c
DEPtests/subnode_iterate.c
DEPtests/property_iterate.c
DEPtests/integer-expressions.c
DEPtests/utilfdt_test.c
DEPtests/path_offset_aliases.c
DEPtests/add_subnode_with_nops.c
DEPtests/dtbs_equal_unordered.c
DEPtests/dtb_reverse.c
DEPtests/dtbs_equal_ordered.c
DEPtests/extra-terminating-null.c
DEPtests/incbin.c
DEPtests/boot-cpuid.c
DEPtests/phandle_format.c
DEPtests/path-references.c
DEPtests/references.c
DEPtests/string_escapes.c
DEPtests/propname_escapes.c
DEPtests/appendprop2.c
DEPtests/appendprop1.c
DEPtests/del_node.c
DEPtests/del_property.c
DEPtests/setprop.c
DEPtests/set_name.c
DEPtests/rw_tree1.c
DEPtests/open_pack.c
DEPtests/nopulate.c
DEPtests/mangle-layout.c
DEPtests/move_and_save.c
DEPtests/sw_states.c
DEPtests/sw_tree1.c
DEPtests/nop_node.c
DEPtests/nop_property.c
DEPtests/setprop_inplace.c
DEPtests/stringlist.c
DEPtests/addr_size_cells2.c
DEPtests/addr_size_cells.c
DEPtests/notfound.c
DEPtests/sized_cells.c
DEPtests/char_literal.c
DEPtests/get_alias.c
DEPtests/node_offset_by_compatible.c
DEPtests/node_check_compatible.c
DEPtests/node_offset_by_phandle.c
DEPtests/node_offset_by_prop_value.c
DEPtests/parent_offset.c
DEPtests/supernode_atdepth_offset.c
DEPtests/get_path.c
DEPtests/get_phandle.c
DEPtests/getprop.c
DEPtests/get_name.c
DEPtests/path_offset.c
DEPtests/subnode_offset.c
DEPtests/find_property.c
DEPtests/root_node.c
DEPtests/get_mem_rsv.c
DEPlibfdt/fdt_overlay.c
DEPlibfdt/fdt_addresses.c
DEPlibfdt/fdt_empty_tree.c
DEPlibfdt/fdt_strerror.c
DEPlibfdt/fdt_rw.c
DEPlibfdt/fdt_sw.c
DEPlibfdt/fdt_wip.c
DEPlibfdt/fdt_ro.c
DEPlibfdt/fdt.c
DEPutil.c
DEPfdtoverlay.c
DEPfdtput.c
DEPfdtget.c
DEPfdtdump.c
LEXconvert-dtsv0-lexer.lex.c
make: flex: Command not found
DEPsrcpos.c
BISONdtc-parser.tab.c
make: bison: Command not found
LEXdtc-lexer.lex.c
make: flex: Command not found
DEPtreesource.c
DEPlivetree.c
DEPfstree.c
DEPflattree.c
DEPdtc.c
DEPdata.c
DEPchecks.c
CHKversion_gen.h
LEXconvert-dtsv0-lexer.lex.c
make: flex: Command not found
BISONdtc-parser.tab.c
make: bison: Command not found
LEXdtc-lexer.lex.c
make: flex: Command not found
make: *** No rule to make target 'libdtc'. Stop.
Quoted 7 lines
Quoted 2 lines
so I just used dtc/libfdt/Makefile.libfdt directly and removed the recursion altogether.
The
Makefilesetup of dtc/libfdt is a bit weird (mostly to allow forMakefilefragments to be used in weird build environments). But for this case you might be better off still doing the recursion, but just changing the target from 'all' to 'libfdt'.
Hi David,
that approach (recursing the same way, just building libfdt instead of all) is what I tried first, however as showcased above the libfdt target seems to cause more stuff to be built than necessary.
Do you think we should change the external module to make the minimal build of libfdt work, instead of removing the recursion?
Thanks,
Claudio
Quoted 8 lines
Quoted 7 lines
Let me know what you think about the idea in general, or if anybody knows what is wrong in the patch that makes patchew complain?
Ciao,
Claudio
Quoted 143 lines · Claudio Fontana
Quoted 134 lines · David Gibson
Quoted 133 lines · Claudio Fontana
Quoted 9 lines · David Gibson
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Claudio Fontana
if fdt is required, and the system DTC (libfdt) is not usable, check for the dtc submodule requirements before trying to build it, and error out with a helpful message in case the dependencies are not met.
Signed-off-by Claudio Fontana <[email protected]>Quoted 9 lines
Quoted 4 lines
Does the dtc module actually need bison/flex, or does it just print an ugly warning about it? We only want the 'libfdt' part of dtc, which doesn't need the parser, we don't need to build the actual dtc compiler.
Assuming we're just invoking "make libfdt" within the submodule, rather than "make" which will build dtc as well, then bison / flex shouldn't be needed.
Indeed; I just sent a patch that works for me,
tried a few in-tree and out-of-tree full builds, and it seems to work as intended.
patchew complains about docker builds/tests though, although running the same TEST SCRIPTs manually with docker works for me.The libfdt target inside dtc/Makefile actually causes more than just libfdt to be built:
~/git/qemu/dtc> make libdtc
DEPtests/dumptrees.c
DEPtests/trees.S
DEPtests/testutils.c
DEPtests/value-labels.c
DEPtests/asm_tree_dump.c
DEPtests/truncated_memrsv.c
DEPtests/truncated_string.c
DEPtests/truncated_property.c
DEPtests/check_full.c
DEPtests/check_header.c
DEPtests/check_path.c
DEPtests/overlay_bad_fixup.c
DEPtests/overlay.c
DEPtests/subnode_iterate.c
DEPtests/property_iterate.c
DEPtests/integer-expressions.c
DEPtests/utilfdt_test.c
DEPtests/path_offset_aliases.c
DEPtests/add_subnode_with_nops.c
DEPtests/dtbs_equal_unordered.c
DEPtests/dtb_reverse.c
DEPtests/dtbs_equal_ordered.c
DEPtests/extra-terminating-null.c
DEPtests/incbin.c
DEPtests/boot-cpuid.c
DEPtests/phandle_format.c
DEPtests/path-references.c
DEPtests/references.c
DEPtests/string_escapes.c
DEPtests/propname_escapes.c
DEPtests/appendprop2.c
DEPtests/appendprop1.c
DEPtests/del_node.c
DEPtests/del_property.c
DEPtests/setprop.c
DEPtests/set_name.c
DEPtests/rw_tree1.c
DEPtests/open_pack.c
DEPtests/nopulate.c
DEPtests/mangle-layout.c
DEPtests/move_and_save.c
DEPtests/sw_states.c
DEPtests/sw_tree1.c
DEPtests/nop_node.c
DEPtests/nop_property.c
DEPtests/setprop_inplace.c
DEPtests/stringlist.c
DEPtests/addr_size_cells2.c
DEPtests/addr_size_cells.c
DEPtests/notfound.c
DEPtests/sized_cells.c
DEPtests/char_literal.c
DEPtests/get_alias.c
DEPtests/node_offset_by_compatible.c
DEPtests/node_check_compatible.c
DEPtests/node_offset_by_phandle.c
DEPtests/node_offset_by_prop_value.c
DEPtests/parent_offset.c
DEPtests/supernode_atdepth_offset.c
DEPtests/get_path.c
DEPtests/get_phandle.c
DEPtests/getprop.c
DEPtests/get_name.c
DEPtests/path_offset.c
DEPtests/subnode_offset.c
DEPtests/find_property.c
DEPtests/root_node.c
DEPtests/get_mem_rsv.c
DEPlibfdt/fdt_overlay.c
DEPlibfdt/fdt_addresses.c
DEPlibfdt/fdt_empty_tree.c
DEPlibfdt/fdt_strerror.c
DEPlibfdt/fdt_rw.c
DEPlibfdt/fdt_sw.c
DEPlibfdt/fdt_wip.c
DEPlibfdt/fdt_ro.c
DEPlibfdt/fdt.c
DEPutil.c
DEPfdtoverlay.c
DEPfdtput.c
DEPfdtget.c
DEPfdtdump.c
LEXconvert-dtsv0-lexer.lex.c
make: flex: Command not found
DEPsrcpos.c
BISONdtc-parser.tab.c
make: bison: Command not found
LEXdtc-lexer.lex.c
make: flex: Command not found
DEPtreesource.c
DEPlivetree.c
DEPfstree.c
DEPflattree.c
DEPdtc.c
DEPdata.c
DEPchecks.c
CHKversion_gen.h
LEXconvert-dtsv0-lexer.lex.c
make: flex: Command not found
BISONdtc-parser.tab.c
make: bison: Command not found
LEXdtc-lexer.lex.c
make: flex: Command not found
make: *** No rule to make target 'libdtc'. Stop.Quoted 7 lines
Quoted 2 lines
so I just used dtc/libfdt/Makefile.libfdt directly and removed the recursion altogether.
The
Makefilesetup of dtc/libfdt is a bit weird (mostly to allow forMakefilefragments to be used in weird build environments). But for this case you might be better off still doing the recursion, but just changing the target from 'all' to 'libfdt'.
Quoted 5 lines
Hi David,
that approach (recursing the same way, just building libfdt instead of all) is what I tried first, however as showcased above the libfdt target seems to cause more stuff to be built than necessary.
Ah, right. I had a look at this in dtc upstream. It looks like the problem is that we're always doing dependency generation for everything, including on the flex and bison generated files.
Quoted 2 lines
Do you think we should change the external module to make the minimal build of libfdt work, instead of removing the recursion?
It'd be nice to fix this upstream as well, which would also fix it here. Unfortunately, I'm not really sure how to do that.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson