Giter Club home page Giter Club logo

Comments (10)

vhnatyk avatar vhnatyk commented on July 18, 2024

Hi - this runs just fine on Windows, as I was able to make larger lib depending on this work:) But I built GMP myself and version 6.1.2 Maybe it's an issue of an older version of GMP?

from curv.

namuyan avatar namuyan commented on July 18, 2024

Thank you for comment.
My GMP majar ver is 4, yours is 6, maybe too old? I try to install same version.

  1. DL from gmp-6.1.2-1-mingw32-src.tar.xz
  2. compile by MYSYS way

config with --disable-static --enable-shared, I cannot find gmp.lib file but libgmp.a.
What I do next? or wrong way?

from curv.

vhnatyk avatar vhnatyk commented on July 18, 2024

.a files are static library in Unix format. It's basically the same as .lib file, though you need to convert it to Windows format. Actually - I don't quite can tell you how to convert(or even if it's possible at all), but I can tell you that you don't wanna follow that way for sure πŸ‘Ž In short, you will need to
make your own gmp.lib - follow this link.

I tried option with dumpbin and lib (the one with 50 upvotes) but you may try answer with implib tool. Actually the links you provided are for MSYS version of GMP - it's a bit different then MSVC I tried. I just remember I had some issue with converting MSYS .dll to .lib from Windows, so I had to do the other way around - generate .lib file inside MSYS, unfortunately I don't remeber for sure. Then rustup target add i686-pc-windows-msvc target installed and copy both gmp.dll and gmp.lib to C:\Users\<yourUserName>\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc Note: files like libgmp-10.dll , libgmp.a etc - try to rename them to gmp.dll , gmp.a etc - since on Windows rustc( or linker) doesn't try libgmp.dll as gmp.dll

I have my copy of gmp.dll and gmp.lib that just passed all curv tests (on x64 Windows 10).

 Running target\i686-pc-windows-msvc\debug\deps\curv-20a4d04f88163998.exe

 running 12 tests
 test arithmetic::big_gmp::tests::invalid_range_test ... ok
 test arithmetic::big_gmp::tests::sample_below_zero_test ... ok
 test arithmetic::big_gmp::tests::sample_below_test ... ok
 test arithmetic::big_gmp::tests::sample_range_test ... ok
 test arithmetic::big_gmp::tests::test_from_hex ... ok
 test arithmetic::big_gmp::tests::test_mod_mul ... ok
 test arithmetic::big_gmp::tests::strict_sample_test ... ok
 test arithmetic::big_gmp::tests::strict_sample_range_test ... ok
 test arithmetic::big_gmp::tests::test_mod_pow ... ok
 test arithmetic::big_gmp::tests::test_mod_sub_modulo ... ok
 test arithmetic::big_gmp::tests::test_mod_sub_negative_modulo ... ok
 test arithmetic::big_gmp::tests::test_to_hex ... ok

 test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Let me know if you can't make your copy and I will create the repo with binary distro of GMP I compiled (under LGPL) Unfortunately, I can't recreate all steps I performed that nasty day πŸ˜„ - there was some black magik before it all worked. But I can tell you to save yourself some mental health by running it all on Ubuntu. Anyway you won't compile GMP for 64 bit as it's almost impossible on MSYS - and even if - it will be so unstable you would cry. And 32 bit GMP has huge performance handicap comparing to 64. But if you still wanna Windows - just don't give up too early on making your own GMP - since with my version curv may compile just fine on your machine but crash immediately uppon launch, for reasons beyound this realm πŸ’€

from curv.

namuyan avatar namuyan commented on July 18, 2024

Thank you for help! I tried

  1. DL from gmp-6.1.2.tar.xz
  2. compile by MYSYS -> make check success
  3. dumpbin, add EXPORTS to top, rename to gmp.def and link.
  4. failed gmp.def(2) : fatal error LNK1118: syntax error in '(R)' statement
  5. but I find libgmp-3.dll.def from build folder and can create gmp.lib
  6. cargo test failed by many errors

Next, implibtool

  1. DL Digital Mars's IMPLIB tool
  2. create gmp.lib by dll -> looks success?
  3. copy to toolchain folder (gmp.lib, gmp.dll, gmp.dll.a)
  4. failed, this lib is broken?
note: Non-UTF-8 output: C:\\Users\\home\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\gmp.lib
fatal error LNK1136: \x83t\x83@\x83C\x83\x8b\x82\xaa\x96\xb3\x8c\xf8\x82\xc5\x82\xa0\x82\xe9\x82\xa9\x81A\x82\xdc\x82\xbd\x82\xcd\x89\xf3\x82\xea\x82\xc4\x82\xa2\x82\xdc\x82\xb7\x81B\r\n

Note
GMP is not good for Winodws, I feel.
I tried replase to pure Rust bignum, but I found deap dependency of KZen-networks's library. I need to check work on Windows/Linux/Raspibian ('Ο‰')
I want to test your gmp.lib, please distribute binary😰 if you can.

from curv.

namuyan avatar namuyan commented on July 18, 2024

I changed to lib /MACHINE:x64 /def:libgmp-3.dll.def /out:gmp.lib
I maybe success cargo test.
but raise error error: test failed, to rerun pass '--lib'.
I directly exec curv.exe and said cannot find libgmp-3.dll.dll so I renamed gmp.dll to libgmp-3.dll.dll and moved to same folder.
I re-exec and said error 0xc000007b, the option is wrong?
one of long error -> https://pastebin.com/EntqsbE7

Note
I find below comment now. ops

from curv.

vhnatyk avatar vhnatyk commented on July 18, 2024

Hmm - pls note that you are still using default target ...\x86_64-pc-windows-msvc\lib\gmp.lib while it should be i686-pc-windows-msvc. Hence maybe your 6. cargo test failed by many errors - may be actually sign of a good library, because on default target (that is x86_64-pc-windows-msvc in your case) it will complain on x86 library and will give something like '108 unresolved externals...' Also you may want to read more on #35785

Try with the first way again, but pls do cargo test --target=i686-pc-windows-msvc this time (I thought it's guessable - my fault πŸ˜‰) Also you don't need gmp.dll.a - well I would say don't copy it, anyway seems like binaries obtained form IMPLIB are corrupted. In the meanwhile you can try my GMP release - but for production you would still be better with your own binaries as I could be a nasty hacker 😈 You never now...

from curv.

vhnatyk avatar vhnatyk commented on July 18, 2024

Looked at your log at pastebin - seems like I was correct and you have there localized version of

     warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'

Seems indeed like all you have to do is use library from way with dumpbin and with correct target cargo test --target=i686-pc-windows-msvc

BTW - I suggest you to switch your system default language to english;)

from curv.

namuyan avatar namuyan commented on July 18, 2024

Thank you! your binary work fine!

  1. make curv.exe by cargo test --features=ec_secp256k1 --target=i686-pc-windows-msvc
  2. copy gmp.dll to folder with curv.exe

And I can make binary too! I need MinGW-w64 (32bit).
But I will use as Python extension so I need to build by x86_64.
I find good info build-gmp-on-64bit-windows, will try after.

I know how to use on X86_64.

Summary

  1. DL GMP source from gmp-6.1.2.tar.xz
  2. DL MESYS2 from msys2-x86_64-20180531.exe
  3. use MinGW-w64 (64bit) and install toolchain by
    pacman -Syuu, pacman -S base-devel and pacman -S mingw-w64-x86_64-toolchain JP
  4. build by Install GMP with Windows
  5. into .lib and rename to gmp.lib gmp.dll
  6. lib /MACHINE:X64 /def:gmp.def /out:gmp.lib and copy gmp.dll to folder with curv.exe
  7. copy gmp.lib to C:\Users\home\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib
  8. check by cargo test

Note
error: test failed, to rerun pass '--lib', exec curv.exe and find error message.

from curv.

vhnatyk avatar vhnatyk commented on July 18, 2024

btw - just placing gmp.dll and gmp.lib into target lib folder like from 6.) should be just fine too - then no need to copy dll manually back and forth, and pls close the issue if u r fine now:)

from curv.

namuyan avatar namuyan commented on July 18, 2024

Thank you for support! I solved the problem and go next step.

from curv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.