nodejs / nodejs/node-gyp

impossible to redefine GCC_ENABLE_CPP_RTTI in an addon's common.gypi

Open
#2,412 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

  • Node Version: At least since Node 12.x
  • Platform: All OSX versions
  • Compiler: all XCode versions
  • Module: node-gdal-async

The way Node's common.gypi is included, by using -I and at the end of the list, makes it impossible for an addon to override the xcode_settings in its own common.gypi. RTTI is disabled by default in Node.js. Enabling it on Linux is possible, since one has to remove the cflags_cc element:

"cflags_cc!": ["-fno-rtti", "-fno-exceptions"]

When there are both cflags_cc and cflags_cc!, the negative one takes precedence.
However on OSX, this is a setting:

"xcode_settings": {
  "GCC_ENABLE_CPP_RTTI": "YES",
  "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
 }

In this case the last one to modify it, wins.
One can still override it in the gyp file itself, but it is not possible to override it in an include file.
I have 105 gyp files (lots of plugins) in node-gdal-async and I simply need to be able to specify options in the include file.

Maybe include the project's own common.gypi after the one from Node.js?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how Node's common.gypi is included with -I and how include ordering affects xcode_settings, using the node-gdal-async setup as the reproduction. Done means an addon's own common.gypi can override GCC_ENABLE_CPP_RTTI and related settings without editing every gyp file.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs
Domain
build-system, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.