Subject: | doesn't build due to C++ compile error |
I am seeing this error on my Debian Wheezy (perl 5.18.1, gcc 4.7.2):
g++ -o obj/release/api.os -c -Wall -Werror -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -m64 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -fno-rtti -fno-exceptions -fvisibility=hidden -Wall -Werror -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -m64 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -fPIC -DV8_TARGET_ARCH_X64 -DV8_SHARED -DENABLE_VMSTATE_TRACKING -DENABLE_LOGGING_AND_PROFILING -DENABLE_DEBUGGER_SUPPORT -Isrc src/api.cc
src/api.cc: In static member function 'static void v8::Date::DateTimeConfigurationChangeNotification()':
src/api.cc:3871:26: error: variable 'result' set but not used [-Werror=unused-but-set-variable]
I am including a patch which turns off -Werror (fatal warnings), as per the advice here:
https://code.google.com/p/v8/issues/detail?id=1806
A more complete solution would be to build with gyp and upgrade the version of V8
Subject: | patch.diff |
diff --git a/inc/Alien/V8/Build.pm b/inc/Alien/V8/Build.pm
index d80596d..0690dcc 100644
--- a/inc/Alien/V8/Build.pm
+++ b/inc/Alien/V8/Build.pm
@@ -117,6 +117,24 @@ sub ACTION_build {
$tar->extract();
}
+ # Remove -Werror from SConstruct
+ do {
+ my $in;
+ my $out;
+ open($in, '<', 'v8-3.1.5/SConstruct') || die "unable to read src/v8-3.1.5/SConstruct $!";
+ open($out, '>', 'v8-3.1.5/SConstruct.tmp') || die "unable to write src/v8-3.1.5/SConstruct.tmp $!";
+ while(!eof($in))
+ {
+ my $line = <$in>;
+ $line =~ s/'-Werror',//g;
+ print $out $line;
+ }
+ close $in;
+ close $out;
+ unlink('v8-3.1.5/SConstruct') || die "unaable to unlink src/v8-3.1.5/SConstruct $!";
+ rename('v8-3.1.5/SConstruct.tmp', 'v8-3.1.5/SConstruct') || die "unable to rename src/v8-3.1.5/SConstruct.tmp src/v8-3.1.5/SConstruct $!";
+ };
+
# Build V8
if (exists($Config{ptrsize}) && $Config{ptrsize} == 8) {
push(@SConsArgs, "arch=x64");
@@ -155,4 +173,4 @@ sub ACTION_build {
1;
-__END__
\ No newline at end of file
+__END__