Menu

#370 PDL-2.007 can fail to build Basic/Core files

critical
closed
nobody
None
5
2015-02-22
2015-02-10
No

Building files in Basic/Core directory in parallel can fail:

make[2]: Entering directory '/builddir/build/BUILD/PDL-2.007/Basic/Core'
"/usr/bin/perl" -I../../blib/arch -I../../blib/lib -I/usr/lib/perl5 -I/usr/share/perl5 Core.pm.PL Core.pm
"/usr/bin/perl" pdl.h.PL pdl.h
"/usr/bin/perl" pdlcore.h.PL pdlcore.h
"/usr/bin/perl" pdlsimple.h.PL pdlsimple.h
"/usr/bin/perl" -e 'require "/builddir/build/BUILD/PDL-2.007/Basic/Core/Dev.pm"; \
    PDL::Core::Dev->import();               \
    genpp()' pdlsections.g  > pdlsections.c
Extracting Core.pm (WITH bad value support)
adding...
#define PDL_U PDL_US
#define PDL_N PDL_IND
#define PDL_Q PDL_LL
Extracting pdl.h
Running Mkbootstrap for PDL::Core ()
adding...
#define PDL_U PDL_US
#define PDL_N PDL_IND
#define PDL_Q PDL_LL
Extracting pdlsimple.h (with variable substitutions)
gcc -c  -I/usr/include  -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -Wno-unused -O0   -DVERSION=\"2.007\" -DXS_VERSION=\"2.007\" -fPIC -I/usr/lib/perl5/CORE -DPDL_PTHREAD  pdlsections.c
chmod 644 "Core.bs"
pdlsections.c:11:46: fatal error: pdlcore.h: No such file or directory
compilation terminated.
Extracting pdlcore.h
Makefile:923: recipe for target 'pdlsections.o' failed
make[2]: *** [pdlsections.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/builddir/build/BUILD/PDL-2.007/Basic/Core'

This is caused by missing dependency declaration of generated C files on generated header files, so as in this example, the C file (pdlsections.c) can start to compile before included header file (pdlcore.h) is made.

Attached patch corrects the Makefile.PL to declare the needed dependencies.

Reproducer is: Run "perl Makefile.PL" in the top-level directory, cd into Basic/Core directory, try to build "make pdlsections.o". It will fail.

Also I saw this notice:

# there must be a more elegant way of saying that
# certain files have additional dependencies!

The solution is to stop using suffix rules (.g.c: rules) and use template rules (%.c: %.g rules). With templates, you can define multiple prerequisites (%.o: %.c pdlcore.h pdl.h).

1 Attachments

Discussion

  • Zakariyya Mughal

    Just so it is more visible, Ed has applied this patch with this MR https://sourceforge.net/p/pdl/code/merge-requests/21/.

     
  • Chris Marshall

    Chris Marshall - 2015-02-19

    Does this fix work for nmake, dmake? Applying a patch is easy to do. To close this ticket requires someone to vet that it does the right thing with respect to the various makes out there. I've rejected MR21 because it was not clear that this has not yet been checked. If this is not the case please say so.

     
  • Petr Písař

    Petr Písař - 2015-02-19

    I only can confirm that it works with GNU make.

     
  • mohawk

    mohawk - 2015-02-19

    Worked on Linux gmake 3.81. Actually failed on Windows gmake 3.82, "Makefile:960: *** target file `pdlsections.c' has both : and :: entries. Stop."

    I'm investigating further.

    Folks, if you are going to reject an MR, you should put a few words on it saying why. Otherwise it just looks insane.

     
  • mohawk

    mohawk - 2015-02-19

    So it doesn't work on Windows because of this megatastic bit of code in Basic/Core/Makefile.PL:

    ($^O =~ /MSWin/ ? q|
    pdlsections.c: pdlsections.g Types.pm
     | : '');
    
     
  • mohawk

    mohawk - 2015-02-20

    MR 25 now addresses. Tested/working on Linux/gmake and Windows/nmake.

    In case it's not obvious: don't just reject an MR because you think it hasn't been tested. That's just odd. Ask.

     
  • Chris Marshall

    Chris Marshall - 2015-02-22

    Fixed in git. Thanks for reporting and fixing the problem.

     
  • Chris Marshall

    Chris Marshall - 2015-02-22
    • status: open --> closed
     

Log in to post a comment.