Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in mksnapshot while building 4.5.0 on debian wheezy #8451

Closed
SoCalBeachrunner opened this issue Sep 8, 2016 · 11 comments
Closed

Crash in mksnapshot while building 4.5.0 on debian wheezy #8451

SoCalBeachrunner opened this issue Sep 8, 2016 · 11 comments
Labels
build Issues and PRs related to build files or the CI. v8 engine Issues and PRs related to the V8 dependency.

Comments

@SoCalBeachrunner
Copy link

  • Version: node 4.5.0
  • Platform: Debian 7.11
  • Subsystem: Wheezy , building node with clang 3.4

node 4.5.0 source fails to complete compilation because clang++ has a Segmentation Fault during the build on Wheezy (building for this same architecture to use on the local machine) while processing the node source file "mark-compact.cc"

Note that the build was configured with the option " --without-intl"
Compiler output and stack trace are attached.

clang had a Segmentation Fault and prompted to send this bug report. During the build of node 4.5.0 on Wheezy (building for this same architecture to use on the local machine) clang++ crashed while processing the node source file "mark-compact.cc"

 The node source was downloaded from the official site as node-v4.5.0-linux-x86.tar.xz 

Package: clang-3.4
Version: 1:3.4-1

root@schnauzerpin:/tmp# uname -a
Linux schnauzerpin 3.2.0-4-686-pae #1 SMP Debian 3.2.81-2 i686 GNU/Linux

Tried again after rebooting the system, no change. Confirming that the system is completely up to date, ran "apt-get update" and "upgrade" prior to starting the build.

Issue is 100% reproducible, build fails with same messages each time it's attempted.

The trace at failure point:

obj.target/v8_base/deps/v8/src/heap/incremental-marking-job.o.d.raw -c -o /home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/incremental-marking-job.o ../deps/v8/src/heap/incremental-marking-job.cc
/usr/bin/clang++ '-DV8_TARGET_ARCH_IA32' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8 -I../deps -pthread -Wall -Wextra -Wno-unused-parameter -m32 -msse2 -mfpmath=sse -mmmx -fno-strict-aliasing -m32 -fdata-sections -ffunction-sections -O3 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /home/john/node-latest-install/out/Release/.deps//home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/incremental-marking.o.d.raw -c -o /home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/incremental-marking.o ../deps/v8/src/heap/incremental-marking.cc
/usr/bin/clang++ '-DV8_TARGET_ARCH_IA32' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8 -I../deps -pthread -Wall -Wextra -Wno-unused-parameter -m32 -msse2 -mfpmath=sse -mmmx -fno-strict-aliasing -m32 -fdata-sections -ffunction-sections -O3 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /home/john/node-latest-install/out/Release/.deps//home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/mark-compact.o.d.raw -c -o /home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/mark-compact.o ../deps/v8/src/heap/mark-compact.cc
clang_segfault_files.zip

