Platform Builds

Builing instructions by platform

This document includes instructions on how to build implementations targetted for various platforms, and information on any problems encountered. This is a wiki page, so feel free to add your information to it. Throughout this document, <srcdir> refers to the directory you have extracted the code in(including the toplevel directory from the tar file).

libxml2 build

On all platforms, you need to build libxml2 first(unless the platform comes with a recent version). All subsequent instructions assume you have done this, and have xml2-config in the path.

If you see errors like this:

DOMLoader.cpp: In member function `virtual iface::dom::Document* CDA_DOMImplementation::loadDocument(const wchar_t*, std::wstring&)':
DOMLoader.cpp:544: error: 'XML_WAR_SPACE_VALUE' was not declared in this scope
DOMLoader.cpp:545: error: 'XML_ERR_NOT_STANDALONE' was not declared in this scope
DOMLoader.cpp:546: error: 'XML_ERR_ENTITY_PROCESSING' was not declared in this scope
DOMLoader.cpp:547: error: 'XML_ERR_NOTATION_PROCESSING' was not declared in this scope
DOMLoader.cpp:548: error: 'XML_WAR_NS_COLUMN' was not declared in this scope
DOMLoader.cpp:549: error: 'XML_WAR_ENTITY_REDEFINED' was not declared in this scope

then your libxml2 is too old(or perhaps you have an old xml2-config around, in which case you should adjust your PATH until xml2-config --version gives the right version).

omniORB build

omniORB(I used 4.0.7) and Python are needed, solely because simple_interface_generators use omniidl to parse the IDL files and write C++ headers. If you don't want to do this on a particular platform, you can actually build the headers on another different platform, and copy them across.

CppUnit build(optional)

If you want to be able to run unit tests, via make check, you need to install CppUnit. If you are building on a platform other than those listed here, or you are not following these instructions verbatim, this is strongly recommended, as it will find problems early.

Linux

On most GNU/Linux systems, it builds out of the box...

mkdir CellML_DOM_API_Linux
cd CellML_DOM_API_Linux
<srcdir>/configure
make && make check && make install

Win32

Cross compiling on Linux for a Win32 host

My preferred method for producing a Win32 build is to build a cross-compile, using the MingW32 cross-compiler for Linux(I downloaded the binary version and got it working using that). After building the dependencies and installing them in a prefix directory, you can do the following:

<srcdir>/configure --host=i386-mingw32msvc
make && make check && make install

Note that the checks will not be run automatically, but you can use wine to run RunTestBin.exe in the "tests" directory, or move it to a Windows box and run it there.

You can sometimes get problems(like -ldl missing errors, as libdl isn't on Win32) when building the tests, because you got the host xml2-config. The easiest way around this is to go into the tests directory, and run the last command(less the extraneous library) manually.

All tests pass for me when I do this.

AIX

On AIX, some tweaking is required. This build uses xlC. A gcc build doesn't currently work, as std::wstring is disabled on AIX/gcc for some reason.

<srcdir>/configure CC=xlc CXX=xlC LD=xlC CCFLAGS="-I/people/amil082/usr_aix/include" CXXFLAGS="-I/people/amil082/usr_aix/include -qrtti=all" LDFLAGS="-L/people/amil082/usr_aix/lib"
make && make check && make install

Of course, you have to change the /people/amil082/usr_aix for the prefix where you installed libraries like libxml2 and CppUnit(if you installed as root in standard locations, you can omit the -I and -L options altogether).

When you run "make check", it is common to see errors like this:

ld: 0711-999 SEVERE ERROR: Unexpected system call error.
        ld:ftruncate() I/O error
ld: 0711-996 Error occurred while processing file: RunTestBin

This is a common problem on some AIX setups, because ld gives errors if it has to create a file. What you should do is cd into the "tests" subdirectory, and re-run the last compile line(starting with xlC) manually. You can now run "make check" and the tests should all pass.

If make check gives error like this:

ld: 0711-317 ERROR: Undefined symbol: __vft24__DynaCastDesc_si_public14__DynaCastDesc
ld: 0711-317 ERROR: Undefined symbol: __vft13eti_cplusplus9type_info
ld: 0711-317 ERROR: Undefined symbol: __dl__FPv
ld: 0711-317 ERROR: Undefined symbol: __vft24__DynaCastDesc_vi_public14__DynaCastDesc
ld: 0711-317 ERROR: Undefined symbol: __PureVirtualCalled
ld: 0711-317 ERROR: Undefined symbol: __vft24__DynaCastDesc_mi_public14__DynaCastDesc
ld: 0711-317 ERROR: Undefined symbol: __UnsupportedConditionalExpressionDestruction__FPvl
ld: 0711-317 ERROR: Undefined symbol: .__dl__FPv
ld: 0711-317 ERROR: Undefined symbol: ._Xran__Q2_3std12_String_baseCFv
ld: 0711-317 ERROR: Undefined symbol: ._Xlen__Q2_3std12_String_baseCFv
ld: 0711-317 ERROR: Undefined symbol: .__ReThrowV6
ld: 0711-317 ERROR: Undefined symbol: .__setUncaughtExceptionFlag__3stdFb

Then you accidentally used xlc where you should have used xlC. Start again from the configure line, this time using the recommended options above.

If you get test failures similar to this:

.F.F.F.F.F.F.F.F.F..E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.Illegal instruction

Then make sure you didn't forget the qrtti=all in the configure line above, or you will get warnings(not errors) and the API won't work.

Irix

On Irix, you need to build a recent libxml2 (e.g. 2.6.23) rather than use the one which comes with the system, as changes in the error codes available mean old versions(even older 2.6.x) won't work.

When you build CppUnit, use the options

./configure --prefix=/people/amil082/usr_irix CC=cc CXX=CC LD=CC CXXFLAGS="-LANG:std" --disable-shared

When building CellML_DOM_API, you need to give a number of compiler flags:

./configure --prefix=/people/amil082/usr_irix CC=cc CXX=CC LD=CC CXXFLAGS="-LANG:std -I/people/amil082/usr_irix/include" LDFLAGS="-L/people/amil082/usr_irix/lib"

Note that on Irix, you must build in <srcdir>, as out-of-srcdir builds don't work. As always, you need to adjust the /people/amil082/usr_irix parts, or remove them altogether if you are doing everything as root.

Mac OS/X

You need to install a recent libxml2 first. Next, extract it into a directory and run configure and make as normal...

./configure --prefix=/Users/cmiss/Prefix/ CXXFLAGS="-I/Users/cmiss/Prefix/include" LDFLAGS="-L/Users/cmiss/Prefix/lib"
make && make check && make install

Win32 + MSVC8

There are plans to work on this in the future, but it has not been done yet. This will probably require upding the configure script a little bit, making some wrapper code available to translate paths, and so on, but shouldn't require more than a weeks work.

If anyone does this work, please submit patches and it will be merged in.

Win32 + bcc32

This configuration has been tried, but it fails at the configure stage, because bcc32 is picky about the order of options like -o. The easiest way would probably be to either find an existing wrapper which makes it get through configure, or to write one. It is unclear whether there are any further issues with bcc32.