In order to build Zorba, you need the Cross-Platform Make CMake 2.4 or higher. You can download it from
http://www.cmake.org/.
Zorba is tested with the following compilers:
- GNU Compiler: GCC 3.4.x (32bit & 64bit) and GCC 4.x.x
- Microsoft Compiler: MS VC++ 2005 and MS VC++ 2008
In order to build Zorba, you need the following libraries and development headers to be installed:
- Install the Zorba source distribution (see Installation). The directory in which the Zorba sources are installed is referred to as
[ZORBA] in the following. - Change the working directory into
[ZORBA]. - The recommended way to build Zorba is by creating an out-of-source build. We suggest to create the directory
[ZORBA]/build and refer to this directory as [ZORBABUILD] in the following. - Change the working directory into the
[ZORBABUILD] directory and execute cmake as follows: cmake [ZORBA]. In case the [ZORBABUILD] is located directly within the [ZORBA] directory just type cmake .. . This command should configure Zorba and prepare for the build. CMake will tell you if your installation is missing some of the required libraries or development headers. - If CMake was executed successfully, you should be able to run
make. Running make will take some time. If make finished successfully, you're ready to install and run Zorba (see Installation).
- CMake is a meta build system, meaning it is able to generate native makefiles (e.g. GNU Make or NMake) and workspaces (e.g. KDevelop or Visual Studio Projects). For example, you can create a KDevelop Project by executing the following command in the
[ZORBA] directory: cmake -G KDevelop3 [ZORBABUILD]. - CMake supports multiple build configurations (e.g. Debug, Release, or MinSizeRel. By default, Zorba is build with the Release configuration. To change the build mode (to Debug, Release, RelWithDebInfo or MinSizeRel), you can pass an additional parameter to CMake, e.g.
cmake -D CMAKE_BUILD_TYPE=Debug [ZORBA].
The easiest way to install the required packages (like CMake, etc.) is to use Darwin Ports (
http://darwinports.com/). After installing Darwin Ports, you should run
sudo port -d selfupdate to upgrade the package lists. If this was successful, you can simply install packages by typing e.g.
sudo port install cmake. Note that versions of libcurl and libtidy, that are already installed as part of Mac OS X are sufficient. However, a newer version of libxml2 than the one that is part of Mac OS X (v 2.6.16) is needed which can be obtained from Darwin Ports (v 2.6.31) or from source (v 2.2.7 ). Assumming the latter, one add the following to the cmake configuration options
cmake -D LIBXML2_LIBRARIES=/usr/local/lib/libxml2.dylib
To build zorba as a universal binary one must also build the required external libraries as universal. In most cases this is as easy as building them non-universal. Following are instructions on how to do so.
For Xerces-C the instructions given by Apple almost just work. One should change the CFLAGS to CXXFLAGS because Xerces is written in C++. Zorba developers prefer a variation on those instructions like this ...
./configure CXXFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk" \
-disable-dependency-tracking LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk \
-arch i386 -arch ppc"
Since libxml2 is written in C, change CXXFLAGS to CFLAGS in the above. As noted by Apple, dependency generation by gcc doesn't work when building universal, thus it is turned off with the above command.
For ICU, one must build the libraries seperately on PPC and Intel platforms then combine the them into a Universal library. The reason for this is that ICU tests for endianess at configure time (i.e. before compiling), thus the compiled code will only have endianess correct for one platform. The script zorba/scripts/makefat.sh shows one how to do the combining.
Once all the external libraries are built and installed Universal, one can build zorba Universal setting the CMake variable UNIVERSAL on like this
In order to build an installer package, one should run cmake with an extra flag as follows...
> cmake -DCMAKE_SKIP_BUILD_RPATH=1 ..
This will remove the build path from the installed executables and libraries. It will also add some symbolic links to the libraries.
- In order to compile Zorba on Windows, you need a working Visual Studio (Express) installation.
- Additionally, you need the following packages to be installed for your Visual Studio installation. Make sure that the libraries are compiled for your version of Visual Studio.
- CMake (http://www.cmake.org/)
- Libxml2 and Iconv (http://www.zlatkovic.com/pub/libxml/)
- ICU (http://download.icu-project.org/files/icu4c/)
- Xerces-C (http://xerces.apache.org/xerces-c/download.cgi)
- Optional
- CURL (http://curl.haxx.se/download.html)(if you want to have REST support or call http URIs)
- Tidy (http://dev.int64.org/tidy.html) (if you intend to use HTML files and have to transform them into syntactically valid XML)
- In order to execute Zorba, please note that the paths to all of the installed libraries need to be included in the
PATH environment variable. path_to_libxml2\bin;path_to_icu\bin;path_to_iconv\bin;path_to_xerces\bin
To do this, right click on My Computer -> Properties -> Advanced -> Environment Variables and edit the PATH variable. Alternatively, you can also copy all the libraries in the same directory as the zorba.exe file (or your own executable if you build an application that is using Zorba). - Note, you can also use CMake's graphical interface. This can usually be found in Start menu. This eases up setup and makes it more intuitive.
- Start a Visual Studio Command Line
- Change the current working directory into the
[ZORBA] directory. - The recommended way to build Zorba is by creating an out-of-source build. We suggest to create the directory
[ZORBA]/build and refer to this directory as [ZORBABUILD] in the following. - Execute CMake as follows
cmake -G "NMake Makefiles" [ZORBA]. Unfortunately, CMake does not find all the development headers and libraries itself. Hence, you need to tell CMake where they are located. This can be done by the following command: "cmake"
-G "NMake Makefiles"
-D ICU_LIBRARY="path_to_icu\lib\icuuc.lib"
-D ICU_DATA_LIBRARY="path_to_icu\lib\icudt.lib"
-D ICU_I18N_LIBRARY="path_to_icu\lib\icuin.lib"
-D ICU_INCLUDE="path_to_icu\include"
-D ICONV_INCLUDE_DIR="path_to_iconv\include"
-D ICONV_LIBRARY="path_to_iconv\lib\iconv.lib"
-D LIBXML2_INCLUDE_DIR="path_to_libxml2\include"
-D LIBXML2_LIBRARIES="path_to_libxml2\lib\libxml2.lib"
-D XERCESC_INCLUDE="path_to_xerces\include"
-D XERCESC_LIBRARY="path_to_xerces\lib\xerces-c_2.lib"
..\
If you need CURL (e.g. to have REST support) you have to point two CMake variables to CURL's include directory and the CURL library.
- D CURL_INCLUDE_DIR="path_to_curl\include"
- D CURL_LIBRARY="path_to_curl\lib\curllib.lib"
If you additionally want to have support for Tidy in order to syntactically cleanup HTML documents, you have to set the following CMake variables:
- D LIBTIDY_INCLUDE_DIR="path_to_tidy\include"
- D LIBTIDY_LIBRARIES="path_to_tidy\lib\tidy.lib"
After you've provided all of the required variables, you are ready to call nmake from the [ZORBABUILD] directory.
- Start Visual Studio Command Line
- Change the current working directory into the
[ZORBA] directory. - Execute CMake as described above but with the
-G "Visual Studio X 200Y" option instead of -G "NMake Makefiles". - Start Visual Studio, open the generated
zorba.sln project file, and start compilation.
- In order to have SSL support in Zorba you have to use the CURL library that has SSL support.
- To use CURL+SSL you have to set ZORBA_WITH_REST and ZORBA_WITH_SSL to ON in cmake.
- There is one more thing: in order to validate the server's certificate, CURL+SSL needs to know about the root Certificates of Authenticity (CA), this is a set of public keys freely available on the internet.
- On Windows, Zorba expects this file to be called "cacert.pem" and searches for it in current dir and system paths.
- This "cacert.pem" file can be found on curl page: http://curl.haxx.se/docs/caextract.html .
- In order to disable the validation of server certificate, the ZORBA_VERIFY_PEER_SSL_CERTIFICATE can be set to OFF in cmake (and actually this is the default value). Set it to ON to validate server certificate chain on every access to https:// .
- More read about CURL+SSL : http://curl.haxx.se/docs/sslcerts.html .
- As a https test page we used for example the rss feed fn:doc('https://www.npr.org/rss/rss.php?id=1001') .