Re: Compiling on OS X

540 views
Skip to first unread message

bjorn

unread,
Sep 4, 2012, 6:09:03 PM9/4/12
to libst...@googlegroups.com
I tried compiling the latest snapshot and it said

"configure: error: couldn't find libxml2"

This is odd because in my main code I am using -lxml2 for linking and -I/usr/include/libxml2 for compiling. I would think these would be standard places for autoconf to look, but autoconf is essentially an alien language to me.

I'll see if I can figure this out, but any advise is appreciated.

Thanks,

bjorn

On Tuesday, September 4, 2012 5:53:02 PM UTC-4, bjorn wrote:
I am trying to compile from source. I am using Mac OS X, and I am interested in using libxml2, which is installed by default and already used by my project (I don't want to add additional dependencies!). Here's what I've tried:

pizzicato:sample code bjorn$ git clone https://github.com/metajack/libstrophe.git
Cloning into 'libstrophe'...
remote: Counting objects: 953, done.
remote: Compressing objects: 100% (362/362), done.
remote: Total 953 (delta 681), reused 837 (delta 588)
Receiving objects: 100% (953/953), 243.18 KiB, done.
Resolving deltas: 100% (681/681), done.

pizzicato:sample code bjorn$ cd libstrophe/

pizzicato:libstrophe bjorn$ ./bootstrap.sh 
configure.ac:6: installing `./compile'
configure.ac:2: installing `./missing'
configure.ac:2: installing `./install-sh'
Makefile.am: installing `./depcomp'
configure.ac:8: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:9: error: possibly undefined macro: AC_MSG_WARN

pizzicato:libstrophe bjorn$ ./configure && make

...

./configure: line 4309: syntax error near unexpected token `check,'
./configure: line 4309: `PKG_CHECK_MODULES(check, check >= 0.9.4, , AC_MSG_WARN([libcheck not found; unit tests will not be compilable]))'

pizzicato:libstrophe bjorn$ ./configure --with-libxml2 && make

...

./configure: line 4309: syntax error near unexpected token `check,'
./configure: line 4309: `PKG_CHECK_MODULES(check, check >= 0.9.4, , AC_MSG_WARN([libcheck not found; unit tests will not be compilable]))'

pizzicato:libstrophe bjorn$ ./bootstrap.sh 

pizzicato:libstrophe bjorn$ ./configure --with-libxml2 && make

...

./configure: line 4309: syntax error near unexpected token `check,'
./configure: line 4309: `PKG_CHECK_MODULES(check, check >= 0.9.4, , AC_MSG_WARN([libcheck not found; unit tests will not be compilable]))'


Not sure what I should do at this point since configure fails.

Jack Moffitt

unread,
Sep 4, 2012, 6:19:41 PM9/4/12
to libst...@googlegroups.com
> I tried compiling the latest snapshot and it said
>
> "configure: error: couldn't find libxml2"
>
> This is odd because in my main code I am using -lxml2 for linking and
> -I/usr/include/libxml2 for compiling. I would think these would be standard
> places for autoconf to look, but autoconf is essentially an alien language
> to me.

You appear to have an old autoconf or automake or both installed. I
assume that's why you're getting the AC_MSG_ERROR warnings. That's a
built in macro as far as I know.

As for not finding libxml2, that's an easy one. If pkg-config doesn't
know about it, configure won't be able to find it.

On my 10.8.1 system:
$ pkg-config --exists --print-errors "libxml-2.0 >= 2.7"
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found

brew install libxml2 doesn't seem to help either. It apparently does
not install the package files.

The configure script will have to be modified to detect it based on
trying to compile it.

Please file a bug. I may be able to look at this tonight, but
hopefully someone else can provide a fix before then :)

jack.

bjorn

unread,
Sep 4, 2012, 6:36:59 PM9/4/12
to libst...@googlegroups.com, ja...@metajack.im
On Tuesday, September 4, 2012 6:19:42 PM UTC-4, Jack Moffitt wrote:
> I tried compiling the latest snapshot and it said
>
> "configure: error: couldn't find libxml2"
>
> This is odd because in my main code I am using -lxml2 for linking and
> -I/usr/include/libxml2 for compiling. I would think these would be standard
> places for autoconf to look, but autoconf is essentially an alien language
> to me.

You appear to have an old autoconf or automake or both installed. I
assume that's why you're getting the AC_MSG_ERROR warnings. That's a
built in macro as far as I know.

Maybe. I am running 10.6.8, but it seems to me that's not so old that things shouldn't compile on it.
 
As for not finding libxml2, that's an easy one. If pkg-config doesn't
know about it, configure won't be able to find it.

On my 10.8.1 system:
$ pkg-config --exists --print-errors "libxml-2.0 >= 2.7"
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found


I tried

export PKG_CONFIG_PATH="/usr/include/libxml2"

without any luck. Incidentally, there's no pkg-config command on my system.

brew install libxml2 doesn't seem to help either. It apparently does
not install the package files.

The configure script will have to be modified to detect it based on
trying to compile it.

I thought as much, but, like I said, configure is an alien language to me.
 
Please file a bug. I may be able to look at this tonight, but
hopefully someone else can provide a fix before then :)

Okay. Done. Issue #31.

Thanks for your help so far.
 

Jack Moffitt

unread,
Sep 4, 2012, 6:46:26 PM9/4/12
to libst...@googlegroups.com
> Maybe. I am running 10.6.8, but it seems to me that's not so old that things
> shouldn't compile on it.

This presumes that Apple updates the toolchain to the latest versions
with every release. This isn't true at all. Many things haven't
changed in years. I'm not sure if autoconf is one of these, but if you
want to find out you can try installing new ones with homebrew.

If anyone knows how to fix this for older autotools, I'm all ears.

> I tried
>
> export PKG_CONFIG_PATH="/usr/include/libxml2"

PKG_CONFIG_PATH needs to point to a directory full of *.pc files which
describe packages. Pointing it to the C headers won't accomplish much.

> without any luck. Incidentally, there's no pkg-config command on my system.

Ah, I probably got mine via homebrew.

> I thought as much, but, like I said, configure is an alien language to me.

Here's a quick workaround to get you sorted until I get configure
properly fixed:

use the attached patch and then run configure with:

libxml2_CFLAGS='-I /usr/include/libxml2' libxml2_LIBS='-lxml2'
./configure --with-libxml2

That appears to work on Mountain Lion.

jack.
libstrophe.libxml2.osx.patch

Bjorn Roche

unread,
Sep 5, 2012, 10:45:08 AM9/5/12
to libst...@googlegroups.com

On Sep 4, 2012, at 6:46 PM, Jack Moffitt wrote:

>> Maybe. I am running 10.6.8, but it seems to me that's not so old that things
>> shouldn't compile on it.
>
> This presumes that Apple updates the toolchain to the latest versions
> with every release. This isn't true at all. Many things haven't
> changed in years. I'm not sure if autoconf is one of these, but if you
> want to find out you can try installing new ones with homebrew.

Everything you say is true. I was just saying I think people should be able to compile on stock 10.6.8, but anyway, that's just my opinion.

> If anyone knows how to fix this for older autotools, I'm all ears.
>
>> I tried
>>
>> export PKG_CONFIG_PATH="/usr/include/libxml2"
>
> PKG_CONFIG_PATH needs to point to a directory full of *.pc files which
> describe packages. Pointing it to the C headers won't accomplish much.

ah, okay.

>> without any luck. Incidentally, there's no pkg-config command on my system.
>
> Ah, I probably got mine via homebrew.
>
>> I thought as much, but, like I said, configure is an alien language to me.
>
> Here's a quick workaround to get you sorted until I get configure
> properly fixed:
>
> use the attached patch and then run configure with:
>
> libxml2_CFLAGS='-I /usr/include/libxml2' libxml2_LIBS='-lxml2'
> ./configure --with-libxml2
>
> That appears to work on Mountain Lion.

Many thanks. I'll give it a shot. Is that a patch for the latest snapshot or current git?

bjorn

-----------------------------
Bjorn Roche
http://www.xonami.com
Audio Collaboration
http://blog.bjornroche.com




Bjorn Roche

unread,
Sep 6, 2012, 11:16:05 PM9/6/12
to libst...@googlegroups.com
Well I tried this and also upgrading autoconf and automake with brew.

No joy.

Hint to anyone else reading this: you must install and link or the tools won't be in your path.

$ brew install autoconf
$ brew link autoconf
and
$ brew install automake
$ brew link automake

:(

bjorn


On Sep 4, 2012, at 6:46 PM, Jack Moffitt wrote:

> --
> You received this message because you are subscribed to the Google Groups "libstrophe" group.
> To post to this group, send email to libst...@googlegroups.com.
> To unsubscribe from this group, send email to libstrophe+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/libstrophe?hl=en.
>
> <libstrophe.libxml2.osx.patch>

Jack Moffitt

unread,
Mar 29, 2013, 11:48:39 AM3/29/13
to libst...@googlegroups.com
Ok, I just added support for this to the configure.ac file. If you
rerun bootstrap.sh and configure --with-libxml2 on OS X it should work
just fine now.

Or at least it works on my OS X machine.

jack.
Reply all
Reply to author
Forward
0 new messages