0 libLLVM-3.4.so.1 0x4110f67f llvm::sys::PrintStackTrace(IO_FILE) + 47
1 libLLVM-3.4.so.1 0x4110f8df
2 libLLVM-3.4.so.1 0x4110f43c
3 0x40000404 kernel_sigreturn + 0
4 clang 0x08dca05f clang::Expr::EvaluateAsInitializer(clang::APValue&, clang::ASTContext const&, clang::VarDecl const
, llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic> >&) const + 47
5 clang 0x08d4ad68 clang::VarDecl::evaluateValue(llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic> >&) const + 168
6 clang 0x08d517eb clang::VarDecl::checkInitIsICE() const + 251
7 clang 0x087cc5dd clang::Sema::ActOnFinishFullExpr(clang::Expr
, clang::SourceLocation, bool, bool, bool) + 1837
8 clang 0x08866ce0 clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr_, true>) + 144
9 clang 0x08611561 clang::Parser::ParseExprStatement() + 145
10 clang 0x0860ad6f clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, bool, clang::SourceLocation_, clang::Parser::ParsedAttributesWithRange&) + 3167
11 clang 0x0860af7d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt_, 32u>&, bool, clang::SourceLocation_) + 173
12 clang 0x0860b86c clang::Parser::ParseCompoundStatementBody(bool) + 892
13 clang 0x085eb593 clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) + 2627
14 clang 0x085ec99f clang::Parser::ParseLambdaExpression() + 431
15 clang 0x085db3c0 clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState) + 7888
16 clang 0x085dc670 clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState) + 80
17 clang 0x085dd7fa clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 90
18 clang 0x085dda8c clang::Parser::ParseExpressionList(llvm::SmallVectorImplclang::Expr_&, llvm::SmallVectorImplclang::SourceLocation&, void (clang::Sema::)(clang::Scope, clang::Expr_, llvm::ArrayRefclang::Expr_), clang::Expr_) + 220
19 clang 0x085e0ddf clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr_, true>) + 3279
20 clang 0x085d95d8 clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState) + 232
21 clang 0x085dc670 clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState) + 80
22 clang 0x085dd7fa clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 90
23 clang 0x085de5ca clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 58
24 clang 0x08611524 clang::Parser::ParseExprStatement() + 84
25 clang 0x0860ad6f clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, bool, clang::SourceLocation_, clang::Parser::ParsedAttributesWithRange&) + 3167
26 clang 0x0860af7d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt_, 32u>&, bool, clang::SourceLocation_) + 173
27 clang 0x0860b86c clang::Parser::ParseCompoundStatementBody(bool) + 892
28 clang 0x0860dd4a clang::Parser::ParseFunctionStatementBody(clang::Decl_, clang::Parser::ParseScope&) + 234
29 clang 0x085aa35d clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList_) + 1229
30 clang 0x08616da8 clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList_) + 3928
31 clang 0x08617833 clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList_) + 627
32 clang 0x08617ab7 clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList_) + 151
33 clang 0x085c122e clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 638
34 clang 0x085acb84 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec_) + 2916
35 clang 0x085cd35a clang::Parser::ParseInnerNamespace(std::vector<clang::SourceLocation, std::allocatorclang::SourceLocation >&, std::vector<clang::IdentifierInfo_, std::allocatorclang::IdentifierInfo* >&, std::vector<clang::SourceLocation, std::allocatorclang::SourceLocation >&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 474
36 clang 0x085ce02a clang::Parser::ParseNamespace(unsigned int, clang::SourceLocation&, clang::SourceLocation) + 2986
37 clang 0x085c126e clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 702
38 clang 0x085acb84 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec_) + 2916
39 clang 0x085cd35a clang::Parser::ParseInnerNamespace(std::vector<clang::SourceLocation, std::allocatorclang::SourceLocation >&, std::vector<clang::IdentifierInfo_, std::allocatorclang::IdentifierInfo* >&, std::vector<clang::SourceLocation, std::allocatorclang::SourceLocation >&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 474
40 clang 0x085ce02a clang::Parser::ParseNamespace(unsigned int, clang::SourceLocation&, clang::SourceLocation) + 2986
41 clang 0x085c126e clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 702
42 clang 0x085acb84 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec_) + 2916
43 clang 0x085acee4 clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&) + 196
44 clang 0x085a462f clang::ParseAST(clang::Sema&, bool, bool) + 319
45 clang 0x0829d597 clang::ASTFrontendAction::ExecuteAction() + 135
46 clang 0x08413e11 clang::CodeGenAction::ExecuteAction() + 33
47 clang 0x0829dad8 clang::FrontendAction::Execute() + 168
48 clang 0x0827c485 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 261
49 clang 0x082657da clang::ExecuteCompilerInvocation(clang::CompilerInstance_) + 1498
50 clang 0x08260850 cc1_main(char const**, char const**, char const_, void_) + 1120
51 clang 0x0825f7c3 main + 7571
52 libc.so.6 0x41c7be46 __libc_start_main + 230
53 clang 0x08260231
Stack dump:
0. Program arguments: /usr/bin/clang -cc1 -triple i386-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier -main-file-name mark-compact.cc -mrelocation-model static -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu pentium4 -mfpmath sse -target-feature +sse2 -target-feature +mmx -target-linker-version 2.22 -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -coverage-file /home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/mark-compact.o -resource-dir /usr/bin/../lib/clang/3.4 -dependency-file /home/john/node-latest-install/out/Release/.deps//home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/mark-compact.o.d.raw -MT /home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/mark-compact.o -D V8_TARGET_ARCH_IA32 -D ENABLE_DISASSEMBLER -D V8_IMMINENT_DEPRECATION_WARNINGS -D ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC -I ../deps/v8 -I ../deps -internal-isystem /usr/include//c++/4.7 -internal-isystem /usr/include//c++/4.7/i386-linux-gnu -internal-isystem /usr/include//c++/4.7/backward -internal-isystem /usr/include//i386-linux-gnu/c++/4.7 -internal-isystem /usr/bin/../lib/gcc/i486-linux-gnu/4.7/../../../../include/c++/4.7 -internal-isystem /usr/bin/../lib/gcc/i486-linux-gnu/4.7/../../../../include/c++/4.7/i486-linux-gnu -internal-isystem /usr/bin/../lib/gcc/i486-linux-gnu/4.7/../../../../include/c++/4.7/backward -internal-isystem /usr/bin/../lib/gcc/i486-linux-gnu/4.7/../../../../include/i486-linux-gnu/c++/4.7 -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.4/include -internal-externc-isystem /usr/bin/../lib/gcc/i486-linux-gnu/4.7/include -internal-externc-isystem /usr/include/i386-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -Wextra -Wno-unused-parameter -std=gnu++0x -fdeprecated-macro -fdebug-compilation-dir /home/john/node-latest-install/out -ferror-limit 19 -fmessage-length 241 -pthread -mstackrealign -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/mark-compact.o -x c++ ../deps/v8/src/heap/mark-compact.cc

  1. ../deps/v8/src/heap/mark-compact.cc:3502:65: current parser token '}'
  2. ../deps/v8/src/heap/mark-compact.cc:32:1: parsing namespace 'v8'
  3. ../deps/v8/src/heap/mark-compact.cc:33:1: parsing namespace 'internal'
  4. ../deps/v8/src/heap/mark-compact.cc:3498:71: parsing function body 'UpdatePointersInParallel'
  5. ../deps/v8/src/heap/mark-compact.cc:3498:71: in compound statement ('{}')
  6. ../deps/v8/src/heap/mark-compact.cc:3502:13: lambda expression parsing
  7. ../deps/v8/src/heap/mark-compact.cc:3502:40: in compound statement ('{}')
    clang: error: unable to execute command: Segmentation fault
    clang: error: clang frontend command failed due to signal (use -v to see invocation)
    Debian clang version 3.4-1 (tags/RELEASE_34/final) (based on LLVM 3.4)
    Target: i386-pc-linux-gnu
    Thread model: posix
    clang: note: diagnostic msg: PLEASE submit a bug report to http://bugs.debian.org/ and include the crash backtrace, preprocessed source, and associated run script.
    clang: note: diagnostic msg:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/mark-compact-56b74e.cpp
clang: note: diagnostic msg: /tmp/mark-compact-56b74e.sh
clang: note: diagnostic msg:


make[1]: *** [/home/john/node-latest-install/out/Release/obj.target/v8_base/deps/v8/src/heap/mark-compact.o] Error 254
make[1]: Leaving directory `/home/john/node-latest-install/out'
make: *** [node] Error 2

-- System Information:
Debian Release: 7.11
APT prefers oldstable-updates
APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages clang-3.4 depends on:
ii libc6 2.13-38+deb7u11
ii libclang-common-3.4-dev 1:3.4-1
ii libclang1-3.4 1:3.4-1
ii libffi5 3.0.10-3
ii libgcc1 1:4.7.2-5
ii libllvm3.4 1:3.4-1
ii libstdc++6 4.7.2-5
ii libstdc++6-4.7-dev 4.7.2-5
ii libtinfo5 5.9-10
ii zlib1g 1:1.2.7.dfsg-13

Versions of packages clang-3.4 recommends:
ii llvm-3.4-dev 1:3.4-1
ii python 2.7.3-4+deb7u1

clang-3.4 suggests no packages.

-- no debconf information

@addaleax addaleax added build Issues and PRs related to build files or the CI. v4.x labels Sep 8, 2016
@addaleax
Copy link
Member

addaleax commented Sep 8, 2016

Sounds like a duplicate of #8323 to me. That was fixed by #8343 which is marked dont-land-on-v4.x@ofrobots ?

@addaleax addaleax added the v8 engine Issues and PRs related to the V8 dependency. label Sep 8, 2016
@ofrobots
Copy link
Contributor

ofrobots commented Sep 8, 2016

@SoCalBeachrunner Are you sure you have the correct source tarball? The source in v4.5.0 doesn't match the ICE backtrace you posted.

1. ../deps/v8/src/heap/mark-compact.cc:3502:65: current parser token '}'
2. ../deps/v8/src/heap/mark-compact.cc:32:1: parsing namespace 'v8'

It does match the source code for v6.5.0 however, which is expected to hit this ICE with clang-3.4-1.

@SoCalBeachrunner
Copy link
Author

Agreed. #8323 didn't turn up in my search. Have read both items and code changes now. Thanks for fast reply. I"ve updated code and restarted my build. It takes a while...

@SoCalBeachrunner
Copy link
Author

You know your code best and must be correct. I made a couple download attempts plus re-started all this 3x in the middle of night, first with the tar file then curl piped into the directory, just trying to get node building on the box. I thought this time it was back to the 4.5.0 tar but apparently it's the 6.5.0 from using curl of "latest" at about 2 AM PST. The builds run for hours before failing, long night.

@SoCalBeachrunner
Copy link
Author

Perhaps admin wants to correct this post title & version. I appreciate your great work maintaining this project & will confirm build outcome when available. BTW this began because the version 4 binary download wouldn't run on this box. node returned "Illegal instruction" hence decided to see if building locally might work. Really aiming just for v4 node to match the AWS environment, may update the OS over the weekend.

@SoCalBeachrunner
Copy link
Author

Just confirming details and that the outcome after a clean start concluded with "Illegal instruction" late in the build after applying "deps: workaround clang-3.4 ICE". If this is as expected I'll close this issue.

Source obtained (2016-09-07-19:33 PDT):
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1

Edited per:
870faee

Configured as:
./configure --prefix=~/local --without-intl

Local env:
Linux version 3.2.0-4-686-pae ([email protected]) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.81-2
VERSION="7 (wheezy)"
ii clang-3.4 1:3.4-1 i386
ii python 2.7.3-4+deb7u1 all
ii make 3.81-8.2 i386

tail of output:
/usr/bin/clang++ -pthread -rdynamic -m32 -m32 -o /home/john/node-latest-install/out/Release/mksnapshot -Wl,--start-group /home/john/node-latest-install/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/mksnapshot.o /home/john/node-latest-install/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /home/john/node-latest-install/out/Release/obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a /home/john/node-latest-install/out/Release/obj.target/deps/v8/tools/gyp/libv8_libplatform.a /home/john/node-latest-install/out/Release/obj.target/deps/v8/tools/gyp/libv8_libbase.a -Wl,--end-group -ldl -lrt
LD_LIBRARY_PATH=/home/john/node-latest-install/out/Release/lib.host:/home/john/node-latest-install/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /home/john/node-latest-install/out/Release/obj.target/v8_snapshot/geni; "/home/john/node-latest-install/out/Release/mksnapshot" --startup_src "/home/john/node-latest-install/out/Release/obj.target/v8_snapshot/geni/snapshot.cc" ""
Illegal instruction
make[1]: *** [/home/john/node-latest-install/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 132
make[1]: Leaving directory `/home/john/node-latest-install/out'
make: *** [node] Error 2

