|
BuildingAndInstalling
Building and installing libkml
Building and Installing libkmlPlease read the DEPENDENCIES file carefully and ensure you have the correct versions of all required software. There are two separate build systems: one for GNU/Linux and Mac OS X, and another for Microsoft Windows. This is last updated for version 0.6.1. There may be changes within the svn tree. Linux and Mac OS XWe assume you have a reasonable GCC/autotools environment installation. Performing a basic build should be as simple as: cd libkml-0.x.x mkdir build cd build ../configure make sudo make install In addition to the usual GNU build system configure options like --prefix, you may fine-tune the building of libkml as follows. (Use ./configure --help to see all extra options.) SWIG bindingsIf you want to create bindings for the additional supported languages, you need to install the Simplified Wrapper and Interface Generator (SWIG) version 1.3.35. NOTE: the Microsoft Windows Visual Studio .vcproj's do not build SWIG. Once SWIG is installed, the configure program will check for the existence of development versions of Python and Java. If either is found, we attempt to build the SWIG bindings. If you have either language installed in a non-default location, you can specify the location(s) of your headers and libs like so: ../configure --with-java-include-dir=DIR \
--with-java-lib-dir=DIR \
--with-python-include-dir=DIR \
--with-python-lib-dir=DIRIt is likely that the Python installation and headers will be discovered automatically. If you want to build the Java bindings you will almost certainly have to tell configure where to find the headers it needs. For Mac OS X the command is probably quite close to this: ../configure --with-java-include-dir=/System/Library/Frameworks/JavaVM.framework/Headers For Linux is it is something like: ../configure --with-java-include-dir=/usr/lib/jvm/include If possible, SWIG bindings are always built. You can disable this by: ../configure --disable-swig Or you can disable specific languages: ../configure --disable-java --disable-python By default we do not install the Python SWIG bindings in the system Python extension directory. This is because writing to that directory likely requires root privileges. You can override this behavior as follows. Installation must then be performed by sudo make install. ../configure --enable-systempython Otherwise, the Python bindings will be installed to a directory relative to configure's prefix. This will likely be similar to /usr/local/lib/python2.5/site-packages/. Your PYTHONPATH will of course have to know about this directory. Microsoft Windows XPWe have used Microsoft Visual Studio 2005 to create the project files. The top-level libkml.sln is the main solution file and will build all libraries in the libkml system. You can also build the examples from the solution file in the examples directory. (It is known that Microsoft Visual Studio 2008 does not work with libkml) Running the unit testsIt is HIGHLY recommended that you build and run all unit tests. We consider the unit tests of libkml as important as the code itself given these assert semantics about the KML language itself and not just the libkml system. You will note that the unit tests for a given module often far exceed that module in raw lines of code. Build and run the libkml unit testsWe have provided a large suite of unit tests to verify the correct behavior of libkml. We use the GoogleTest framework, which on Linux and Mac OS X is built automatically as a part of the automake process and is supplied in binary form for MS Windows. On Linux/OS X you can run the tests like so: make check On Windows you should first build the libkml libraries and then the tests solution. There is a batch script that runs the tests: cd msvc\tests exec_tests.bat Excerpts of the test output looks as follows. In reporting any problem with libkml please also submit a complete trace of your run of the unit test suite. make check-TESTS [==========] Running 10 tests from 1 test case. [----------] Global test environment set-up. [----------] 10 tests from AttributesTest [ RUN ] AttributesTest.TestCreate [ OK ] AttributesTest.TestCreate [ RUN ] AttributesTest.TestCreateOdd [ OK ] AttributesTest.TestCreateOdd [ RUN ] AttributesTest.TestSetGetString [ OK ] AttributesTest.TestSetGetString [ RUN ] AttributesTest.TestSetGetDouble [ OK ] AttributesTest.TestSetGetDouble [ RUN ] AttributesTest.TestSetGetInt [ OK ] AttributesTest.TestSetGetInt [ RUN ] AttributesTest.TestClone [ OK ] AttributesTest.TestClone [ RUN ] AttributesTest.TestMerge [ OK ] AttributesTest.TestMerge [ RUN ] AttributesTest.TestSerialize [ OK ] AttributesTest.TestSerialize [ RUN ] AttributesTest.TestMatch [ OK ] AttributesTest.TestMatch [ RUN ] AttributesTest.TestMatchNoDefault [ OK ] AttributesTest.TestMatchNoDefault [----------] Global test environment tear-down [==========] 10 tests from 1 test case ran. [ PASSED ] 10 tests. PASS: attributes_test ... PASS: xsd_util_test [==========] Running 2 tests from 1 test case. [----------] Global test environment set-up. [----------] 2 tests from XstParserTest [ RUN ] XstParserTest.TestParseXstAlias [ OK ] XstParserTest.TestParseXstAlias [ RUN ] XstParserTest.TestParseXst [ OK ] XstParserTest.TestParseXst [----------] Global test environment tear-down [==========] 2 tests from 1 test case ran. [ PASSED ] 2 tests. PASS: xst_parser_test ================== All 9 tests passed ================== Some amount of Python SWIG functionality is tested in src/swig/kmldom_test.py and src/swig/kmlengine_test.py. A successful run of these tests looks as follows: ....................................... ---------------------------------------------------------------------- Ran 39 tests in 0.013s OK And so on. If any tests fail to pass, you will be asked to report the issue to this project's issue tracker. |
Sign in to add a comment
How does one build the Python wrappers/bindings in Windows using SWIG? I did a SVN checkout of the most recent libkml codebase, then from the Windows command prompt:
> swig kmldom.i kmldom.i(156): Error: Unable to find 'kml\dom\kml22.h' kmldom.i(159): Error: Unable to find 'kml\dom\kml_ptr.h' kmldom.i(314): Error: Unable to find 'kml\dom\kml_cast.h'
I updated these paths such that 'kml\' actually refers to '..\kml\' and then again executed SWIG from the command line: > swig kmldom.i kmldom.i(51): Error: Syntax error in input(1).
Line 51 is: SWIG_INTRUSIVE_PTR_DERIVED(Element, kmlbase::Referent, kmldom::Element)
I don't think I can use the Makefile.am included in the libkml\src\swig directory as I am on Windows. Thus, I'm at a loss as to what I should do next.
We don't yet support SWIG on Windows
Windows yet? What is the process of getting an importable python library (.so I think) so that I can do a simple import libkml (or import kmldom) in linux?
Is there a forum/mailing list where I can get help installing/using libkml? I'm a total newbie at this...
I have been unable to build libkml in Windows Visual Studio 2005.. The windows.h and expat.h files cannot be found. It seems it's just me doing something stupid (not putting some dependencies somewhere?), but again, I a newb and don't really know what I'm doing..
Any guidance is appreciated! Thanks!
The missing windows.h was because the Windows Platform SDK path wasn't set... I'm still wondering about the expat.h file...
Anyone has been able to compile that? Could you send/mail it to me?
expat.h is missing in the libkml-0.5 so I have no way to compile it with vs 2005 in winxp
any solution? thanks.
for linux (fedora 9), libxml-0.5 compiled after:
1. installing expat-devel (contains expat.h) 2. in src/kml/xsd/xsd_handler.cc, add #include <string.h> 3. in src/kml/convenience/gpx_trk_pt_handler.h, change #include <string> to #include <string.h>
then 'make check' completes with all tests passing.
To build on Windows with Visual Studio 2005, it's possible that you need to install the Expat XML Parser. There is an .exe available on the Sourceforge project website: http://sourceforge.net/projects/expat/
I can't build libKML with Python support under Ubuntu/Debian. Python is installed and configure finds the header files, but ...
checking for Py_Initialize? in -lpython2.6... no configure: WARNING: could not find the Python library. The Python bindings will not be built.
thanks in advance for any input...
recommend change to configure script. Add SunOS as an option for PLATFORM such that PLATFORM=solaris and SHLIBSUFFIX = "so" (approx line 21158 in script)
"It is known that Microsoft Visual Studio 2008 does not work with libkml".
Partially correct.
I actually rebuilt the projects succefully in MS Visual Studio 2008. However, I needed to build projects one by one, that is, select each project then build.
If I run Rebuild Solution, VS will complain that "Could not delete ....".
I noticed, all these projects share the same output directory, and each build will delete files in the directory first. I guess, in a multi-core computer, there might be multiple threads of compiling concurrently.
I would leave this issue to the admin of libkml.
The problem that zijianhuang2000 described can be solved by going into VS Tools->Options-> Projects and Solutions -> Build and Run, and enter "1" in the box next to "max number of parallel project builds". This worked for me even though I am using VS 2005, and I was experiencing multiple builds stepping on toes of each other (esp. the stdafx.obj file that every project produces).
When I try to create a hyperlink in a google earth tag to a folder on a local server I get the following error message
MY Code <p><a href="r:\install\" target=_blank>4109001.0</a></p>
ERROR MESSAGE can not find "r:%5Cinstal%5C
MY CODE DRIVE LETTER ONLY <p><a href="r:" target=_blank>4109001.0</a></p>
If I try to go to the mapped drive only it goes right there
Not sure if I am posting this in the correct area
If I need to be redirect thank you
Please help
thanks
Andre
Did anyone build the examples successfully? I met about 15 errors when I built the createkml sample. such as Error 1 error LNK2001: unresolved external symbol "private: virtual void thiscall kmldom::XalAddressDetails?::AddElement?(class boost::intrusive_ptr<class kmldom::Element> const &)" (?AddElement?@XalAddressDetails?@kmldom@@EAEXABV?$intrusive_ptr@VElement@kmldom@@@boost@@@Z) libkmldom.lib
thanks in advance, Arthur
I encountered the following error while I compiled it in x86 Linux. Please give me any clues to fix it. Thanks a lot!
Making all in base make4?: Entering directory `/home/achen2/0work/ge_plugin/libkml-0.9.0/src/kml/base'
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../.. -I../../../src -I../../../third_party/boost_1_34_1 -I../../../third_party/uriparser-0.7.1/include -I../../../third_party/googletest-r108/include -I/home/achen2/0work/ge_plugin/swig:/home/achen2/0work/ge_plugin/curl -Wall -Werror -ansi -pedantic -fno-rtti -g -O2 -MT expat_parser.lo -MD -MP -MF .deps/expat_parser.Tpo -c -o
expat_parser.lo expat_parser.cc
-I/home/achen2/0work/ge_plugin/swig:/home/achen2/0work/ge_plugin/curl -Wall -Werror -ansi -pedantic -fno-rtti -g -O2 -MT expat_parser.lo -MD -MP -MF .deps/expat_parser.Tpo -c
expat_parser.cc -fPIC -DPIC -o .libs/expat_parser.o expat_parser.cc: In member function `bool kmlbase::ExpatParser?::ParseInternalBuffer?(size_t,std::string, bool)': expat_parser.cc:110: error: `XML_ParsingStatus?' was not declared in this scope expat_parser.cc:110: error: expected `;' before "parsing_status" expat_parser.cc:111: error: `parsing_status' was not declared in this scope expat_parser.cc:111: error: `XML_GetParsingStatus?' was not declared in this scope expat_parser.cc:112: error: `XML_FINISHED' was not declared in this scope expat_parser.cc:112: warning: unused variable 'XML_FINISHED' expat_parser.cc:110: warning: unused variable 'XML_ParsingStatus?' expat_parser.cc:111: warning: unused variable 'XML_GetParsingStatus?' expat_parser.cc: In member function `bool kmlbase::ExpatParser?::ParseString?(const std::string&, std::string)': expat_parser.cc:130: error: `XML_STATUS_SUSPENDED' was not declared in this scope expat_parser.cc:130: warning: unused variable 'XML_STATUS_SUSPENDED' make4?: expat_parser.lo? Error 1 make4?: Leaving directory `/home/achen2/0work/ge_plugin/libkml-0.9.0/src/kml/base' make3?: all-recursive? Error 1 make3?: Leaving directory `/home/achen2/0work/ge_plugin/libkml-0.9.0/src/kml' make2?: all-recursive? Error 1 make2?: Leaving directory `/home/achen2/0work/ge_plugin/libkml-0.9.0/src' make1?: all-recursive? Error 1 make1?: Leaving directory `/home/achen2/0work/ge_plugin/libkml-0.9.0' make: all? Error 2
Hi,
I've run into a number of issues including files not being placed in their proper directories (i.e. zconf.h, and zlib.h not in zlib 1.2.3 directory).
also needed to install "expat" from http://www.libexpat.org/ (but this was expected based on 'DEPENDENCIES' file)
Current Problem (during compilation):
"gcc -shared .libs/unzip.o .libs/ioapi.o .libs/zip.o -lz -Wl,-soname -Wl,libminizip.so.0 -o .libs/libminizip.so.0.0.0 /usr/bin/ld: cannot find –lz"
commenting out "libminizip_la_LDFLAGS = -lz" in "third-party" folder makefiles seems to fix it, but not sure if it will cause problems down the road.
what have i done? what was -lz supposed to do for gcc?
Yep.. Tweaking the libminizip makefiles (see previous comment) have come back to haunt me. Seems like some functions are missing from the libminizip shared object:
g++ -Wall -Werror -ansi -pedantic -fno-rtti -g -O2 -o .libs/balloonwalker balloonwalker.o ../../src/kml/engine/.libs/libkmlengine.so /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/libminizip.so /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/liburiparser.so /home/.../Documents/libKML/libkml-0.9.0/src/kml/base/.libs/libkmlbase.so ../../src/kml/dom/.libs/libkmldom.so ../../src/kml/base/.libs/libkmlbase.so -lexpat /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/libminizip.so: undefined reference to `inflateEnd' /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/libminizip.so: undefined reference to `deflate' /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/libminizip.so: undefined reference to `inflateInit2' /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/libminizip.so: undefined reference to `inflate' /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/libminizip.so: undefined reference to `crc32' /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/libminizip.so: undefined reference to `deflateEnd' /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/libminizip.so: undefined reference to `deflateInit2' /home/.../Documents/libKML/libkml-0.9.0/third_party/.libs/libminizip.so: undefined reference to `get_crc_table'
back to the original problem. how do i get past this error:
"gcc -shared .libs/unzip.o .libs/ioapi.o .libs/zip.o -lz -Wl,-soname -Wl,libminizip.so.0 -o .libs/libminizip.so.0.0.0 /usr/bin/ld: cannot find –lz"
problem fixed
installed Ubuntu's libz library "zlib1g-dev" and then did "make clean"
ran "make install"
libraries were created in "/usr/local/lib/"...now will it compile?
Tried forever to get libkml to simply compile, install, and for Java SWIG to work. SWIG wasn't getting called to create the .java files. Then manually had to some stuff.
Had to make expat with PREFIX=/usr since it libkml's makefiles kept looking in /usr and not /local for expat. RHEL4 had an older version and I kept getting the XML_GetParserStatus? link errors and stuff like that. (http://code.google.com/p/libkml/issues/detail?id=56) I saw it was always pulling /usr/lib/libexpat.so. The ./configure script wasn't checking for the expat version either.
./configure --with-java-include-dir=/usr/java/latest/include --with-java-lib-dir=/usr/java/latest/lib make make install (this didn't complete successfully. See http://code.google.com/p/libkml/issues/detail?id=56)
Anyway, just kept hacking at it... cd src/swig swig -java -c++ -I.. .i (or try each .i file individually) this will spit out the .java files that you're looking for. javac .java (creates compiles and creates the c.ass files) jar -cfv libkml.jar .class (puts them all in 1 jar file)
As a hack and convenience, move libkml.jar to ../.libs so the jar and .so's are in the same directory (for now).
Copy both CreatePlacemark?.java and WalkFeatures?.java to src/swig/.libs again for convenience
Modify both java files to use System.loadLibrary("kmldom_swig_java") as mentioned in http://code.google.com/p/libkml/issues/detail?id=15
javac -cp libkml.jar .java (compiles both examples)
To run: java -cp .:libkml.jar -Djava.library.path=. WalkFeatures? name= folder Type_Folder?
java -cp .:libkml.jar -Djava.library.path=. CreatePlacemark? <kml>
</kml>There's obviously a ton of hacking and things located in undesirable directories. But, the fact that I got this far makes it one step closer to usable.
I hope that the Devs really put some time into addressing all of the Issues and fixes raised in this libkml project. I also hope that they fix the build issues immediatly BEFORE a major release. I spent a lot of time getting to this point, when it should just work. If the 0.9 code can't compile without lots of hacks, then nobody is going to using it!
Devs - please at least post patches or update SVN for the build system. At least update the bugs with comments so we know very old issues like 15 & 17, which were created in July! have been addressed and possibly fixed if we want to check out the latest in SVN. Thanks!