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

npm install libxslt fails with compilation errors #20

Closed
cressie176 opened this issue Aug 16, 2015 · 19 comments
Closed

npm install libxslt fails with compilation errors #20

cressie176 opened this issue Aug 16, 2015 · 19 comments

Comments

@cressie176
Copy link

npm install libxslt fails on Yosemite with

  CC(target) Release/obj.target/libexslt/deps/libxslt/libexslt/common.o
In file included from ../deps/libxslt/libexslt/common.c:2:
../deps/libxslt/libexslt/libexslt.h:19:10: fatal error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
         ^
1 error generated.
make: *** [Release/obj.target/libexslt/deps/libxslt/libexslt/common.o] Error 1

I've tried with the latest version of node-gyp. I also tried installing libxmljs out of curiosity and it worked fine. Any ideas what I've missed? Thanks.

@PeterAronZentai
Copy link

The same on Ubuntu 14.04
libxml/xmlversion.h: No such file or directory

@cressie176 cressie176 changed the title npm install libxslt fails on Yosemite npm install libxslt fails Aug 17, 2015
@cressie176 cressie176 changed the title npm install libxslt fails npm install libxslt fails with compilation errors Aug 17, 2015
@AlbanAndrieu
Copy link

Temporary fix is to revert to 0.5.1 version.

@gagern
Copy link
Collaborator

gagern commented Aug 31, 2015

Bumping libxmljs-mt to 0.14.3 I changed some paths, because I turned the libxml upstream into a git submodule. I had assumed that the corresponding path settings would get exported from my gyp files, but apparently that is not the case: the paths in question are encoded on in node-libxslt's common.gypi. If you include a line mentioning <(node_xmljs)/vendor/libxml.conf/include there, everything should be fine. Sorry for the inconvenience.

@mlevin2
Copy link

mlevin2 commented Aug 31, 2015

@gagern Hi there. Was trying to follow your instructions but clearly goofed something up. I think I'm able to get past the missing libxml/xmlversion.h issue, but then I get:

make: *** No rule to make target 'Release/obj.target/libexslt/deps/libxslt/libexslt/common.o', needed by 'Release/exslt.a'. Stop.

Any ideas?

@gagern
Copy link
Collaborator

gagern commented Aug 31, 2015

@mlevin2: Sounds like a missing git submodule update --init.

gagern added a commit to gagern/node-libxslt that referenced this issue Aug 31, 2015
This is where libxmljs-mt keeps its xmlversion.h header file, see albanm#20.
@gagern
Copy link
Collaborator

gagern commented Aug 31, 2015

By the way, I just worked out how to fix this on the libxmljs-mt level as well. So libxmljs-mt@0.14.5 and later should work even without this modification.

But the modification might still useful, in case someone wants do build against a snapshot of libxmljs-mt. I only add the file for compatibility in the prepublish step, and a git clean might remove it. ae1c506 is placing the line in the wrong location, though. See #22 for the correct place to put it.

So feel free to close this here, and merge #22 if you want to cater for exotic build situations, or reject it if you are happy catering for those who either pull the module from the registry in any case (which should be most users) or at least have the decency to do a npm install in the libxmljs-mt directory and leave things alone after that.

@gagern
Copy link
Collaborator

gagern commented Aug 31, 2015

It's not as easy as I had hoped, thanks to #23, which Travis kindly made me aware of. So perhaps you really want to merge #22 since #23 might be a larger beast.

@albanm
Copy link
Owner

albanm commented Aug 31, 2015

Ok, I added the include path at the same time that I fixed libxmljs-mt version in order to prevent nan conflict.

It is a problem that breaking changes in libxmljs for node-libxslt can be released as simple patches. This is because it relies on stuff that is considered internal by libxmljs. I think I might keep a static dependancy (no ~ or ^).

@albanm
Copy link
Owner

albanm commented Aug 31, 2015

0.5.3 just released.

@albanm albanm closed this as completed Aug 31, 2015
@gagern
Copy link
Collaborator

gagern commented Aug 31, 2015

It is a problem that breaking changes in libxmljs for node-libxslt can be released as simple patches. This is because it relies on stuff that is considered internal by libxmljs.

I agree, this is problematic. I considered whether I should be changing the versioning scheme for libxmljs-mt, but I didn't want to deviate too much from libxmljs.

I think I might keep a static dependancy (no ~ or ^).

I believe that's a good idea. If you want me to, I can (try to remember to) file a pull request bumping the version number whenever I do a new release of libxmljs-mt, which in turn would be whenever I find that libxmljs made a release or there is something wrong with the way I deviated from it.

By the way, libxmljs supports iojs 2 in its travis tests since libxmljs/libxmljs#318, and iojs 3 since the nan 2 updates. If you want you can try that out for node-libxslt as well. Just be sure to not manually upgrade npm on those.

@albanm
Copy link
Owner

albanm commented Aug 31, 2015

Ok, thanks.

@mlevin2
Copy link

mlevin2 commented Oct 12, 2015

Hmm, at one point I had this working, but I had to delete my node_modules folder and I guess I hadn't saved the config correctly. I'm now unable to install libxslt on Yosemite. Can anyone point me in the right direction?

  CC(target) Release/obj.target/libxml/vendor/libxml/xpointer.o
  LIBTOOL-STATIC Release/xml.a
  CXX(target) Release/obj.target/xmljs/src/libxmljs.o
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../node_modules/nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                        ^
../node_modules/nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                        ^
../node_modules/nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node'
    , node::smalloc::FreeCallback callback
      ~~~~~~^
