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

Build Error #14

Closed
adam-moss opened this issue Oct 24, 2018 · 3 comments
Closed

Build Error #14

adam-moss opened this issue Oct 24, 2018 · 3 comments

Comments

@adam-moss
Copy link

Currently experiencing a build error from node-gyp, and am hoping you may be able to shed some light.

Using macOS with yara installed via homebrew to:

/Users/user/.homebrew/Cellar/yara

Output from npm install is:

$ npm install --save yara --production

> yara@2.1.4 install /Users/user/projects/cli/node_modules/yara
> node-gyp rebuild

  CXX(target) Release/obj.target/yara/src/yara.o
In file included from ../src/yara.cc:13:
In file included from ../src/yara.h:6:
In file included from ../../nan/nan.h:203:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:337:28: warning: 'New' is deprecated
      [-Wdeprecated-declarations]
  return v8::StringObject::New(value).As<v8::StringObject>();
                           ^
/Users/user/.node-gyp/10.12.0/include/node/v8.h:5052:3: note: 'New' has
      been explicitly marked deprecated here
  V8_DEPRECATED("Use Isolate* version",
  ^
/Users/user/.node-gyp/10.12.0/include/node/v8config.h:327:29: note: 
      expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
In file included from ../src/yara.cc:13:
In file included from ../src/yara.h:6:
../../nan/nan.h:1034:44: warning: 'ToString' is deprecated
      [-Wdeprecated-declarations]
      v8::Local<v8::String> string = from->ToString();
                                           ^
/Users/user/.node-gyp/10.12.0/include/node/v8.h:2454:10: note: 'ToString'
      has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<String> ToString() const);
         ^
/Users/user/.node-gyp/10.12.0/include/node/v8config.h:327:29: note: 
      expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
In file included from ../src/yara.cc:13:
In file included from ../src/yara.h:6:
../../nan/nan.h:1044:27: warning: 'WriteUtf8' is deprecated
      [-Wdeprecated-declarations]
        length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags);
                          ^
