Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not return
/usr/include
path, it will break for gcc.please use find_package.
xmake-repo/packages/l/libiconv/xmake.lua
Line 28 in 1230151
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok no problem, can you explain why ? it seems to work fine for me with gcc-13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh is it because the linux headers have file named
node.h
too ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was only able to find the package with
package:find_package("apt::nodejs")
(i'm on ubuntu).system
andpkgconfig
did not work.the returned table is empty though, even if i pass
{includes = "node_api.h"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm using
local headers_path = find_path("node_api.h", { "/usr/**", "/usr/local/**"})
in my local package for now and everything seems to be working fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will pass
-isystem /usr/include
or-isystem /usr/local/include
to gcc, and it will break gcc.This is a known issue with gcc. If
node_api.h
is in /usr/include and /usr/local/include, gcc will find it even if you don't add-isystem /usr/include
.xmake-io/xmake#4596 (comment)
msys2/MINGW-packages#10761
pcb2gcode/pcb2gcode#587
The
package:find_package("system::xx")
automatically handles this and avoids adding unnecessary-isystem /usr/include
. like thisxmake-repo/packages/l/libiconv/xmake.lua
Line 28 in 1230151
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thank you for the explanation.
The headers are located in
/usr/include/node/
so that's why it is working for me.I still not sure why
package:find_package("system:nodejs")
doesn't find anything but I dug a little more and according to nodejs/node-addon-api#882, there is no way to find the path to the headers that come packaged withnodejs
in a platform agnostic way.However, this issue indirectly links to https://github.com/nodejs/node-api-headers which seems to contain exactly what I need for
node-addon-api
. So I think I should probably create a package from this repo instead.I'll wait for your feedback before creating yet another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can try.
try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still nothing :/
I have made a
node-api-headers
package that works perfectly for me. It as the advantage of being way lighter as it doesn't contain the whole Node runtime + ecosystem but just the headers that I need for my c++ addon. I'll make a PR right now.