@ofrobots ofrobots changed the title build of node 4.5.0 fails on Debian Wheezy because clang++ seg faults at mark-compact.cc Crash in mksnapshot while building 4.5.0 on debian wheezy Sep 9, 2016
@ofrobots
Copy link
Contributor

ofrobots commented Sep 9, 2016

@SoCalBeachrunner what is the exact CPU you are trying to build this on? e.g. can you provide the output of grep "model name" /proc/cpuinfo. I suspect you are using an older x86-32 processor and the compiler is generating an instructions that your CPU doesn't support.

Do you still see the crash when you configure with --without-snapshot?

@ofrobots
Copy link
Contributor

ofrobots commented Sep 9, 2016

I just noticed this higher up:

BTW this began because the version 4 binary download wouldn't run on this box.

Based on that, I don't think --without-snapshot would help. The compiler is probably defaulting to an instruction set that your CPU doesn't support. Depending on what precise CPU you have there may be a -march option that avoids this problem. (Assuming that the JIT compiler in V8 has a mode that also supports your CPU).

@SoCalBeachrunner
Copy link
Author

model name : Pentium II (Klamath), an old CPU, probably the root cause.
Up to now everything in each distro has built and run without problems. I'm happy to pursue this to conclusion if you have a suggestion or pointer for best arch option(s) to test, will give it a try if it benefits the nodejs or v8 projects in terms of limited CPUs. If you don't want to spend time on what might be an edge case just say the word and we can close this. I'll find a newer box and run Jessie.

@bnoordhuis
Copy link
Member

The machine code that V8 emits has a hard dependency on SSE so that rules out the Pentium II. There is a x87 backend but node.js doesn't support it and it's untested. You could hack configure and see if it works for you, grep for valid_arch.

@SoCalBeachrunner
Copy link
Author

Hacked to support: ./configure --without-intl --dest-cpu=x87 --prefix=~/local
make install succeeds but node still returns "Illegal instruction"
Thanks, all, for your fast and informed responses. We can put this to rest now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

4 participants