Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: amaclin1 on September 23, 2017, 10:05:27 AM



Title: libsecp256k1 as a library/dll/etc
Post by: amaclin1 on September 23, 2017, 10:05:27 AM
I want to use libsecp256k1 in my project.
But I can not compile it - there is no <gmp.h> in my system.
I use Qt/C++ out-from-the-box package in windows.

Is it possible to use a dll for windows or library (.a) file to add it
to current project without installing dependances and compiling sources?


Title: Re: libsecp256k1 as a library/dll/etc
Post by: achow101 on September 23, 2017, 04:27:24 PM
Is it possible to use a dll for windows or library (.a) file to add it
to current project without installing dependances and compiling sources?
Sure, but AFAIK, no one publishes builds for it.

You can use mingw or cygwin to compile it and get the .dll/.a files for it.


Title: Re: libsecp256k1 as a library/dll/etc
Post by: amaclin1 on September 23, 2017, 04:33:09 PM
Sure, but AFAIK, no one publishes builds for it.
You can use mingw or cygwin to compile it and get the .dll/.a files for it.
I tried to do it, but got an error that there is no <gmp.h>
(indeed, there is no such file on my disk)
And I am not familar with configure/make/etc tools


Title: Re: libsecp256k1 as a library/dll/etc
Post by: piotr_n on September 23, 2017, 04:39:17 PM
Try this, if you want: https://sourceforge.net/projects/gocoin/files/secp256k1_win.zip/download



Title: Re: libsecp256k1 as a library/dll/etc
Post by: amaclin1 on September 23, 2017, 04:46:21 PM
Try this, if you want: https://sourceforge.net/projects/gocoin/files/secp256k1_win.zip/download
Thanks a lot. I'll try.
The library files are dated by 2016, so I would like to use more current version.


Title: Re: libsecp256k1 as a library/dll/etc
Post by: achow101 on September 23, 2017, 04:48:56 PM
I tried to do it, but got an error that there is no <gmp.h>
(indeed, there is no such file on my disk)
And I am not familar with configure/make/etc tools
Install libgmp. Mingw and cygwin both have their own package manager things and you should be able to install it through those.


Title: Re: libsecp256k1 as a library/dll/etc
Post by: piotr_n on September 24, 2017, 02:06:09 PM
Try this, if you want: https://sourceforge.net/projects/gocoin/files/secp256k1_win.zip/download
Thanks a lot. I'll try.
The library files are dated by 2016, so I would like to use more current version.

Here is how you can build it yourself.

1. Install MSYS2 and the gcc compiler(s) you want, following the first answer from here: https://stackoverflow.com/questions/30069830/how-to-install-mingw-w64-and-msys2

2. From the msys shell use "pacman -S ..." command to install the following packages: autoconf, perl, automake-wrapper, libtool, make

3. Fetch the latest sources from https://github.com/bitcoin/bitcoin/ and copy the "src/secp2561k" folder to the "home" of your msys2 shell (you don't need the rest of the core's code - just secp2561k)

4. Go inside the secp2561k folder and excute "./autogen.sh", then "./configure", then "make"

Your lib will be inside the ".libs" folder.
You can do "make install" to install it for you msys2 toolset.
To convert it into a dll, see the bat file from the zip I gave you before.

I might have missed something, so let me know if it didn't work.


Title: Re: libsecp256k1 as a library/dll/etc
Post by: amaclin1 on September 24, 2017, 02:11:52 PM
Here is how you can build them yourself.
Fucking routine! :)))))))))
I need two files. One library file and one .h file for compiling my c++ sources for my windows :)
I do not want to install addional msys/mingw/compilers/tools/managers/etc/etc/etc
Why the things in modern software development are so complicated?  ;D


Title: Re: libsecp256k1 as a library/dll/etc
Post by: ScripterRon on September 25, 2017, 02:47:37 PM
Here is how you can build them yourself.
Fucking routine! :)))))))))
I need two files. One library file and one .h file for compiling my c++ sources for my windows :)
I do not want to install addional msys/mingw/compilers/tools/managers/etc/etc/etc
Why the things in modern software development are so complicated?  ;D
I feel your pain :)

The Windows 10 Creators Fall Update includes the Linux subsystem.  It allows you to run Linux under Windows with better integration than using a separate virtual machine (such as VirtualBox).  I'm part of the Windows Insider program and I installed Ubuntu without any problems and can directly read/write files in the Windows filesystem from my Ubuntu session (the reverse is not true - you cannot access Linux files from a Windows session).  I successfully ran bitcoind in the Linux session.

Unfortunately, there is no official GUI support in the Linux session, although I have seen reports of people who have gotten Gnome up and running.  I may look into this some more after the Fall Update is officially released (it is getting close - I have been getting new builds every 2-4 days recently).


Title: Re: libsecp256k1 as a library/dll/etc
Post by: amaclin1 on September 25, 2017, 03:22:20 PM
The Windows 10 Creators Fall Update includes the Linux subsystem.
I have Win7 and I do not have time and money want to upgrade to Win10

Quote
I successfully ran bitcoind in the Linux session.
I want to use libsecp256k1 not for bitcoin-related project.
I have some experience running Ubuntu under OracleVM, but the main tool for me now is Windows


Title: Re: libsecp256k1 as a library/dll/etc
Post by: samson on September 26, 2017, 10:55:53 PM
If you can't be bothered to install a dependency then thats hard luck.

mbedTLS will build without any external dependencies, it has its own MPI functions and supports secp256k1 primitives - you're still going to have to download it and build it from scratch though.


Title: Re: libsecp256k1 as a library/dll/etc
Post by: gmaxwell on September 26, 2017, 11:13:38 PM
Libsecp256k1 works fine with no dependencies at all.  You're having dependency issues because you're bypassing the build system and doing something horrible.  Read the fine instructions.  Otherwise it's like drilling into someone's head and then complaining that you have to provide infrastructure to keep the blood circulating or they stop being able to give you advice. :)

> mbedTLS will build without any external dependencies, it has its own MPI functions and supports secp256k1 primitives

And is probably not even remotely constant time for it and is probably also super slow...


Title: Re: libsecp256k1 as a library/dll/etc
Post by: btctousd81 on September 27, 2017, 02:42:45 PM
i am not sure, if this is what you are looking for .,
ref https://github.com/bitcoin-core/secp256k1/issues/451

Quote
You can configure libsecp256k1 not to use GMP at all. Option is --with-bignum=none.