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

Can't build on macos #382

Closed
nullbyteptr opened this issue Feb 14, 2023 · 3 comments
Closed

Can't build on macos #382

nullbyteptr opened this issue Feb 14, 2023 · 3 comments
Assignees

Comments

@nullbyteptr
Copy link

nullbyteptr commented Feb 14, 2023

Getting following error

node-libcurl % npm_config_build_from_source=true npm_config_curl_static_build=true npm_config_curl_include_dirs="$(xcrun --show-sdk-path)/usr/include" yarn add node-libcurl
yarn add v1.22.18
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
warning np@7.6.2: The engine "git" appears to be invalid.
[4/5] 🔗  Linking dependencies...
warning " > tslint-config-airbnb@5.11.2" has incorrect peer dependency "tslint@^5.11.0".
warning "tslint-config-airbnb > tslint-consistent-codestyle@1.16.0" has incorrect peer dependency "tslint@^5.0.0".
warning "tslint-config-airbnb > tslint-eslint-rules@5.4.0" has incorrect peer dependency "tslint@^5.0.0".
warning "tslint-config-airbnb > tslint-eslint-rules@5.4.0" has incorrect peer dependency "typescript@^2.2.0 || ^3.0.0".
warning "tslint-config-airbnb > tslint-microsoft-contrib@5.2.1" has incorrect peer dependency "tslint@^5.1.0".
warning "tslint-config-airbnb > tslint-microsoft-contrib@5.2.1" has incorrect peer dependency "typescript@^2.1.0 || ^3.0.0".
warning "tslint-config-airbnb > tslint-consistent-codestyle > @fimbul/bifrost@0.21.0" has incorrect peer dependency "tslint@^5.0.0".
warning " > typedoc-plugin-nojekyll@1.0.1" has incorrect peer dependency "typedoc@^0.11.1".
[5/5] 🔨  Building fresh packages...
[1/3] ⠠ core-js
[2/3] ⠠ husky
error /Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.10
node-pre-gyp info using node@16.11.1 | darwin | x64
node-pre-gyp info build requesting source compile
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.0
gyp info using node@16.11.1 | darwin | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.0
gyp info using node@16.11.1 | darwin | x64
gyp info find Python using Python version 3.8.2 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/nullbyte/Library/Caches/node-gyp/16.11.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/nullbyte/Library/Caches/node-gyp/16.11.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/nullbyte/Library/Caches/node-gyp/16.11.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@9.3.0
gyp info using node@16.11.1 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/node_libcurl/src/node_libcurl.o
  CXX(target) Release/obj.target/node_libcurl/src/Easy.o
  CXX(target) Release/obj.target/node_libcurl/src/Share.o
  CXX(target) Release/obj.target/node_libcurl/src/Multi.o
  CXX(target) Release/obj.target/node_libcurl/src/Curl.o
  CXX(target) Release/obj.target/node_libcurl/src/CurlHttpPost.o
  CXX(target) Release/obj.target/node_libcurl/src/CurlVersionInfo.o
../src/CurlVersionInfo.cc:19:6: warning: unused function 'SetObjPropertyToNullOrValue' [-Wunused-function]
void SetObjPropertyToNullOrValue<v8::Local<v8::Primitive>>(v8::Local<v8::Object> obj,
     ^
1 warning generated.
  CXX(target) Release/obj.target/node_libcurl/src/Http2PushFrameHeaders.o
  SOLINK_MODULE(target) Release/node_libcurl.node
clang: error: no such file or directory: '/usr/lib/libcurl.@libext@'
clang: error: no such file or directory: '@LDFLAGS@'
clang: error: no such file or directory: '@LIBCURL_LIBS@'
make: *** [Release/node_libcurl.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/usr/local/bin/node" "/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl/lib/binding/node_libcurl.node" "--module_name=node_libcurl" "--module_path=/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl/lib/binding" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
gyp ERR! cwd /Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl
gyp ERR! node -v v16.11.1
gyp ERR! node-gyp -v v9.3.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl/lib/binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Darwin 20.6.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl
node-pre-gyp ERR! node -v v16.11.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.10
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/nullbyte/WebstormProjects/libcurlnode/node-libcurl/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl

OS: macos big sur 11.6
Node.js Version: Tried 14/16/18

@rick51231
Copy link

There is a problem when compiling with MacOS built-in curl.
A temporary workaround is to install curl from brew and use it.

  • brew install curl
  • export PATH=/usr/local/Cellar/curl/7.87.0/bin/:$PATH
  • npm install node-libcurl

@notjaywu
Copy link

notjaywu commented Jan 8, 2024

A potential problem is:
the brew-installed curl is bulit with --without-ca-bundle --without-ca-path --with-ca-fallback flags.

Not sure if it has any security issues.

@JCMais
Copy link
Owner

JCMais commented Feb 13, 2024

it seems the curl-config file provided with macos has some broken variables:
image

one option is using brew's libcurl, which as mentioned above, or building libcurl from source, the build.sh script inside ./scripts/ci/build.sh could be useful in this case.

Here is an example build command that is used to build everything from source:

LATEST_LIBCURL_RELEASE=7.86.0 LIBCURL_RELEASE=7.86.0 PUBLISH_BINARY="true" ./scripts/ci/build.sh

@JCMais JCMais closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants