BrianGladman / mpir

Multiple Precision Integers and Rationals
GNU General Public License v3.0
75 stars 36 forks source link

Build dll_mpir_skylake_avx in VS2022 #29

Closed hrkalona closed 1 year ago

hrkalona commented 1 year ago

I am getting this error when I try to build it.

zero_p.c 1>Generating Code... 1>addmul_2.obj : error LNK2005: __gmpn_addmul_2 already defined in redc_2.obj 1> Creating library x64\Release\mpir.lib and object x64\Release\mpir.exp 1>x64\Release\mpir.dll : fatal error LNK1169: one or more multiply defined symbols found 1>Done building project "dll_mpir_skylake_avx.vcxproj" -- FAILED. ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== ========== Rebuild started at 8:30 PM and took 43.966 seconds ==========

BrianGladman commented 1 year ago

If you can let me know the host CPU for which you are building when this occurs, I will look into it.

hrkalona commented 1 year ago

I tried on two different host cpus: 1) i7 3770 2) i7-12800H

In any case, which solution should I use to get a mpir dll with assembly optimizations? I see there is the mpir and the mpir-tune

BrianGladman commented 1 year ago

I believe that you have not run mpir_config.py before building MPIR. You have to run this first and it allows you to select which CPU architecture(s) you wish to build. After this has been done you can then use Visual Studio to build the chosen architecture, which will be assembler optimised.

hrkalona commented 1 year ago

Ok so, I need to do that via the mpir_config.sln? Do I need to use some particular version of python? I have 3.8 installed.

I am just asking cause there are three different solutions: mpir_config.sln mpir.sln mpir-tune.sln

and I didnt see any info on what to do first. Also, I see that dll_mpir_skylake_avx is only available on vs2022. I guess the old solutions (vs 2019 and previous) dont have something similar

BrianGladman commented 1 year ago

How to use the Visual Studio build is described in the mpir.pdf document in the doc folder.

If you want assembler optimised versions you have to run mpir_config.py before using Visual Studio and this generates the files that Visual Studio needs to build optimised versions of MPIR. Python 3..8 is fine. You do NOT need to worry about mpir_config.sln or mpir-tune.sln since these are only used by me to develop and maintain mpir_config.py and do tuning.

If you run mpir_config.py without any input it outputs solutions for Visual Studio 2022. If you run it with a two digit input it will produce build files for the Visual Studio version that ends with these two digits.

hrkalona commented 1 year ago

thank you it worked!