Difference between revisions of "CoCoA:CoCoA5 Faq"

From ApCoCoAWiki
(→‎CoCoAServer Questions: rephrase issues with fork(), pretty up Unix systems)
(add info about building DLLs on Windows)
Line 5: Line 5:
 
==How can I compile and use the library on Windows==
 
==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.
 
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 [http://fsmath.mathematik.uni-dortmund.de/~mabshoff/CoCoA/dll/LibTest.exe 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==
 
==How can I compile and use the library on MacOSX==

Revision as of 17:49, 25 January 2006

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:

  1. Apply patch that removes some Unix specific stuff (coming soon - waiting for a clean up)
  2. build library as usual
  3. cd lib: mkdir dll; cd dll
  4. ar x ../libcocoa.a
  5. rm SocketStream.o QuotientModule.o
  6. 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.

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.