Build and Release

A continuous learner for experience and life.

Install Libxmljs Failed on Macosx

Today I am trying to install osmosis on macosx

1
npm i --save osmosis

libxmljs is one of the dependency of it, which is failed during installing, here is the error log:

1
2
3
4
5
6
7
8
9
10
...
3 warnings generated.
  CC(target) Release/obj.target/libxml/vendor/libxml/xpointer.o
  LIBTOOL-STATIC Release/xml.a
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make: *** [Release/xml.a] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
...

Search with Google, found some cues, but not total same. I remember I installed libtool with port to fix a build error before, so the root cause should be two different libtools installed on my macosx:

1
2
3
$ which -a libtool
/usr/local/bin/libtool
/usr/bin/libtool

Verify if installed with port:

1
2
3
4
5
$ port installed
The following ports are currently installed:
  ...
  libtool @2.4.6_2 (active)
  ...

Uninstall the one which port installed:

1
$ sudo port uninstall libtool

Then try to compile libxmljs component:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
3 warnings generated.
  CC(target) Release/obj.target/libxml/vendor/libxml/xpointer.o
  LIBTOOL-STATIC Release/xml.a
  CXX(target) Release/obj.target/xmljs/src/libxmljs.o
  CXX(target) Release/obj.target/xmljs/src/xml_attribute.o
  CXX(target) Release/obj.target/xmljs/src/xml_document.o
  CXX(target) Release/obj.target/xmljs/src/xml_element.o
  CXX(target) Release/obj.target/xmljs/src/xml_comment.o
  CXX(target) Release/obj.target/xmljs/src/xml_namespace.o
  CXX(target) Release/obj.target/xmljs/src/xml_node.o
  CXX(target) Release/obj.target/xmljs/src/xml_sax_parser.o
  CXX(target) Release/obj.target/xmljs/src/xml_syntax_error.o
  CXX(target) Release/obj.target/xmljs/src/xml_text.o
  CXX(target) Release/obj.target/xmljs/src/xml_xpath_context.o
  SOLINK(target) Release/xmljs.node

The problem is resolved!

References:

  1. https://github.com/Homebrew/homebrew/issues/28442
  2. https://github.com/rc0x03/node-osmosis

Written with StackEdit.

Comments