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

Trap hidden in debug gyp settings #30056

Closed
dothebart opened this issue Oct 22, 2019 · 3 comments
Closed

Trap hidden in debug gyp settings #30056

dothebart opened this issue Oct 22, 2019 · 3 comments
Labels
build Issues and PRs related to build files or the CI. v8 engine Issues and PRs related to the V8 dependency.

Comments

@dothebart
Copy link

toolchain.gypi contains this setting:

          ['OS=="linux" and disable_glibcxx_debug==0', {
            # Enable libstdc++ debugging facilities to help catch problems
            # early, see http://crbug.com/65151 .
                        'defines': ['_GLIBCXX_DEBUG=1',],
          }],

which will increase the size of std::vector, and make this assert in V8 spaces.cc fail:

void Space::CheckOffsetsAreConsistent() const {
  DCHECK_EQ(Space::kIdOffset, OFFSET_OF(Space, id_));
}
# Debug check failed: Space::kIdOffset == (reinterpret_cast<intptr_t>(&(reinterpret_cast<Space*>(16)->id_)) - 16) (72 vs. 104).
@addaleax addaleax added the v8 engine Issues and PRs related to the V8 dependency. label Oct 22, 2019
@addaleax
Copy link
Member

@nodejs/v8

@richardlau
Copy link
Member

We do set by default:

node/common.gypi

Lines 33 to 35 in a350d8b

# Some STL containers (e.g. std::vector) do not preserve ABI compatibility
# between debug and non-debug mode.
'disable_glibcxx_debug': 1,

but maybe we should just removed the section from toolchain.gypi if it's not going to work.

@bnoordhuis
Copy link
Member

Untested but I think this should fix it:

diff --git a/common.gypi b/common.gypi
index 78a57d9291..49cfee48b2 100644
--- a/common.gypi
+++ b/common.gypi
@@ -32,7 +32,7 @@
 
     # Some STL containers (e.g. std::vector) do not preserve ABI compatibility
     # between debug and non-debug mode.
-    'disable_glibcxx_debug': 1,
+    'disable_glibcxx_debug%': 1,
 
     # Don't use ICU data file (icudtl.dat) from V8, we use our own.
     'icu_use_data_file_flag%': 0,

toolchain.gypi also defines disable_glibcxx_debug (but sets it to zero) and that takes precedence unless common.gypi defines it as "global".

@bnoordhuis bnoordhuis added the build Issues and PRs related to build files or the CI. label Oct 23, 2019
bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Jan 3, 2020
Different parts of the debug build were using differently sized
std::vectors due to `_GLIBCXX_DEBUG` sometimes being defined and
sometimes not. That ended about as well as you would expect.

Remove the flag.

Fixes: nodejs#30056
BridgeAR pushed a commit that referenced this issue Mar 17, 2020
Different parts of the debug build were using differently sized
std::vectors due to `_GLIBCXX_DEBUG` sometimes being defined and
sometimes not. That ended about as well as you would expect.

Remove the flag.

Fixes: #30056

PR-URL: #30147
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this issue Mar 24, 2020
Different parts of the debug build were using differently sized
std::vectors due to `_GLIBCXX_DEBUG` sometimes being defined and
sometimes not. That ended about as well as you would expect.

Remove the flag.

Fixes: #30056

PR-URL: #30147
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
targos pushed a commit that referenced this issue Apr 22, 2020
Different parts of the debug build were using differently sized
std::vectors due to `_GLIBCXX_DEBUG` sometimes being defined and
sometimes not. That ended about as well as you would expect.

Remove the flag.

Fixes: #30056

PR-URL: #30147
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
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

Successfully merging a pull request may close this issue.

4 participants