Subject: | LibYAML.o linked twice when rebuilding module with CPANPLUS |
Hi,
CPANPLUS doesn't clean its working directory by default. When, for
whatever reason, YAML::LibYAML is rebuilt the build fails with the
following error message:
cc -shared -O2 -march=i486 -mtune=i686 -L/usr/local/lib
-fstack-protector api.o dumper.o emitter.o LibYAML.o loader.o parser.o
perl_libyaml.o reader.o scanner.o writer.o LibYAML.o -o
../blib/arch/auto/YAML/XS/LibYAML/LibYAML.so
LibYAML.o: In function `XS_YAML__XS__LibYAML_Dump':
LibYAML.c:(.text+0x0): multiple definition of
`XS_YAML__XS__LibYAML_Dump' [...]
The problem is that the expression "glob("*.c"), 'LibYAML.c'" in
LibYAML/Makefile.PL picks up LibYAML.c twice on the second run as
LibYAML.c was generated previously. If the above expression returned a
unique list the CPANPLUS build wouldn't fail.
Regards,
Andreas
Subject: | LibYAML_Makefile_PL.diff.txt |
--- LibYAML/Makefile.PL.orig 2011-04-03 18:28:08.000000000 +0200
+++ LibYAML/Makefile.PL 2012-01-22 16:55:22.000000000 +0100
@@ -6,7 +6,7 @@
my $c = $_;
$c =~ s/\.c$/$Config::Config{_o}/;
$c;
-} glob("*.c"), 'LibYAML.c';
+} keys %{{ map { $_ => 1 } glob("*.c"), 'LibYAML.c' }};
my $DEFINE = $^O eq 'MSWin32'
? '-DHAVE_CONFIG_H -DYAML_DECLARE_EXPORT'