/Users/user/.node-gyp/10.12.0/include/node/v8.h:2658:3: note: 'WriteUtf8'
      has been explicitly marked deprecated here
  V8_DEPRECATED("Use Isolate* version",
  ^
/Users/user/.node-gyp/10.12.0/include/node/v8config.h:327:29: note: 
      expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
In file included from ../src/yara.cc:13:
../src/yara.h:8:10: error: 'yara.h' file not found with <angled> include; use
      "quotes" instead
#include <yara.h>
         ^~~~~~~~
         "yara.h"
../src/yara.h:29:2: error: unknown type name 'YR_COMPILER'
        YR_COMPILER* compiler;
        ^
../src/yara.h:30:2: error: unknown type name 'YR_RULES'
        YR_RULES* rules;
        ^
../src/yara.cc:71:34: error: use of undeclared identifier 'ERROR_SUCCESS'
        MAP_ERROR_CODE("ERROR_SUCCESS", ERROR_SUCCESS);
                                        ^
../src/yara.cc:72:45: error: use of undeclared identifier
      'ERROR_INSUFICIENT_MEMORY'
        MAP_ERROR_CODE("ERROR_INSUFICIENT_MEMORY", ERROR_INSUFICIENT_MEMORY);
                                                   ^
../src/yara.cc:73:54: error: use of undeclared identifier
      'ERROR_COULD_NOT_ATTACH_TO_PROCESS'
        MAP_ERROR_CODE("ERROR_COULD_NOT_ATTACH_TO_PROCESS", ERROR_COULD_...
                                                            ^
../src/yara.cc:74:46: error: use of undeclared identifier
      'ERROR_COULD_NOT_OPEN_FILE'
        MAP_ERROR_CODE("ERROR_COULD_NOT_OPEN_FILE", ERROR_COULD_NOT_OPEN_FILE);
                                                    ^
../src/yara.cc:75:45: error: use of undeclared identifier
      'ERROR_COULD_NOT_MAP_FILE'
        MAP_ERROR_CODE("ERROR_COULD_NOT_MAP_FILE", ERROR_COULD_NOT_MAP_FILE);
                                                   ^
../src/yara.cc:76:39: error: use of undeclared identifier 'ERROR_INVALID_FILE'
        MAP_ERROR_CODE("ERROR_INVALID_FILE", ERROR_INVALID_FILE);
                                             ^
../src/yara.cc:77:39: error: use of undeclared identifier 'ERROR_CORRUPT_FILE'
        MAP_ERROR_CODE("ERROR_CORRUPT_FILE", ERROR_CORRUPT_FILE);
                                             ^
../src/yara.cc:78:51: error: use of undeclared identifier
      'ERROR_UNSUPPORTED_FILE_VERSION'
        MAP_ERROR_CODE("ERROR_UNSUPPORTED_FILE_VERSION", ERROR_UNSUPPORT...
                                                         ^
../src/yara.cc:79:53: error: use of undeclared identifier
      'ERROR_INVALID_REGULAR_EXPRESSION'
        MAP_ERROR_CODE("ERROR_INVALID_REGULAR_EXPRESSION", ERROR_INVALID...
                                                           ^
../src/yara.cc:80:45: error: use of undeclared identifier
      'ERROR_INVALID_HEX_STRING'
        MAP_ERROR_CODE("ERROR_INVALID_HEX_STRING", ERROR_INVALID_HEX_STRING);
                                                   ^
../src/yara.cc:81:39: error: use of undeclared identifier 'ERROR_SYNTAX_ERROR'
        MAP_ERROR_CODE("ERROR_SYNTAX_ERROR", ERROR_SYNTAX_ERROR);
                                             ^
../src/yara.cc:82:54: error: use of undeclared identifier
      'ERROR_LOOP_NESTING_LIMIT_EXCEEDED'
        MAP_ERROR_CODE("ERROR_LOOP_NESTING_LIMIT_EXCEEDED", ERROR_LOOP_N...
                                                            ^
../src/yara.cc:83:53: error: use of undeclared identifier
      'ERROR_DUPLICATED_LOOP_IDENTIFIER'
        MAP_ERROR_CODE("ERROR_DUPLICATED_LOOP_IDENTIFIER", ERROR_DUPLICA...
                                                           ^
../src/yara.cc:84:48: error: use of undeclared identifier
      'ERROR_DUPLICATED_IDENTIFIER'
        MAP_ERROR_CODE("ERROR_DUPLICATED_IDENTIFIER", ERROR_DUPLICATED_I...
                                                      ^
../src/yara.cc:85:52: error: use of undeclared identifier
      'ERROR_DUPLICATED_TAG_IDENTIFIER'
        MAP_ERROR_CODE("ERROR_DUPLICATED_TAG_IDENTIFIER", ERROR_DUPLICAT...
                                                          ^
../src/yara.cc:86:53: error: use of undeclared identifier
      'ERROR_DUPLICATED_META_IDENTIFIER'
        MAP_ERROR_CODE("ERROR_DUPLICATED_META_IDENTIFIER", ERROR_DUPLICA...
                                                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
make: *** [Release/obj.target/yara/src/yara.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/user/.nvm/versions/node/v10.12.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/user/.nvm/versions/node/v10.12.0/bin/node" "/Users/user/.nvm/versions/node/v10.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/user/projects/cli/node_modules/yara
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! yara@2.1.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the yara@2.1.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
@stephenwvickers
Copy link
Collaborator

Hi @adam-moss

So I can see from the output:

error: 'yara.h' file not found with <angled> include; use

So the issue is clearly that yara.h cannot be found.

On a Mac I ran:

brew install yara
npm install yara

This built and installed as expected (with a few feature deprecatation warnings).

After this I could successfully use the example programs.

On my test system yara.h exists as the symbolic link /usr/local/include/yara.h which points to /usr/local/Cellar/yara/3.8.1_1/include/yara.h.

It doesn't help you, but on a clean test system it seems to work for me :(

@adam-moss
Copy link
Author

Hi @stephenwvickers !

Thanks for the reply. So this is an issue on my machine, and your answer has helpfully pointed me in the right direction 😄

I don't have homebrew installed in the default location, I've actually got it in ~/.homebrew. So as a result I don't have a /usr/local/include but rather a ~/.homebrew/include.

So if I can work out how to inject that in the build process I should be fine 👍

@adam-moss
Copy link
Author

And...

$ export LDFLAGS="-L$(brew --prefix)/opt/yara/lib"
$ export CPPFLAGS="-I$(brew --prefix)/opt/yara/include"

$ npm install --save yara --production

Results in a correct install, with just the deprecation notices you've highlighted 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants