[OSM-dev] [OSM-talk] Osm2Pgsql problem linking to libxml2
jburgess777 at googlemail.com
Fri Feb 9 16:35:10 GMT 2007
On Fri, 2007-02-09 at 15:49 +0000, yuri bay wrote:
> I am still trying to solve the osm2pgsql compiling problem. I wanted to use
> OSM on winGRASS and need to import OSM data into PostgreSQL. Since
> osm2pgsql requires libxml2, I have managed to installed the libxml2, and
> have downloaded the libxml binary files as wll. But regardless of that I am
> still having problem to compile osm2pgsql?? The following is the errors and
> I would be grateful if someone could help. Many thanks
> gcc osm2pgsql.c -o osm2pgsql -L c:/libxml/ -lxml
> undefined reference to 'xmlStrEqual'
> ....undefined reference to 'xmlStrEqual'
> ....undefined reference to 'xmlTestReaderGetAttribute'
> ....undefined reference to 'bst_insert'
> ....undefined reference to '_imp_xmlFree'
> ....undefined reference to 'avl_insert'
> ....undefined reference to 'bst_balance'
> make: *** [osm2pgsql] Error 1
> I have tried -lxml or -lxml2 the results were the same. What is -lxml
'-lxml' means "dynamically link with the library called libxml".
Any -lFOO causes linking with libFOO.
I'm afraid you need to link together multiple object files to create
this binary, something like...
gcc -c -o osm2pgsql.o osm2pgsql.c
gcc -c -o bst.o bst.c
gcc -c -o avl.o avl.c
gcc -L c:/libxml/ -lxml2 -lz -lm osm2pgsql.o bst.o avl.o -o osm2pgsql
Normally the 'make' tool would handle most of this complexity for you
(using the instructions it reads from the Makefile). I'm not too
familiar with the Win32 cygwin/mingw build environment but make should
be readily available to take care of this for you.
One slightly off topic suggestion is that you would probably find that a
lot of the OSM tools compile and operate more easily on a Linux distro.
You should be able to get hold of and install for a quite reasonable
cost (often $0).
More information about the dev