../node_modules/nan/nan.h:672:12: error: no matching function for call to 'New'
    return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
           ^~~~~~~~~~~~~~~~~
/Users/mlevin/.node-gyp/4.1.2/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/mlevin/.node-gyp/4.1.2/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *') would lose const qualifier
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/mlevin/.node-gyp/4.1.2/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                       ^
/Users/mlevin/.node-gyp/4.1.2/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../node_modules/nan/nan.h:676:12: error: no viable conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
    return node::Buffer::New(v8::Isolate::GetCurrent(), size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' for 1st argument
class Local {
      ^
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object> &&' for 1st argument
class Local {
      ^
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
  V8_INLINE Local(Local<S> that)
            ^
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::MaybeLocal<v8::Object>'
  V8_INLINE Local(S* that)
            ^
In file included from ../src/libxmljs.cc:7:
In file included from ../src/libxmljs.h:7:
../node_modules/nan/nan.h:683:26: error: no member named 'Use' in namespace 'node::Buffer'
    return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
           ~~~~~~~~~~~~~~^
In file included from ../src/libxmljs.cc:3:
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:414:12: note: in instantiation of function template specialization 'v8::Local<v8::Primitive>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/libxmljs.cc:3:
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Boolean *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:424:12: note: in instantiation of function template specialization 'v8::Local<v8::Boolean>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/libxmljs.cc:3:
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Function *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1514:12: note: in instantiation of function template specialization 'v8::Local<v8::Function>::Local<v8::Value>' requested here
    return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
In file included from ../src/libxmljs.cc:3:
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Object *volatile' from incompatible type 'v8::Value *'
    TYPE_CHECK(T, S);
    ^~~~~~~~~~~~~~~~
/Users/mlevin/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
    *(static_cast<T* volatile*>(0)) = static_cast<S*>(0);      \
                                    ^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1632:12: note: in instantiation of function template specialization 'v8::Local<v8::Object>::Local<v8::Value>' requested here
    return NanEscapeScope(handle->Get(NanNew(key)).As<v8::Object>());
           ^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
                             ^
9 errors generated.
make: *** [Release/obj.target/xmljs/src/libxmljs.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/Cellar/node/4.1.2/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mlevin/project/node_modules/libxmljs-mt
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:libxmljs-mt libxmljs-mt@0.14.3 install: `node-gyp rebuild`
npm WARN install:libxmljs-mt Exit status 1

@gagern
Copy link
Collaborator

gagern commented Oct 12, 2015

@mlevin2 Try using libxmljs-mt 0.14.5. If it does work, changing the package.json might make sense.

@gagern
Copy link
Collaborator

gagern commented Oct 12, 2015

Sorry, no, 0.14.5 is nan2, requires #23 addressed. Manually performing the prepublish step from gagern/libxmljs@0fe2b62 should work:

cp vendor/libxml.conf/include/libxml/xmlversion.h vendor/libxml/include/libxml/

If that doesn't help, you might be seeing some different issue which only looks the same at first glance. Since your pasted code doesn't mention xmlversion.h, I consider this pretty likely. @mlevin2 what version of node is that you're trying to compile against?

@mlevin2
Copy link

mlevin2 commented Oct 13, 2015

@gagern node 4.2.0, npm 2.14.7, node-gyp 3.0.3, OSX Yosemite.

I'm getting farther. Here's the status:

  • npm install libxmljs-mt@0.14.5 from my project directory succeeds for me
  • I cloned node-libxslt and changed package.json to use libxmljs-nt 0.14.5 instead
  • Then, from my project directory, I tried npm link <path to>/node-libxsltand got these errors:
> libxslt@0.5.4 install /Users/mlevin/forked/node-libxslt
> node-gyp rebuild

make: *** No rule to make target `Release/obj.target/libexslt/deps/libxslt/libexslt/common.o', needed by `Release/exslt.a'.  Stop.
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/Cellar/node/4.2.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mlevin/forked/node-libxslt
gyp ERR! node -v v4.2.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/4.2.0/bin/node" "/usr/local/bin/npm" "link" "../forked/node-libxslt"
npm ERR! node v4.2.0
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! libxslt@0.5.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the libxslt@0.5.4 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the libxslt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls libxslt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/mlevin/project/npm-debug.log

@gagern
Copy link
Collaborator

gagern commented Oct 14, 2015

Node 4 support requires #23 being addressed.

@mlevin2
Copy link

mlevin2 commented Oct 14, 2015

Thanks, I'll give your update a try.

@mlevin2
Copy link

mlevin2 commented Oct 14, 2015

@gagern success! I'm a dummy and had another problem but I was able to merge in your nan2 branch and get everything working. Thanks so much for your help.

@gagern gagern mentioned this issue Oct 15, 2015
@rainabba
Copy link

I use WSL 1.x and Docker Desktop 2.0.x on Windows 10 1903, with linked volumes that are on my NTFS filesystem. These types of errors are impossible for me to get around with any of the suggested hacks. What DOES work is to create a temp folder inside my container volume (not linked), cp my package.json and yarn.lock there; then from there yarn install and after, mv node_modules back to my project. This has helped me address any number of npm and yarn errors in my environment and I keep coming back to the way Docker for Windows exposes the filesystem which leads to async IO issues. My thoughts FWIW.

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

7 participants