haveno-dex / haveno

Decentralized P2P exchange platform built on Monero and Tor
https://haveno.exchange
GNU Affero General Public License v3.0
980 stars 110 forks source link

Build monero-java and monero-cpp to static libraries with shared library wrapper [4 XMR] #795

Open woodser opened 6 months ago

woodser commented 6 months ago

This issue requests building monero-java and monero-cpp to static libraries so all dependencies are self-contained, with a shared library wrapper to access libmonero-java in JNI.

For example: libmonero-cpp.a, libmonero-java.a, and libmonero-java.so.

This will help us switch from using monero-wallet-rpc to native wallet bindings for better performance, and without depending on MSYS2 in Windows.

This issue shares the same bounty as the related issue in monero-java: https://github.com/woodser/monero-java/issues/74

github-actions[bot] commented 6 months ago

There is a bounty on this issue, the amount is in the title. The reward will be awarded to the first person or group of people who resolves this issue.

If you are starting to work on this bounty, please write a comment, so that we can assign the issue to you. We expect contributors to provide a PR in a reasonable time frame or, in case of an extensive work, updates on their progresses. We will unassign the issue if we feel the assignee is not responsive or has abandoned the task.

Read the full conditions and details of our bounty system.

niyid commented 5 months ago

I just saw this had been reopened. What is the issue?

On Tue, Apr 2, 2024, 1:35 PM woodser @.***> wrote:

Reopened #795 https://github.com/haveno-dex/haveno/issues/795.

— Reply to this email directly, view it on GitHub https://github.com/haveno-dex/haveno/issues/795#event-12325136481, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2MWRYYNG5NOE5QNS7SS6DY3KQX5AVCNFSM6AAAAABDY3WFJOVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJSGMZDKMJTGY2DQMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

woodser commented 5 months ago

I think the only issue is that the dynamic libraries require MSYS2 to be installed and on the Path variable in Windows, whereas static libraries would be self-contained and shouldn't require external dependencies.

niyid commented 5 months ago

It seems MSYS2 is open source? Have you built it along with other dependencies from source into static libraries?

On Fri, Apr 5, 2024, 11:28 AM woodser @.***> wrote:

I think the only issue is that the dynamic libraries require MSYS2 to be installed and on the Path variable in Windows, whereas static libraries would be self-contained and shouldn't require external dependencies.

— Reply to this email directly, view it on GitHub https://github.com/haveno-dex/haveno/issues/795#issuecomment-2039443798, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2MWR4ZKMKUHTM7QR45Q63Y3Z4GNAVCNFSM6AAAAABDY3WFJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZZGQ2DGNZZHA . You are receiving this because you commented.Message ID: @.***>

woodser commented 5 months ago

No, creating static libraries with a shared library wrapper is the request of this issue.

niyid commented 5 months ago

I think the only issue is that the dynamic libraries require MSYS2 to be installed and on the Path variable in Windows, whereas static libraries would be self-contained and shouldn't require external dependencies.

I am not clear what the issue is from here. I summize it is an issue with MSYS2 on Windows; and that this is a Windows only issue.

woodser commented 5 months ago

The libraries should not have external dependencies which need to be installed, but should be standalone, which switching to static libraries ought to support?

Otherwise, someone installing Haveno and using the native libraries would additionally need to install MSYS2.

mcneb10 commented 4 months ago

I would like to look into this

woodser commented 4 months ago

@mcneb10 Great!

woodser commented 2 months ago

@mcneb10 Any progress?

Currently, the dynamic libraries built for Linux only work on Ubuntu 20.0.4 as far as I know (what they're built from). But there's a linker error on later versions.

This would be resolved by building to static libraries.

woodser commented 2 months ago

Bounty bumped to 3 XMR.

mcneb10 commented 2 months ago

I'm sorry I have been distracted and unmotivated recently. I was not able to compile to source due to some linking errors with the unbound package. I will have another look today.

woodser commented 2 months ago

No worries, we can leave this unassigned if it doesn't work out.

woodser commented 2 months ago

@mcneb10 Please ping me if I can help with the linker error. I've built it a few times :)

preland commented 2 months ago

Is this issue related to the mac universal issue on Haveno?

woodser commented 2 months ago

Not quite. That issue is to create universal binaries which run natively on mac x86_64 and arm64 without emulation, whereas this issue is to build the monero-java libs to static libraries with a dynamic wrapper on all platforms, for portability. Othewise, the libs built on Ubuntu 20.04 can't run on 22.04.

mcneb10 commented 2 months ago

Note to anyone compiling this: if you try to compile on anything except a distro based on stable debian you will run into errors very quickly

nsec1 commented 2 months ago

@woodser , I need help to integrate new monero-java.so to haveno. Do I just have to "mvn install" on monero-java and then build haveno with make?

woodser commented 2 months ago

I believe you can simply add the path to the newly built libraries to your CLASSPATH variable and then start Haveno with --useNativeXmrWallet=true.

But to do a complete install:

You could make some change in monero-java to confirm the update however you do it, e.g. adding std::cout << "getting balance!" << std::endl; to uint64_t monero_wallet_full::get_balance() const in monero_wallet_full.cpp.

nsec1 commented 2 months ago

@woodser , could you check? woodser/monero-cpp#64 woodser/monero-java#105

nsec1 commented 2 months ago

@woodser, could you check woodser/monero-java#105?

KewbitXMR commented 2 months ago

Is this still outstanding? Anyone currently working on it?

woodser commented 3 weeks ago

Is this still outstanding? Anyone currently working on it?

It's being worked on by @nsec1 here: https://github.com/woodser/monero-java/pull/105

KewbitXMR commented 3 weeks ago

Is this actively being worked on?

woodser commented 3 weeks ago

Yes, @nsec1 has new changes I need to test: https://github.com/woodser/monero-java/pull/105#issuecomment-2303096985