Mac M1 fails with include "config.h from analyticscore.cc:20

Trying to npm i couchbase or build it from repo and get these following errors:


> couchbase@3.1.2-dev install
> prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=15.14.0 runtime=node arch=arm64 libc= platform=darwin)
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@15.14.0 | darwin | arm64
gyp info find Python using Python version 3.9.4 found at "/usr/local/bin/python"
gyp info spawn /usr/local/bin/python
gyp info spawn args [
gyp info spawn args   '/Users/pstuart/Documents/couchnode/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/pstuart/Documents/couchnode/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/pstuart/Documents/couchnode/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/pstuart/Library/Caches/node-gyp/15.14.0/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/pstuart/Library/Caches/node-gyp/15.14.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/pstuart/Documents/couchnode/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/pstuart/Library/Caches/node-gyp/15.14.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/pstuart/Documents/couchnode',
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 spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  COPY ../deps/lcb/include/libcouchbase/libuv_io_opts.h
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-libuv.c
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-internal.h
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/analytics/analyticscore.o
In file included from ../deps/lcb/src/analytics/analyticscore.cc:20:
../deps/lcb/src/internal.h:21:10: fatal error: 'config.h' file not found
#include "config.h"
         ^~~~~~~~~~
1 error generated.
make[1]: *** [Release/obj.target/couchbase/deps/lcb/src/analytics/analyticscore.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/pstuart/Documents/couchnode/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:369:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/Users/pstuart/.nvm/versions/node/v15.14.0/bin/node" "/Users/pstuart/Documents/couchnode/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/pstuart/Documents/couchnode
gyp ERR! node -v v15.14.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok 
npm ERR! code 1
npm ERR! path /Users/pstuart/Documents/couchnode
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild```

any help would be greatly appreciated.  I've tried different node versions, python versions, reinstalled xcode and more...

I was able to fix this issue by forking the repo and making an arm64 config folder and copy the config.h file into it.

Full fix is /deps/lcb/gyp_config/mac/ copy x64 folder to /arm64

Package then builds as expected. I’d submit a PR if allowed, not sure the process here for external PRs.

PRs are quite welcome, yep! If you PR to github.com/couchbase/couchnode, you’ll get a nice reply from a friendly bot about next steps with code review, etc.

Thanks, and great to see it was a quick change. That’s what we would have expected with our nice, portable code.

Add Mac M1 arm64 Support by pstuart · Pull Request #106 · couchbase/couchnode · GitHub done and agreed to.

Hey @pstuart ,

It doesn’t look like the system has picked up that you signed the CLA. Can you check your Gerrit profile to ensure the email that the commit is linked to (it shows up in the PR comment) is linked to your Gerrit account?

Cheers, Brett

They may be separate emails, that’s probably the issue. Work vs personal gitlab vs github… Let me see if I can fix

Redid the commit to match my github repo info, but don’t think Gerritt picked it up properly. I’m sure this all makes sense to you but not sure how to fix it at this point.

Hey @pstuart,

I think the Gerrit issue is related to the fact that the pull request contains multiple commits from multiple different email addresses. In the meantime, I’ve created a change-set that effectively covers the same change here:
http://review.couchbase.org/c/couchnode/+/154868

Cheers, Brett

1 Like

It doesn’t look like this has been fixed in the release version of N1QL SDK for Node.js. Any update on when this will be included in the released package.

Any update on if this will get merged in. Been a few months and we can’t use this main branch for our development and are relying on a fork.

Hi
I am building a docker and I also have the same error. Mac M1.
any results here ?