42

I am trying to add libvisio in my mac os x from https://wiki.documentfoundation.org/DLP/Libraries/libvisio

I have added all dependancy described there listed bellow:

boost
gperf
icu
librevenge
libxml2
perl
doxygen

After adding dependancies i am trying to run bellow commands.

$ ./autogen.sh ''# only needed for building from git''
$ ./configure
$ make
$ make install

But i having problem with second command $ ./configure

Getting bellow error.

configure: error: Package requirements (
    libxml-2.0
) were not met:

No package 'libxml-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

i have tried to install libxml2 with $ brew install libxml but its says Warning: libxml2-2.9.3 already installed.

I am using OS X 10.11.4

Can some one help me out here. Thanks

Rohan
  • 668
  • 1
  • 6
  • 10

6 Answers6

113

For Ubuntu the following helped me:

apt-get install libxml2-dev
Maksim Iakunin
  • 428
  • 1
  • 4
  • 21
Xolani
  • 1,308
  • 1
  • 9
  • 10
20

This should also work as I didn't have brew:

yum install libxml2-devel
Tushar
  • 528
  • 4
  • 20
10

For alpine

apk add libxml2-dev
yasin lachini
  • 5,188
  • 6
  • 33
  • 56
9

So, you already have libxml2 installed with brew. As brew tells you when it installs libxml2:

margold@home-macbook ~ $ brew install libxml2
(...)
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/libxml2/lib
    CPPFLAGS: -I/usr/local/opt/libxml2/include
(...)

This means that brew is not symlinking libxml2 to /usr/local/lib and /usr/local/include, and likely not linking the pkg-config file there as well, which is why libvisio can't find it.

So you have to specify the location of libxml2 when you run ./configure, just as brew and libvisio tell you to:

./configure LIBXML_CFLAGS=-I/usr/local/opt/libxml2/include LIBXML_LIBS=-L/usr/local/opt/libxml2/lib

(The paths on your system may vary, so do check!)

Other ways to solve this:

  • install libvisio with brew directly
  • symlink the inlcude/, lib/, and pkg-config files of libxml to /usr/local/ yourself
margold
  • 587
  • 2
  • 5
  • 16
  • 1
    This doesn't work for me. How do you know the names `LIBXML_CFLAGS` and `LIBXML_LIBS`? – C. E. Oct 15 '17 at 09:01
  • I took them directly from the `./configure` error message pasted in the question. You should start by looking carefully at the error message you're getting and seeing if it gives you any clues. You might also need to install `libxml2-devel` as the answers below are saying. – margold Oct 16 '17 at 10:07
  • 1
    The pasted message is from Brew. It doesn't mention the names "LIBXML_CFLAGS" and "LIBXML_LIBS" as far as I can see. It only mentions what their values should be, that is why I was curious how you knew that they should be called "LIBXML_CFLAGS" and "LIBXML_LIBS". – C. E. Oct 17 '17 at 09:57
5

I had this issue with PHP 7.4 build from source on Ubuntu 16.04 which I fixed by using the same way for OSX suggested above + installing dev package for libxml2-dev

sudo apt-get install libxml2-dev
./configure LIBXML_CFLAGS=-I/usr/include LIBXML_LIBS=-L/usr/lib/x86_64-linux-gnu/ ....
Thesane
  • 1,358
  • 10
  • 18
  • 2
    thanks, which can be solved by installing `apt-get install pkg-config` instead of setting the path of each library. – joaner Jul 23 '20 at 11:45
  • thanks, actually my issue was PKG_CONFIG_PATH wasn't setup correctly. I had already pkg-config installed but the path was pointing to correct location (AWS instance) – Thesane Jul 24 '20 at 20:14
1

No package 'libxml-2.0' found

means no "/usr/lib/pkgconfig/libxml-2.0.pc", usually found in the libxml2 development files. Like "libxml2-devel".


Knud Larsen
  • 5,753
  • 2
  • 14
  • 19
  • Yes, i think it is looking for libxml-2.0.pc in /usr/lib/pkgconfig/ direcotry, but it is not there. i have noticed that libxml-2.0.pc is exist in other directory i.e. /usr/local/Cellar/libxml2/2.9.3/lib/pkgconfig and /usr/local/Library/ENV/pkgconfig/. So how can i add libxml-2.0.pc in /usr/lib/pkgconfig/. i am totally new about this so sorry if i am asking for such silly thing. – Rohan May 20 '16 at 05:36
  • libxml-2.0.pc : Suggest a copy or a link to /usr/lib/pkgconfig/ – Knud Larsen May 23 '16 at 10:30