|Axel Vogt on Wed, 27 Sep 2006 21:13:43 +0200|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|compiling PARI 2.3.0 with Microsoft MSVC6|
Karim Belabas helped me to find out how one can compile PARI in a pure MS environment using MSVC6 and provided 2 files needed for that, see below. This was done on WinME (=Win98) and can not say how it behaves for newer OS. But without using special compiler settings it should work there as well. Note that it has no assembler parts. The following is an amendment of Bill Daly's recipe how to proceed for the current version, I just added my comments. For convenience I uploaded the whole project as zipped file (including the 2 additional files needed): http://www.axelvogt.de/axalom/pari/index.html Greetings Axel Vogt ----------------------------------------------------------- some additions by AVt for MSVC6 (using WinME) and pari 2.3.0 (and I highly appreciate Karim's help to find it out - thx!) Here is a description of the steps necessary to compile PARI with the MSVC compiler under WIN32. AVt: please note you need two extra file versions for mp.c and pariinl.h which of course are due to Karim Belabas 1. Unzip the archive, preserving folder names so that the directory structure is correct. I use WinZip to do this, and I put the files on my D: drive, so that the files for pari-2.1.0 for example will be stored under D:\pari-2.1.0. Note that the archive as downloaded, pari.tgz, is an archive of an archive. Winzip doesn't know how to unzip pari.tgz, so I use Aladdin Expander to do this, which will create for example the file pari-2.1.0.tar in the same directory as pari.tgz. Unfortunately, Aladdin Expander doesn't know how to unzip this file, so I use Winzip to do it. Isn't Windows wonderful? 1. AVt: one only needs files with extension *.c or *.h, so delete all the others 2. MSVC doesn't like names of the form "pari-2.1.0", so rename the base directory to something like "pari210". Now the files are stored under D:\pari210. 2. AVt: in my example the name is pari_2_3_0 3. Start MSVC (I use version 6, but earlier versions will probably work the same way). 4. Select "File\New..." and pick the "Project" tab to create a new project. Select "Win32 Console Application" as the project type, and specify the project name as "pari210". Make sure that the "Location" of the files is D:\pari210. Click "OK", then select "An empty project" (should be the default anyway) and click "Finish". 4. AVt: I just close MSVC and move the stuff to C:\temp\pari\pari_2_3_0 Then a double click on pari_2_3_0.dsw opens the project in that location. 5. Select "Project\Add to project\Files..." to add files to the project. Select all the *.c and *.h files in src\basemath, src\headers, src\kernel\ix86, src\language, src\modules and Odos, EXCEPT pariCE.[ch]; all of the files in src\gp except gp_rl.c; the files plotnull.c, plotport.c and rect.h in src\graph.c; and the file src\kernel\none\mp.c. 5. AVt: you need some more files, 2 of them are separate: add src/kernel/none/tune-gen.h add src/kernel/none/mpinl.c add src/kernel/none/level0.h delete Odos/acro.c from project delete src\kernel\ix86, one does not need that replace Odos/pariinl.h by the accompanied version replace /src/kernel/none/mp.c by the accompanied version 6. Select "Project\Settings" and pick the "C/C++" tab. Select "Preprocessor" from the "Category" menu, and enter "D:\pari210\src\headers,D:\pari210\Odos" into the "Additional include directories" box. (I also select the "Code Generation" category and change the "Struct member alignment" to "1 byte", but this may not be necessary.) It is usually convenient for debugging to select the "Debug" tab and specify a "Working directory", e.g. "D:\gp" if you have .gp files there that you can use for testing. 6. AVt: C:\temp\pari\Odos,C:\temp\pari\src\headers are my settings 6. AVt: I do not change "Struct member alignment", leave it at default. AVt: The overall directory structure should look like this in C:\temp pari | |---- Odos |---- pari_2_3_0 | | | |---- debug | |---- release |---- src | | ... AVt: find an extra file listing to check it all ... You should now be able to build and test the program. When you want to build a release version, you will have to repeat step 6 above, since MSVC doesn't apply the project settings globally. AVt: in the release version you can disable language extensions to make the exe a bit smaller A couple of points: ------------------- You may get some inconsequential warning messages. You can suppress these by adding a line of the form: #pragma warning(disable: ...) to paricfg.h, where ... is a space-delimited list of warning numbers, e.g. "4018 4244" corresponding to the warnings C4018 and C4244. When you compile a release version, global optimization is enabled by default. MSVC is fairly buggy with global optimization, so you may find that some modules won't compile with it, e.g. sumiter.c. You can either disable global optimization (in "Project\Settings" under the tab "C/C++" in the category "Optimization"), or you can surround the offending code with: #pragma optimization("g", off) ... #pragma optimization("g", on) AVt: I just ignore the warnings about type conversions, they have no effect AVt: I had no problems with optimization for version 2.3.0, overall it compiles and links with "pari_2_3_0.exe - 0 error(s), 104 warning(s)" AVt: the result has restricted functionally as command line application. I played a bit with MS variants, but could not resolve this.