Comments (3)
Slight progress. Here's what I did...
- Fork this repo
- Comment out the flags (that didn't work)
- Put the flags back in
I then got a different error even though I hadn't changed anything.
New error:
# [github.com/Automattic/napi-go](http://github.com/Automattic/napi-go)
../../../go/pkg/mod/github.com/!automattic/[email protected]/instance_data.go:5:10: fatal error: 'node/node_api.h' file not found
#include <node/node_api.h>
^~~~~~~~~~~~~~~~~
1 error generated.
Figured that out - it was because napi-go expects node to be at /usr/local/include/node
and mine is under .nvm
.
So I did this:
sudo ln -s /Users/<username>/.nvm/versions/node/v21.7.3/include/node /usr/local/include/node
(I also added node-gyp with these commands, and my simple binding.gyp file that does nothing is in the above linked repo)
yarn add -D node-gyp
- then add a
binding.gyp
file node-gyp configure
(requires the binding.gyp file)node-gyp build
SO NOW
I run this:
go build -buildmode=c-shared -o "example.node" .
and we have this error:
cgo: cannot parse $WORK/b046/_cgo_.o as ELF, Mach-O, PE or XCOFF
and I think I might post on stack overflow? I see some other issues of this online but I haven't been able to figure out the solution
from napi-go.
@annie-elequin are you on mac arm ?
We had a similar issue and we fixed it by editing the various node_api_...flags to adjust the -arch x86_64
Note: We also used go1.18 to make it work though, not sure if it works on 1.19+
from napi-go.
@ACenterA
yes that did it!
here are the changes to our flags that we made that worked:
from napi-go.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from napi-go.