|
|
(21 intermediate revisions by 2 users not shown) |
Line 4: |
Line 4: |
|
| |
|
| iMath is hosted at SourceForge. | | iMath is hosted at SourceForge. |
| You can download the curent release from [http://sourceforge.net/projects/eqc]. A complete overview of all files is available in the files section [http://sourceforge.net/projects/ooo-imath/files/]. | | You can download the current release from [http://sourceforge.net/projects/ooo-imath sourceforge]. A complete overview of all files is available in the [http://sourceforge.net/projects/ooo-imath/files files] section. |
|
| |
|
| === Requirements === | | === Requirements === |
Line 10: |
Line 10: |
| To compile and use iMath, the GiNaC, CLN, GMP and EQC libraries are required, as well as the standard C++ development libraries, flex and bison. Information about these libraries can be found at the GiNaC library homepage, CLN library homepage and EQC library homepage. Compilation has been tested with EQC 1.4.1 using g++-4.4. Older versions will most probably not work. | | To compile and use iMath, the GiNaC, CLN, GMP and EQC libraries are required, as well as the standard C++ development libraries, flex and bison. Information about these libraries can be found at the GiNaC library homepage, CLN library homepage and EQC library homepage. Compilation has been tested with EQC 1.4.1 using g++-4.4. Older versions will most probably not work. |
|
| |
|
| === Compilation and installation === | | === Compilation and installation (Linux) === |
|
| |
|
| In order to compile and install iMath on your system, type the following in the base directory of the iMath distribution: | | In order to compile and install iMath on your system, type the following in the base directory of the iMath distribution: |
Line 20: |
Line 20: |
| Since iMath uses autoconf you should have no trouble compiling it. Should you run into problems please report them to the the author. | | Since iMath uses autoconf you should have no trouble compiling it. Should you run into problems please report them to the the author. |
|
| |
|
| === Cross-compiling for Windows === | | === Compilation and installation (Windows) === |
|
| |
|
| I have given up on this, maybe someone else wants to try? The following is what I tried, but I could never get configure to build DLLs.
| | [[Compiling_under_Windows|Compiling under Windows]] |
|
| |
|
| iMath could maybe be cross-compiled for windows by installing the mingw32 package. The following steps are necessary to build iMath for windows under Debian GNU Linux:
| | === Compilation (Windows cross-compiling from Linux) === |
|
| |
|
| * Compile and install the CLN library (run configure with --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc --without-gmp,
| | [[Cross-compiling_for_Windows|Cross-compiling for Windows]] |
| then make and make install). Maybe it needs to be patched (see http://thep.physik.uni-mainz.de/pipermail/cln-list/2005-April/000116.html).
| |
| * Compile and install the gmp library. (run configure with --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc,
| |
| then make and make install). On my system, this requires a patch to configure:
| |
| Replace the statement BITS_PER_MP_LIMB=`expr 8 \* $ac_cv_sizeof_mp_limb_t` with BITS_PER_MP_LIMB=32
| |
| (or whatever value is correct for your system. To find this out, insert an echo $ac_cv_sizeof_mp_limb_t and multiply by 8 manually).
| |
| * Compile and install the ginac library (run configure with --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc
| |
| --with-cln-prefix=/usr/i586-mingw32msvc, then make and make install)..
| |
| You can ignore the error about libreadline not being found, since we will not be needing ginsh.
| |
| * Compile and install the eqc library.
| |
| * If make reports an error while compiling input_lexer.cc, edit the file config.h created by configure,
| |
| and at the end, put #define YYTEXT_POINTER 1. If you don't want to rebuild all the files compiled up to then,
| |
| run make -t, remove all files with size 0, and re-run make.
| |
| * Probably, linking of ginsh.exe and viewgar.exe in GiNaC will also fail, but since they are not necessary,
| |
| just run make -t in the subdirectories ginsh and tools.
| |
| * Set the environment variable CPPFLAGS to -DMINGW.
| |
| * Run 'make distclean' if necessary.
| |
| * Run configure with --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc --with-ginac-prefix=/usr/i586-mingw32msvc.
| |
| This might require a patch to /usr/i586-mingw32msvc/bin/ginac-config: Replace the line saying
| |
| "echo $libdirs -lginac -L/usr/lib -lcln -lgmp" with
| |
| "echo ${exec_prefix}/lib/libginac.a ${exec_prefix}/lib/libcln.a ${exec_prefix}/lib/libgmp.a"
| |
| * You might want to strip the imath.dll library: i586-mingw32msvc-strip imath.dll. This will greatly reduce the file size.
| |
| * Install imath.oxt into openoffice using the extension manager (options-extension manager).
| |
| * Install the html documentation from the doc subdirectory in your favourite location.
| |
| | |
| === Compiling for Windows ===
| |
| | |
| ==== Preparing the Openoffice SDK with Microsoft Visual C++ ====
| |
| | |
| To build iMath for Windows, you need the Windows Openoffice SDK.
| |
| | |
| * Download and install the [http://www.openoffice.org Openoffice SDK]
| |
| * The following is explained in detail in "SDK installation directory"\sdk\docs\install.html
| |
| * Install Microsoft Visual C++ (the free express version will do, then you also need to install the
| |
| Microsoft Visual Studio 2008 Redistributable Package
| |
| * Install make and zip (for example, in WINDOWS\system32, or somewhere else in your path)
| |
| | |
| To test the SDK installation, open a command prompt and cd to the ...\sdk\examples\cpp\DocumentLoader directory.
| |
| Run ...\sdk\setsdkenv_windows.bat to configure your environment. This should create a custom batch file
| |
| somewhere in your home directory. I had to edit this custom batch file and add a correct URE path:
| |
| set OO_SDK_URE_HOME=C:\Programme\OpenOffice.org 3\URE
| |
| Now try to build the example by typing make, if this is not successful fix the problems before continuing.
| |
| | |
| ==== Preparing MSYS and Mingw ====
| |
| | |
| Download the necessary files from [http://www.mingw.org mingw].
| |
| | |
| * Install msys and msysdtk from www.mingw.org. You will need flex and bison, among others
| |
| * Click on the MSYS icon to start a Bourne shell
| |
| * Add .../Microsoft Visual Studio 9.0/Common7/IDE and .../Microsoft Visual Studio 9.0/VC/BIN to PATH
| |
| (PATH="$PATH":"..."). You can find these paths in vsvars32.bat somewhere in the Visual Studio installation directory.
| |
| * If you want to use cl (the Microsoft compiler) to compile something, copy .../Microsoft Visual Studio 9.0/BIN to
| |
| the msys /vc (or find a better way to make CPPFLAGS accept path names with spaces)
| |
| * Copy Microsoft SDKs/Windows/Vxxx/lib to msys /sdk (or find a better way to set the cl.exe LIB path)
| |
| | |
| ==== Compiling gmp with gcc ====
| |
| | |
| Download and unpack [http://gmplib.org gmp] into your msys home directory.
| |
| | |
| * Change into the new directory.
| |
| * For a shared library build, run configure with --disable-static --enable-shared. Then do make, make check and make install
| |
| * Change into the .libs subdirectory
| |
| * Make sure the MSVC binaries are in your path and run lib /def:libgmp-3.dll.def /out:libgmp-3.lib
| |
| * Copy libgmp-3.exp, libgmp-3.dll.def and libgmp-3.lib into /usr/local/lib.
| |
| * Do make distclean
| |
| * For a static library build, run configure with --enable-static --disable- shared (note that it is not possible to build both
| |
| static and shared libraries in one compilation run).
| |
| * Do make, make check and make install
| |
| * Note that make install overwrites the libgmp.la for dynamic linking in /usr/local/lib.
| |
| * Download objconv [http://www.agner.org/optimize/ objconv] and put the executable somewhere into your msys path.
| |
| * Change into the .libs subdirectory
| |
| * Run objconv -fcoff -nr:___chkstk:__chkstk libgmp.a libgmp.lib to make the symbols compatible with MSVC
| |
| * Copy the new libgmp.lib into /usr/local/lib
| |
| | |
| To compile a test program with MSVC:
| |
| * Open a DOS command shell and go to the gmp directory.
| |
| * You can find some example files in the demos subdirectory of gmp.
| |
| * For a dynamically linked program, run cl /MD -I \vc\include -I \sdk\include -I \local\include isprime.c
| |
| /link /LIBPATH: \vc\lib /LIBPATH: \sdk\lib LIBPATH: \local\lib libgmp-3.lib
| |
| * For a static link, substitute libgmp-3.lib with libgmp.lib
| |
| | |
| ==== Compiling CLN with gcc ====
| |
| | |
| Download the [http://www.ginac.de/CLN CLN source code] and unpack it into your msys home directory
| |
| * Change to the source directory
| |
| * run configure with --with-gmp=/usr/local CPPFLAGS="-DNO_ASM" LDFLAGS="-Wl,--enable-auto-import -static".
| |
| * Note: I tried --enable-shared --enable-static --with-gmp=/usr/local/ and it failed
| |
| * Note: Without the -static the program crashes because it is linked to libstdc++.dll.a, but it works when linking manually to libstdc++.a
| |
| * Note: Without the -DNO_ASM there is alinker error at pi.exe: multiple definition of shift1right_loop_down
| |
| * Do make, make check, make install
| |
| * Do NOT strip the libcln.a even though it is huge, linking to it will subsequently fail. Instead, strip the .exe files produced
| |
| | |
| ==== Compiling GiNaC 1.5.7 with gcc ====
| |
| | |
| Download the [http://www.ginac.de GiNaC] source code and unpack it into your msys home directory
| |
| * Download pkg-config, glib from the [http://www.gtk.org/download-windows.html GTK project]. Unzip the files and install them under /mingw
| |
| * Change to the source directory
| |
| * Run configure with --disable-shared PKG_CONFIG_PATH=/usr/local/lib/pkgconfig LDFLAGS="-Wl,--enable-auto-import -static"
| |
| * Do make, make check, make install
| |
| * If the compile fails in function.cpp line 1800: Remove "new" and make "->" become "." (IMHO the return type of the function is ex and not ex*)
| |
| * According to this [http://bbs.archlinux.org/viewtopic.php?pid=753660 post] changing "power::power" to "GiNaC::power" is enough
| |
| | |
| ==== Compiling eqc with gcc ====
| |
| | |
| Download the [http://sourceforge.net/projects/eqc EQC] source code and unpack it into your msys home directory
| |
| * You might be missing some autoconf macros (e.g. ac_cxx_have_sstream.m4). Get [http://nongnu.askapache.com/autoconf-archive Autoconf archive]
| |
| and install it into /usr/share/aclocal.
| |
| * You also need Mingw libasprintf from the gettext directory
| |
| * Run configure with PKG_CONFIG_PATH=/usr/local/lib/pkgconfig LDFLAGS="-Wl,--enable-auto-import -static"
| |
| *
| |
| | |
| ==== TODO and ideas ====
| |
| * EQC: In utils.h make ext/hash_fun.h be backward/hash_fun.h for mingw windows compile (but ext/hash_fun.h is correct for mingw linux cross-compilation)
| |
| * CLN: use gcc-created cl_asmXXX files with cl compilation?
| |
| * For C++, /EHsc is recommended by MSVC to remove errors concerning exception handling
| |
| * According to the GMP documentation, MSVC must use the /MD flag when linking to gmp
| |
| * objconv -fcoff -nu works on libeqc.a and libginac.a from a standard Ubuntu install. Use it instead of compiling it under msys?
| |
| | |
| ==== Compilation with Microsoft Visual C++ ====
| |
| | |
| This is what I tried to get a native MSVC compile (because Openoffice is compiled with MSVC), in spite of being warned that CLN is not compileable with anything except gcc...
| |
| | |
| ===== Preparations =====
| |
| | |
| * Install [http://www.mingw.org mingw] (the minimal version will do since we will be using the Microsoft compiler)
| |
| * Set your PATH as described above in the gcc compile section and create the msys /vc and /sdk directories
| |
| * Create the /vc/include/sys directory and put /vc/include/time.h into it
| |
| | |
| ===== Compiling CLN =====
| |
| | |
| Download the [http://www.ginac.de/CLN CLN source code] and unpack it into your msys home directory
| |
| * Change to the source directory
| |
| * run ./configure CC=cl CXX=cl CCAS=cl CPPFLAGS="-DNO_ASM -EHsc -MD -I/vc/include -I/sdk/include" LIB=/vc/lib:/sdk/lib
| |
| * make will stop and complain about missing files cl_asm.obj and cl_asm_GF2.obj
| |
| * copying cl_asm.o from a gcc compile to cl_asm.obj gives lots of linker errors, don't try that
| |
| * change to the src subdirectory
| |
| * Remove cl_asm.lo and cl_asm_GF2.lo
| |
| * Edit the Makefile and find the lines starting with "cl_asm.lo:" and "cl_asm_GF2.lo:". Remove the comment from the first line below them
| |
| * Change cl_asm.S and cl_asm_GF2.S to cl_asm.cc and cl_asm_GF2.cc in the first lines and in the lines you just uncommented (because MSVC doesn't recognize the .S extension). Total of five changes for each.
| |
| * cp base/digitseq/cl_asm.S to base/digitseq/cl_asm.cc. cl_asm_GF2.cc already exists in my distribution and is identical to cl_asm_GF2.S
| |
| * run make cl_asm.lo and make cl_asm_GF2.lo. This should create cl_asm.obj and cl_asm_GF2.obj
| |
| * If you get a libtool error about not finding cygpath, edit libtool in the cln root directory and find the line reading <code>fix_srcfile_path="\`cygpath -w \"\$srcfile\"\`</code>. Change it to <code>fix_srcfile_path="$srcfile"</code>.
| |
| * Run make again
| |
| | |
| The build will finish with some linker warnings about duplicate definitions and create the library in .libs.
| |
| The linker errors are (hopefully) all harmless and have to do with different handling of inlined functions by gcc and MSVC
| |
| * bool zerop(const cl_RA&): As soon as more than one file includes cl_RA.h, inline bool zerop(..) is defined twice and produces a linker warning
| |
| * cl_I numerator (const cl_RA&): same as above
| |
| * bool CL_FLATTEN minusp (const cl_RA&): same as above
| |
| * const cl_I denominator (const cl_RA&): same as above
| |
| * bool zerop (const cl_I&): As soon as more than one file includes cl_I.h, inline bool zerop(..) is defined twice and produces a linker warning
| |
| * bool minusp (const cl_I&): Same as zerop
| |
| * const cl_LF operator+ (const cl_LF&, const cl_LF&): Defined in cl_LF_2plus.cc and as an inline version in cl_LF.h, these clash when cl_R_mul.cc includes cl_LF.h
| |
| * same for operator-
| |
| | |
| When you try to use the library created, there will be lots of unresolved externals when linking. The reason is that libtool actually
| |
| does two links when creating the library (why?) and the second link has less files in its list (why?). Therefore, go to the Makefile
| |
| again and edit the following entry (the second and following lines must start with a tab character):
| |
| | |
| <code>
| |
| libcln.la: $(libcln_la_OBJECTS) $(libcln_la_DEPENDENCIES)
| |
| $(libcln_la_LINK) -rpath $(libdir) $(libcln_la_OBJECTS) $(libcln_la_LIBADD) $(LIBS)
| |
| list='$(libcln_la_OBJECTS)'; \
| |
| libobjects="`echo $$list | sed 's/\\.lo/.obj/g'`"; \
| |
| lib -OUT:.libs/libcln.lib $$libobjects $(libcln_la_LIBADD) $(LIBS)
| |
| </code>
| |
| | |
| Remove src/.libs/libcln.lib, run touch cl_asm.lo (or any other dependency of the library) and run make again.
| |
| | |
| Now try compiling the examples:
| |
| * Change to the examples subdirectory
| |
| * Edit the Makefile and change the entry for CXXLINK by adding <code>/vc/lib/msvcrt.lib /vc/lib/msvcprt.lib /vc/lib/oldnames.lib /sdk/lib/Kernel32.lib /sdk/lib/Uuid.lib</code> at the end. If you can figure out how to give the library directories to configure please let me know!
| |
| * Also, sometimes the compiler flag -MD given to configure seems to get lost in the examples Makefile. Add it to CXXCOMPILE if you get complaints about a missing libcpmt.lib
| |
| | |
| The linker will fail with some unresolved externals. The reason is the different handling of extern declarations by gcc and MSVC. The errors can be removed by editing the source:
| |
| | |
| # <code>libcln.lib(cl_I_from_digits.obj) : error LNK2019: unresolved external symbol _mulu32_high referenced in function "class cln::cl_I const __cdecl cln::digits_to_I(char const *,unsigned int,unsigned long)" (?digits_to_I@cln@@YA?BVcl_I@1@PBDIK@Z)</code>.
| |
| * cl_low.h defines <code>extern "C" uint32 mulu32_high;</code>
| |
| * Solution: Move this declaration outside of the namespace cln in cl_low.h (e.g. to the beginning of the file)
| |
| # The same applies for <code>_divu_32_rest</code> and <code>_divu_16_rest</code>
| |
| # <code>libcln.lib(cl_F_dprint.obj) : error LNK2019: unresolved external symbol "struct cln::cl_anything * __cdecl cl_I_constructor_from_UL(unsigned long)" (?cl_I_constructor_from_UL@@YAPAUcl_anything@cln@@K@Z) referenced in function "public: __thiscall cln::cl_I::cl_I(unsigned long)" (??0cl_I@cln@@QAE@K@Z)</code>.
| |
| * cl_I.h declares <code>extern cl_private_thing cl_I_constructor_from_UL (uint32 wert);</code> and <code>extern cl_private_thing cl_I_constructor_from_Q (sint64 wert);</code> somewhere in the file
| |
| * Comment out these declarations
| |
| * Replace them by the following at the beginning of the file:
| |
| <code>
| |
| extern cln::cl_private_thing cl_I_constructor_from_UL (uint32 wert);
| |
| extern cln::cl_private_thing cl_I_constructor_from_Q (sint64 wert);
| |
| </code>
| |
| * Edit cl_I_from_UL.cc and comment out the namespace declaration <code>namespace cln {</code> and <code>} // namespace cln</code>
| |
| * Add <code>using namespace cln;</code>
| |
| * Do the same for cl_I_from_Q.cc
| |
| | |
| Now pi.exe compiles and links and calculates PI (whether correctly or not, I did not check). If it doesn't, you might have to remove the .lo files which the linker complains about and re-make in the src subdirectory so that the source code modifications find their way into the library.
| |
| | |
| The other examples need more modifications of the source along the same lines to link. Only e.cc presents new problems
| |
| * Add <code>#include "../src/float/lfloat/cl_LF.h"</code> to the beginning of the file
| |
| * Comment out the <code>extern cl_LF cl_I_to_LF(const cl_I&, uintC);</code> declaration lower down
| |
| * Change the call to <code>log(10)</code> to <code>log ((double)10))</code>
| |
| * Edit cl_LF.h, comment out <code>extern const cl_LF cl_I_to_LF (const cl_I& x, uintC len);</code> and add <code>extern const cln::cl_LF cl_I_to_LF (const cln::cl_I& x, uintC len);</code> to the beginning of the file, outside the namespace cln
| |
| * Edit cl_LF_from_I.cc, remove <code>namespace cln{}</code> and add <code>using namespace cln;</code> instead
| |
| | |
| To ensure that all the files depending on cl_LF.h etc. get recompiled, it is simplest (but takes a while) to do a make clean and then a new make.
| |
| | |
| Try compiling the checks:
| |
| * Edit the makefile in the tests subdirectory and manually add the libraries as above
| |
| * Run "make check"
| |
| * On my compile, this compiled without a flaw and said "All two tests passed"
| |
| | |
| If you want to use the gmp library as compiled and modified by objconv above, add <code>--with-gmp=/usr/local LDFLAGS=/usr/local/lib/libgmp.lib</code> to the configure invocation. You might have to create a copy of libgmp.lib named libgmp.a in /usr/local/lib because make will link to both of them.
| |
| | |
| ===== Compiling GiNaC =====
| |
| | |
| Download the Ginac source code and unpack it into your msys home directory
| |
| * Download pkg-config, glib from the [http://www.gtk.org/download-windows.html GTK project]. Unzip the files and install them under /mingw
| |
| * Change to the source directory
| |
| * Run ./configure CC=cl CXX=cl CPPFLAGS="-MD -EHsc -I/vc/include -I/sdk/include" LIB=/vc/lib:/sdk/lib
| |
| PKG_CONFIG_PATH=/opt/ginac/lib/pkgconfig --enable-shared
| |
| * I had to edit clifford.cpp and change "or" to "||" and "not" to "!" (Am I missing new developments in the C language?).
| |
| In function.cpp, I removed "new" and made "->" be ".". In symmetry.cpp, "iterator" became
| |
| "const_iterator". parser/parse_binop_rhs.cpp "__func__" became ""unknown"", and also in polynomial/debug.h
| |
|
| |
|
| === Binary packages === | | === Binary packages === |
|
| |
|
| If all this is too complicated for you, RPM and Debian packages have been released on SourceFourge. They are accessible on the iMath project page [http://sourceforge.net/projects/ooo-imath] | | If all this is too complicated for you, binary packages have been released on SourceForge. They are accessible on the [http://sourceforge.net/projects/ooo-imath iMath project page] |
|
| |
|
| === Bugs === | | === Bugs === |
|
| |
| Known bugs
| |
|
| |
| * ...
| |
|
| |
| Reporting bugs
| |
|
| |
|
| Please report all bugs to the author. You should include the following information: | | Please report all bugs to the author. You should include the following information: |
Line 264: |
Line 39: |
| * The input file that produces the errors. | | * The input file that produces the errors. |
| * The output produced by iMath when running openoffice.org -writer <input file> from the command line | | * The output produced by iMath when running openoffice.org -writer <input file> from the command line |
| * Set the debugging option (Extras-Options-Writer-iMath) to a higher value to get more debugging output | | * Set the debugging option (Tools-Options-Writer-iMath) to a higher value to get more debugging output |