CoCoA:CoCoA5 Faq
CoCoALib Questions
This is the place for all problems as long as it is somehow related to CoCoA 5.
How can I compile and use the library on Windows
Please read the CoCoALib and Cygwin FAQ where you find instructions how to setup the build environment, the needed libraries and the CoCoALib itself in great detail.
How can I a build dynamic version of the CoCoA library on Windows?
If have lots of executables linking to the CoCoA library you can save some space by dynamically linking the CoCoA library instead of using a static version. While most Linux/Unix/MacOSX developers have no preference of static vs. dynamic libraries it is uncommen in the Windows world to deal with static libraries, hence most Windows developers prefer DLLs. While you cannot build the CoCoA library with the Microsoft Visual Studio or Intel compiler just yet (there is work being done for the 0.96 release) one can use MinGW to build a DLL on Windows. This DLL can be used when compiling and linking code with the Visual Studio compiler, i.e. CL.exe.
Ok, here are the instructions to build a DLL on Windows using MinGW:
- Apply patch that removes some Unix specific stuff (coming soon - waiting for a clean up)
- build library as usual
- cd lib: mkdir dll; cd dll
- ar x ../libcocoa.a
- rm SocketStream.o QuotientModule.o
- g++ -shared *.o -o ../cocoa.dll /home/gmp-4.1.4-static/lib/libgmp.a
The resulting DLL with the needed headers can be found here. The DLL is packaged as a self-executing RAR-archive. You still need to get a GMP.DLL.
If you like to use this DLL when compiling example code, i.e. ex-Ring.C you could use something like
g++ -I ../include -I /home/gmp-4.1.4-static/include -L ../lib/ -lcocoa ex-Ring1.C
To use the DLL with the Microsoft Visual Studio compiler one needs to build a .def and a .lib file. This can be done using dlltool from MinGW and lib.exe distributed with Visual Studio. Stay tuned for more details.
How can I compile and use the library on MacOSX
Apple provides a set of development tools which among other things provides a version of the gcc and a development environment called Xcode. Some information about Xcode can be found in this wikipedia article or at the Apple Xcode information page. The version of the gcc shipped with the development tools of MacOSX 10.3 and 10.4 compiles the CoCoALib just fine.
How can I compile and use the library on Solaris
We have build the CoCoA Library on Solaris using the current SunStudio compiler as well as gcc 3.3 and 3.4 in 32 and 64 bit modes.
After running the configure script provided with the CoCoA Library source you need to edit configuration/autoconf.mk. Change
CXXFLAGS_OPT=-O2 SOCKET_LIB=
to
CXXFLAGS_OPT=-g -O2 -m64 -mptr64 -Wa,-xarch=v9 -mcpu=v9 SOCKET_LIB= -lnsl -lsocket -lresolv
when using the gcc. For the SunStudio cc use
CXXFLASGS_OPT=FIXME SOCKET_LIB= -lnsl -lsocket -lresolv
You need to make sure that you have a gmp compiled in the right mode, otherwise the linker will complain about the wrong elf-class when linking the final library. Depending on your installation - usually when compiling in 64 bit mode - one might also need to expand the environment variable LD_LIBRARY_PATH to include the libstdc++.so (in case of the gcc) or some other 64 bit version of the libstd (in case of the SunStudio c++ compiler). Otherwise you might run into problems when running binaries that link to the CoCoA libaray since the linker can't find certain libraries.
CoCoAServer Questions
The CoCoAServer can be build on Linux, MacOSX or any decent Unix system, i.e *BSD, Solaris, or AIX. On Windows the Cygwin-tools are required; neither MinGW nor the Microsoft compilers can build the CoCoASever due to lack of an implementation of the fork() call. We hope that at some point in the future we will implement a work-around for that issue. Another possibility on Windows is the Microsoft SFU (Services for Unix) package, but since we do not have access we cannot test the build. Microsoft plans to integrate (at least parts of) SFU into Windows Server 2003 R2, so let's see what the future holds.
Know Bugs
For a list of know bugs check out the CoCoALib_Buglist. If you have found another bug that is not on that list please consult Reporting_Bugs and if you feel like debugging check out Debugging_CoCoALib if you feel like fixing the problem.