This is my first time writing a nodejs addon and been trying to make node-addon-api package work for hours but I dont get clang to find the napi header file thus i dont get
autocompletion in vim and compiler throws a fatal error about it. I've followed node-addon-examples repo but nothing works.
In vim, when including the header file i get this message:
✘ 3 #include <napi.h>
4 'napi.h' file not found
5 int main(in [clang: pp_file_not_found]
And compiler throws:
cc1: warning: /usr/include/node/node_api.h: not a directory
/home/prxvvy/workspace/a/source/main.c:3:10: fatal error: napi.h: No such file or directory
3 | #include <napi.h>
| ^~~~~~~~
However if I include the node_api header directly like this it does work because, as far as I know when installed nodejs the header files were installed in /usr/include/node but I feel like its not the best way to do the job.
3 #include <node/node_api.h>
4
My binding.gyp file is:
1 {
2 "targets": [
3 {
4 "target_name": "lib",
5 "cflags!": ["-fno-exceptions"],
6 "cflags_cc!": ["-fno-exceptions"],
7 "cflags": ["-Wall", "-Wno-psabi", "-std=c++14", "-pthread"],
8 "cflags_cc": ["-Wall", "-Wno-psabi", "-pthread"],
9 "sources": ["./source/lib.c", "./source/lib.h", "./source/main.c"],
10 "include_dirs": [
11 "<!(node -p \"require('node-addon-api').include_dir\")",
12 "../node_modules/node-addon-api",
13 "node_modules/node-addon-api",
14 "/usr/include/node",
15 "/usr/local/include/node",
16 ],
17 "dependencies": ["<!(node -p \"require('node-addon-api').gyp\")"],
18 "defines": ["NAPI_CPP_EXCEPTIONS"],
19 }
20 ]
21 }
~
I'd like to get some help if im missing something to do
This:
"<!(node -p \"require('node-addon-api').include_dir\")"
Should be:
"<!(node -p \"require('node-addon-api').include\")"
If you launch this in your root package directory:
node -p "require('node-addon-api')"
You should get meaningful output
If you are willing to use CMake.js instead of gyp, then you can add
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
to your CMakeLists.txt and clang will be able to find the headers.
For example, you can try following these steps:
Clone this example repo
cd node-addon-examples/build_with_cmake/node-addon-api
Add set(CMAKE_EXPORT_COMPILE_COMMANDS 1) to the CMakeLists.txt
npm i
cd build
cmake ..
Now when you open up node-addon-examples/build_with_cmake/node-addon-api/hello.cc, you should not get errors for napi.h or the rest of the file.
Related
I'm using the fact-extractor (link) to run their example of extracting info from the football wiki pages. I've installed and tested all dependencies on windows and when I execute "make extract-pages", i get the following error:
(dbpenv) C:\dbpedia\fact-extractor-master>make extract-pages
mkdir workspace-en
bzcat enwiki-latest-pages-articles.xml.bz2 | python lib/WikiExtractor.py -o workspace-en/pages
File "lib/WikiExtractor.py", line 598
print id, title.encode('utf-8')
^
SyntaxError: invalid syntax
bzcat: I/O or other error, bailing out. Possible reason follows.
bzcat: Invalid argument
Input file = enwiki-latest-pages-articles.xml.bz2, output file = (stdout)
make: *** [Makefile:39: extract-pages] Error 1
I can't make sense of the error. This is an as-is codebase from their repo so I'm not really sure how to fix this.
When I add MetaLink to all send nodes in the following code, the Metalink on #ifTrue: not works:
aMethod
10 = 11
ifTrue: [ ^ 3 ]
code to add MetaLinks:
ast sendNodes do: [ :n |
n link: (MetaLink new
metaObject: [ :node |
Transcript show: node asString; cr ];
arguments: #(node);
selector: #value:;
control: #before;
yourself) ]
Can anyone explain why this happens?
How can I add a MetaLink on a #ifTrue: send?
Thanks to the comment from # LeandroCaniglia, this is because of compile optimization.
You can uncheck Inline If in Opal Compiler settings and recompile the method.
After recompile, reinstall your Metalinks and you will see #ifTrue: as a message call.
i am trying to install the tomcat6 module into the agent.i already download module from puppetlab.and try to connect to server i am getting the following error.
Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: No matching value for selector param 'undef' at
/etc/puppet/modules/yum_priorities/manifests/init.pp:19..
the init.pp file contains for yum_priorities
14 class yum_priorities {
15
16 $yum_priorities = $lsbmajdistrelease ? {
17 /4|6/ => 'yum-plugin-priorities',
18 '5' => 'yum-priorities',
19 }
20
21 package {$yum_priorities :
22 ensure => installed,
23 }
my site.pp file in manifest
27 node 'puppet_client'
28 {
29 include tomcat6
30 }
tomcat have dependency on yum_priorities
I can't add comments so I have to "answer it" :). Anyways, as answered by Ger Apeldoorn facter can't get value of lsbmajdistrelease.
On Redhat/CentOS find which package you are missing:
yum whatprovides lsb_release
Or simply install it:
yum install redhat-lsb-core
This will fix it.
Looks like that $lsbmajdistrelease is not defined.
Try to add the proper scope (global): $::lsbmajdistrelease
Facter should give you that global variable, you can run facter manually and see if there's an error.
facter lsbmajdistrelease
Print out a notify statement on line 20 inside class yum_priorities. Something like :
notify {"I AM SEEING THIS ... ${yum_priorities}" :}
and also somewhere inside the module tomcat6.
and check what you get when you run puppet agent. If it is empty means it hasn't been propagated properly.
One other comment is that, it may not be a good coding example to have the same name for a class and a variable, i.e. yum_priorities.
Today one of our devs had "error 9009" from my subwcrev post-build command. It worked fine in the command line. What fixed it was restarting Visual Studio. A couple of other people found that updating SVN and/or ensuring it's on the path were the culprits;
http://forum.battleclinic.com/index.php?topic=42617.0;Building-problems
http://www.autismcollaborative.org/wiki/index.php?title=Troubleshooting
I was surprised not to see a list of SubWcRev's error code's and their meanings. Does anyone know where to find that? thank you!
You can find the error codes in the source.
// Internal error codes
#define ERR_SYNTAX 1 // Syntax error
#define ERR_FNF 2 // File/folder not found
#define ERR_OPEN 3 // File open error
#define ERR_ALLOC 4 // Memory allocation error
#define ERR_READ 5 // File read/write/size error
#define ERR_SVN_ERR 6 // SVN error
// Documented error codes
#define ERR_SVN_MODS 7 // Local mods found (-n)
#define ERR_SVN_MIXED 8 // Mixed rev WC found (-m)
#define ERR_OUT_EXISTS 9 // Output file already exists (-d)
#define ERR_NOWC 10 // the path is not a working copy or part of one
Remove it from: Project--> Properties ---> Build Event --> Pre build event command line
subwcrev "$(SolutionDir)." "$(ProjectDir)Properties\AssemblyInfoTemplate.cs" "$(ProjectDir)Properties\AssemblyInfo.cs" -f
Then build the project
When I'm trying to package a midlet with obfuscation, the following is displayed on the output window:
pre-init:
pre-load-properties:
exists.config.active:
exists.netbeans.user:
exists.user.properties.file:
load-properties:
exists.platform.active:
exists.platform.configuration:
exists.platform.profile:
basic-init:
cldc-pre-init:
cldc-init:
cdc-init:
ricoh-pre-init:
ricoh-init:
semc-pre-init:
semc-init:
savaje-pre-init:
savaje-init:
sjmc-pre-init:
sjmc-init:
cdc-hi-pre-init:
cdc-hi-init:
nokiaS80-pre-init:
nokiaS80-init:
nsicom-pre-init:
nsicom-init:
post-init:
init:
conditional-clean-init:
conditional-clean:
deps-jar:
pre-preprocess:
do-preprocess:
Pre-processing 0 file(s) into C:\Meljean's Files\NetBeansProjects\SampleApp\build\preprocessed directory.
post-preprocess:
preprocess:
pre-compile:
extract-libs:
Expanding: C:\Meljean's Files\LWUIT_1_4\lib\LWUIT.jar into C:\Meljean's Files\NetBeansProjects\SampleApp\build\compiled
do-compile:
post-compile:
compile:
pre-obfuscate:
proguard-init:
skip-obfuscation:
proguard:
Error: Expecting class path separator ';' before 's' in argument number 4
C:\Meljean's Files\NetBeansProjects\SampleApp\nbproject\build-impl.xml:427: Obfuscation failed with error code 1.
BUILD FAILED (total time: 0 seconds)
What am I going to do?
Problem might be in the WTK's installation dir.
Lets confirm this:
I guess you are using WIN SYSTEM
I guess your WTK is installed at the path where space comes inbetween.
like for ex : c:\program files\ [space between program & files]
I would suggest you to install WTK on non space dir like c:\WTK
Let me know if this is not the case.