Git Product home page Git Product logo

Comments (14)

dachev avatar dachev commented on August 17, 2024 2

It has to be something with Catalina or your particular system. I'll research if there is anything in MacOS 10.15 standard libraries that could be breaking it.

from node-cld.

dachev avatar dachev commented on August 17, 2024 1

Hi @saqib-ahmed, @oliverjessner is right. [email protected] supports only node 12+. You should be able to build [email protected] for node 4. Can you try that and if it fails please paste the complete terminal output starting with the npm command and everything after.

from node-cld.

dachev avatar dachev commented on August 17, 2024 1

Thank you for the research and for sharing your fix @saqib-ahmed. Much appreciated.

from node-cld.

oliverjessner avatar oliverjessner commented on August 17, 2024

I think most of the libs are dropping support for older node version.
Maybe you find a way to update/migrate your node

from node-cld.

saqib-ahmed avatar saqib-ahmed commented on August 17, 2024

Is there any way I can keep my node version and make cld work?
I even tried installing [email protected] but it didn't work either.

from node-cld.

saqib-ahmed avatar saqib-ahmed commented on August 17, 2024

Here you go:

npm i [email protected]                                                                                              1 ↵  8.95   17:43:42 
npm WARN engine [email protected]: wanted: {"node":">=12.0.0"} (current: {"node":"4.9.1","npm":"2.15.11"})
/
> [email protected] install /Users/saqib/dev/SixLogixs/bb-backend/node_modules/cld
> node-gyp rebuild

  CXX(target) Release/obj.target/cld-c/deps/cld/internal/cldutil.o
In file included from ../deps/cld/internal/cldutil.cc:20:
In file included from ../deps/cld/internal/cldutil.h:25:
In file included from ../deps/cld/internal/scoreonescriptspan.h:81:
../deps/cld/internal/compact_lang_det_impl.h:22:10: fatal error: 'vector' file not found
#include <vector>
         ^~~~~~~~
1 error generated.
make: *** [Release/obj.target/cld-c/deps/cld/internal/cldutil.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/saqib/.nvm/versions/node/v4.9.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/Users/saqib/.nvm/versions/node/v4.9.1/bin/node" "/Users/saqib/.nvm/versions/node/v4.9.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/saqib/dev/SixLogixs/bb-backend/node_modules/cld
gyp ERR! node -v v4.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Darwin 19.3.0
npm ERR! argv "/Users/saqib/.nvm/versions/node/v4.9.1/bin/node" "/Users/saqib/.nvm/versions/node/v4.9.1/bin/npm" "i" "[email protected]"
npm ERR! node v4.9.1
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the cld package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs cld
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls cld
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/saqib/dev/SixLogixs/bb-backend/npm-debug.log

=

from node-cld.

saqib-ahmed avatar saqib-ahmed commented on August 17, 2024

Looks like there's something wrong with my Clang configuration. Doesn't vector come with the standard C++ library?

Here's the output of clang -v:

Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

from node-cld.

saqib-ahmed avatar saqib-ahmed commented on August 17, 2024

This seems to be a similar issue:
pandas-dev/pandas#23424

from node-cld.

dachev avatar dachev commented on August 17, 2024

Does running xcode-select --install help?

from node-cld.

saqib-ahmed avatar saqib-ahmed commented on August 17, 2024

Trying. Will update you.

from node-cld.

saqib-ahmed avatar saqib-ahmed commented on August 17, 2024

@dachev Updating xcode command-line tools didn't help. Any other idea?

from node-cld.

saqib-ahmed avatar saqib-ahmed commented on August 17, 2024

The bewildering thing is that node-gyp rebuild works alright for any cld version (tried various including 0.0.1, 2.4.5, 2.5.1 and so on) when I switch to nodejs v10.x. It fails on 4.x but the error is related to a C++ library not found. If the library is the issue, it shouldn't work for any nodejs version. What do you think?

from node-cld.

saqib-ahmed avatar saqib-ahmed commented on August 17, 2024

After a bit more debugging, tried to see the compiler command that node-gyp runs in case of both the node versions.
v4.9.1: fails with the error posted above

c++ '-DNODE_GYP_MODULE_NAME=cld-c' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' -I/Users/saqib/.node-gyp/4.9.1/include/node -I/Users/saqib/.node-gyp/4.9.1/src -I/Users/saqib/.node-gyp/4.9.1/deps/uv/include -I/Users/saqib/.node-gyp/4.9.1/deps/v8/include -I../deps/cld/internal  -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=c++98 -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -w -MMD -MF ./Release/.deps/Release/obj.target/cld-c/deps/cld/internal/cldutil.o.d.raw   -c -o Release/obj.target/cld-c/deps/cld/internal/cldutil.o ../deps/cld/internal/cldutil.cc

v10.16.3: succeeds

c++ '-DNODE_GYP_MODULE_NAME=cld-c' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' -I/Users/saqib/.node-gyp/10.16.3/include/node -I/Users/saqib/.node-gyp/10.16.3/src -I/Users/saqib/.node-gyp/10.16.3/deps/openssl/config -I/Users/saqib/.node-gyp/10.16.3/deps/openssl/openssl/include -I/Users/saqib/.node-gyp/10.16.3/deps/uv/include -I/Users/saqib/.node-gyp/10.16.3/deps/zlib -I/Users/saqib/.node-gyp/10.16.3/deps/v8/include -I../deps/cld/internal  -Os -gdwarf-2 -mmacosx-version-min=10.7 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=c++98 -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -w -MMD -MF ./Release/.deps/Release/obj.target/cld-c/deps/cld/internal/cldutil.o.d.raw   -c -o Release/obj.target/cld-c/deps/cld/internal/cldutil.o ../deps/cld/internal/cldutil.cc

Apart from some extra includes and some other flags I didn't understand, the main difference is -stdlib=libc++ flag. All I need is the cld build with the correct node version, so I'm gonna try and execute the compiler command with libc++ for node_gyp from 4.9.1. Will close the issue once done.

from node-cld.

saqib-ahmed avatar saqib-ahmed commented on August 17, 2024

Finally, I was able to create a build of node-cld for MacOS Catalina with an older version of nodejs. The problem was really the flag: -stdlib=libc++. macOS Catalina deprecated the use of libstdc++ in favor of libc++. The newer versions of node-gyp do have this change, but older versions do not comply with this, hence the discrepancy. This problem was highlighted apparently in the original error message (first message in this issue):

warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

Just for reference, on an off-chance if anybody needs to build node-cld (or any other nodejs library with native addons for that matter) for nodejs 4.x on MacOS Catalina, you can follow the steps below:

  1. Clone this repository
  2. Checkout to legacy/2.4
  3. Add the following in binding.gyp:
"conditions": [
          [ 'OS=="mac"', {
            "xcode_settings": {
              "OTHER_CPLUSPLUSFLAGS" : [ "-std=c++11", "-stdlib=libc++" ],
              "OTHER_LDFLAGS": [ "-stdlib=libc++" ],
              "MACOSX_DEPLOYMENT_TARGET": "10.7"
            },
          }],
        ]
    }
  ]

OR

  1. You can provide these flags as environment variables:
export CXXFLAGS='-stdlib=libc++ -mmacosx-version-min=10.7'; 
export LDFLAGS='-stdlib=libc++ -mmacosx-version-min=10.7';

Run npm install and there you have it.

from node-cld.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.