[OE-core] [PATCH] file: remove the original magic.h

Junling Zheng zhengjunling at huawei.com
Fri Mar 27 03:31:34 UTC 2015


On 2015/3/26 21:08, Burton, Ross wrote:
> 
> On 26 March 2015 at 12:58, Junling Zheng <zhengjunling at huawei.com <mailto:zhengjunling at huawei.com>> wrote:
> 
>     This problem is that sometimes the magic.h wouldn't be generated again by magic.h.in <http://magic.h.in> if there
>     is already an original magic.h, and we may get an unexpected header file.
> 
> 
> libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
>         encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
>         funcs.c file.h readelf.h tar.h apptype.c \
>         file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
> 
> The problem is that the makefile doesn't actually say that the magic binaries depend on magic.h, so make is perfectly reasonably to build the binaries and then re-generate the makefile.
> 
> The correct fix here is to add magic.h to libmagic_la_SOURCES.
> 
> Ross
>
Hi, Ross

I don't think the dependency is the true reason, and I have tested it.

I add the magic.h to libmagic_la_SOURCES, and then make several times.

However, it's disappointing that sometimes the magic.h does still not generated again by the different magic.h.in.

I think the dependency of magic.h for magic binaries has been already declared in Makefile:

BUILT_SOURCES = magic.h
all: $(BUILT_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) all-am

The following is the comparison of the incorrect and the correct log of compiling:

z00238152 at Patch-Test:~>0$ diff -ru log.do_compile.incorrect log.do_compile.correct
--- log.do_compile.incorrect	2015-03-27 11:05:23.000000000 +0800
+++ log.do_compile.correct	2015-03-27 11:09:27.000000000 +0800
@@ -5,6 +5,7 @@
 make[1]: Entering directory `/home/z00238152/halogen/build-fluorine-arma9el-qemu-HULK/tmp-eglibc/work/armv7a-euler-linux-gnueabi/file/5.14-r0/file-5.14'
 Making all in src
 make[2]: Entering directory `/home/z00238152/halogen/build-fluorine-arma9el-qemu-HULK/tmp-eglibc/work/armv7a-euler-linux-gnueabi/file/5.14-r0/file-5.14/src'
+sed -e "s/X.YY/$(echo 5.14 | tr -d .)/" < ../src/magic.h.in > magic.h
 make  all-am
 make[3]: Entering directory `/home/z00238152/halogen/build-fluorine-arma9el-qemu-HULK/tmp-eglibc/work/armv7a-euler-linux-gnueabi/file/5.14-r0/file-5.14/src'

And the Makefile in src directory is the same:

z00238152 at Patch-Test:~>0$ diff -ru Makefile.incorrect Makefile.correct
z00238152 at Patch-Test:~>0$

And I set the PARALLEL_MAKE ?= "-j 1", the problem also doesn't be fixed.

So I think the true reason is that if the magic.h exists already, sometimes Makefile will not generate it again.




More information about the Openembedded-core mailing list