monero-cpp icon indicating copy to clipboard operation
monero-cpp copied to clipboard

When I use msys2 to operate 'Using this library in your project' on window, I get the following exception, I am not familiar with cmake and don't know how to solve this problem.

Open yzqyzq opened this issue 2 years ago • 12 comments

I modified 'cd $MONERO_CPP/external/monero-project && make release-static -j8 && make release-static -j8' of operation 5 to 'cd $MONERO_CPP/external/monero-project && make release-static-win64 - j8 && make release-static-win64 -j8'.

Execute operation 6 to the following exception.

[ 98%] Linking CXX executable ../../bin/monero-gen-trusted-multisig.exe [ 98%] Linking CXX executable ../../bin/monero-blockchain-mark-spent-outputs.exe make[3]: Leaving directory '/monero-java/external/monero-cpp/external/monero-project/build/release' [ 98%] Built target blockchain_blackball make[3]: Leaving directory '/monero-java/external/monero-cpp/external/monero-project/build/release' [ 98%] Built target gen_multisig [ 98%] Linking CXX executable ../../bin/monero-wallet-cli.exe make[3]: Leaving directory '/monero-java/external/monero-cpp/external/monero-project/build/release' [ 98%] Built target simplewallet [100%] Linking CXX executable ../../bin/monero-wallet-rpc.exe make[3]: Leaving directory '/monero-java/external/monero-cpp/external/monero-project/build/release' [100%] Built target wallet_rpc_server make[2]: Leaving directory '/monero-java/external/monero-cpp/external/monero-project/build/release' make[1]: Leaving directory '/monero-java/external/monero-cpp/external/monero-project/build/release' -- Building for: Ninja -- The C compiler identification is GNU 12.1.0 -- The CXX compiler identification is GNU 12.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: D:/software/msys2/mingw64/bin/cc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: D:/software/msys2/mingw64/bin/c++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- EXTERNAL_LIBS_DIR:D:/software/msys2/monero-java/external/monero-cpp/external-libs -- EXTRA_LIBRARIES:setupapi Protobuf_INCLUDE_DIR------------->>>D:/software/msys2/mingw64/include/protobuf-3.21.2 -- Found Protobuf: usr/bin/ (found version "3.21.2") Protobuf_INCLUDE_DIR------------->>>D:/software/msys2/mingw64/include/protobuf-3.21.2 -- Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR) (found version "3.21.2") -- Protobuf lib: usr/bin/, inc: , protoc: D:/software/protoc/bin/protoc.exe -- Using Boost include dir at D:/software/msys2/mingw64/include -- Found OpenSSL: D:/software/msys2/mingw64/lib/libcrypto.dll.a (found version "1.1.1q") -- Using OpenSSL include dir at D:/software/msys2/mingw64/include -- Using libsodium library at D:/software/msys2/mingw64/lib/libsodium.dll.a -- Found HIDAPI: D:/software/msys2/mingw64/lib/libhidapi.dll.a -- Using HIDAPI include dir at D:/software/msys2/mingw64/include/hidapi -- Using monero-project build:D:/software/msys2/monero-java/external/monero-cpp/external/monero-project/build/release -- Configuring done -- Generating done -- Build files have been written to: D:/software/msys2/monero-java/external/monero-cpp/build ninja: error: '../external/monero-project/build/release/src/crypto/wallet/libwallet-crypto.a', needed by 'libmonero-cpp.dll', missing and no known rule to make it

yzqyzq avatar Jul 21 '22 09:07 yzqyzq

Does building monero-project complete successfully (with cd $MONERO_CPP/external/monero-project && make release-static-win64 - j8 && make release-static-win64 -j8)?

This would be the first step, to ensure monero-project builds successfully, and work through any build errors.

Then, monero-cpp is currently expecting to find ../external/monero-project/build/release/src/crypto/wallet/libwallet-crypto.a, which is built with monero-project on *nix systems.

On Windows, it might build this library file to a different file name (e.g. *.dll?), so we'll need to update monero-cpp to use that library file on Windows.

woodser avatar Jul 21 '22 16:07 woodser

libwallet-crypto.a is not found, so I don't know how to make it generate this file. I see that it should depend on the following code.

1

The crypto/wallet/ops.h file cannot generate the required header files.

In a linux environment I see it generates the following

2

yzqyzq avatar Jul 21 '22 16:07 yzqyzq

I can't get in here

3 So the file could not be generated

yzqyzq avatar Jul 21 '22 16:07 yzqyzq

Does building monero-project complete successfully (with cd $MONERO_CPP/external/monero-project && make release-static-win64 - j8 && make release-static-win64 -j8)?

woodser avatar Jul 21 '22 18:07 woodser

I'm not very familiar with this stuff, so I'm not sure if the build is complete. I see that the build is already 100%, and the following two files are the output of my two make make1.txt make2.txt

yzqyzq avatar Jul 22 '22 04:07 yzqyzq

It looks like your build is completing successfully.

Within monero-project's build directory, do you have files in release/lib, like libwallet or libwallet_merged?

Or perhaps release/src/common/libcommon?

woodser avatar Jul 23 '22 19:07 woodser

Yes. These files have already been generated. But failed to generate 'external/monero-project/build/release/src/crypto/wallet/libwallet-crypto.a'.

yzqyzq avatar Jul 24 '22 02:07 yzqyzq

Ah ok, great. This library isn't configured to work with Windows, so CMakeLists.txt makes assumptions for files that are specific to Linux/Unix, like libwallet-crypto.a. Windows will build library files with a different extension (*.dll?). It should be relatively easy to update the file paths in CMakeLists.txt and other configuration for Windows.

There's an open issue to support Windows which help is wanted for: https://github.com/monero-ecosystem/monero-cpp/issues/10.

woodser avatar Jul 24 '22 03:07 woodser

How to modify CMakeLists.txt and window configuration? I don't get it at all, I looked at the paths inside the CMakeLists.txt and it was just the libwallet-crypto.a file missing

yzqyzq avatar Jul 24 '22 07:07 yzqyzq

A new version of this library is released, v0.7.2. which updates to monero-project v0.18.0.0, which had completely removed libwallet_merged.a, resulting in the error reported in this issue. Please try the new version and let me know if you continue to have problems. Some things may still need updated for Windows. Thanks.

woodser avatar Aug 07 '22 13:08 woodser

I have updated to the latest version, libwallet_merged.a is no longer generated, but the libwallet-crypto.a file is still missing.

yzqyzq avatar Aug 08 '22 07:08 yzqyzq

I found out that libwallet-crypto.a is only built on x86_64 systems to provide asm for some wallet functions.

https://github.com/monero-ecosystem/monero-cpp/pull/18 imports that library only if it exists, and should hopefully resolve this issue.

woodser avatar Aug 08 '22 21:08 woodser