Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build monero-cpp for MSVC x64 2019 compiler? #26

Open
ghost opened this issue Jan 11, 2023 · 5 comments
Open

How to build monero-cpp for MSVC x64 2019 compiler? #26

ghost opened this issue Jan 11, 2023 · 5 comments

Comments

@ghost
Copy link

ghost commented Jan 11, 2023

I am experiencing some difficulties with compiling this library for my project, which also compiles under Windows.

As I understand it, under Windows i can only compile using MSYS2 and MINGW compiler, which is bad for me. MSVC and MINGW can at least have different ABIs and the static library files themselves have different extensions.

I had an idea to compile the project with the MSVC compiler, but I ran into a problem. I was unable to compile the "libunbound" library. I think "libunbound" is basically not designed to be compiled through MSVC.

Is there any way I can compile the project and at least get the *.lib static libraries so I can use "monero-cpp" in my project?

@woodser
Copy link
Owner

woodser commented Jan 11, 2023

Windows is supported using MSYS and MINGW compiler. I don't know how to build with MSVC, but if you manage to get it working, we can update the instructions accordingly.

The unbound dependency is installed using pacman on MSYS2 from the Windows instructions.

It may be possible to use the installed unbound lib by copying from its installed path or by hacking CMakeLists.txt to use a custom path. Again, I don't know.

@ghost
Copy link
Author

ghost commented Jan 11, 2023

The unbound dependency is installed using pacman on MSYS2 from the Windows instructions.

It may be possible to use the installed unbound lib by copying from its installed path or by hacking CMakeLists.txt to use a custom path. Again, I don't know

I found their project: https://github.com/NLnetLabs/unbound.
As I understand it, it's just not possible to compile it through MSVC.

But they supply libraries:
https://nlnetlabs.nl/downloads/unbound/unbound-1.17.0.zip, where you can find *.dll and *.a files, but again, this is only good if I compile using the mingw compiler, as I understand .

pacman installs the unbound dependencies, which also have *.dll and *.a files, which are most likely compiled via mingw. I tested this one too :)

From the other side: what does libunbound affect? I essentially need the functionality of access to the node: getting balances, history, network fee, sending transactions. Is it possible to completely remove libunbound from the project without breaking its functionality so that I can compile it? Although I suspect that libunbound will not be the only problem when compiling with MSVC compiler :)

@woodser
Copy link
Owner

woodser commented Jan 11, 2023

From the other side: what does libunbound affect? I essentially need the functionality of access to the node: getting balances, history, network fee, sending transactions. Is it possible to completely remove libunbound from the project without breaking its functionality so that I can compile it? Although I suspect that libunbound will not be the only problem when compiling with MSVC compiler :)

This is a good question for #monero-dev, since they recently unvendored libunbound and updated the build to use an external version.

@ghost
Copy link
Author

ghost commented Jan 11, 2023

This is a good question for #monero-dev, since they recently unvendored libunbound and updated the build to use an external version.

I assume it hasn't been merged into master yet?

In any case, I will try to compile my entire project with the mingw compiler on Windows. If I succeed, then this will be the solution to the problem.

I also have an idea to use Python and Boost. Try to execute Python scripts in C++ through the Boost library. I think if initially write everything in Python, then there will not be such compilation problems that occur in C++..

@woodser
Copy link
Owner

woodser commented Jan 11, 2023

I assume it hasn't been merged into master yet?

It's been merged into master branch and included in previous releases of monero-project.

The Windows instructions in monero-project use MSYS2 and MingGW. Compiling monero-project as an external dependency would be the first step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant