Closed WorldofJARcraft closed 2 years ago
Thank you for the patch. I think that MCL_USE_GMP=OFF on Windows because it requires extra libraries.
I have one question. The following command shows an error on Linux. Does it need any options?
cd ffi/java
mkdir build
cd build
cmake ..
mcl/ffi/java/build% cmake ..
-- JNI_INCLUDE_DIRS=/usr/lib/jvm/default-java/include;/usr/lib/jvm/default-java/include/linux;/usr/lib/jvm/default-java/include
-- JNI_LIBRARIES=/usr/lib/jvm/default-java/lib/libjawt.so;/usr/lib/jvm/default-java/lib/server/libjvm.so
-- MCL_LIBRARY=MCL_LIBRARY-NOTFOUND GMP_LIBRARY=/usr/lib/x86_64-linux-gnu/libgmp.so
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
MCL_LIBRARY
linked by target "mclelgamaljava" in directory /home/shigeo/Program/mcl/ffi/java
linked by target "mcljava" in directory /home/shigeo/Program/mcl/ffi/java
Hello @herumi,
the CMake-configuration expects the libmcl.a to be installed in the system library directory (/usr/lib) per default. You can set the MCL_LINK_DIR
CMake option to the directory where libmlc.a resides (e.g. cmake -DMCL_LINK_DIR=[path to mcl dir]/build/lib if mcl was compiled using CMake as well) to override this default location.
On Windows, since there is no default library directory, this option is mandatory.
I could have tried using a relative path (like ../../build), but this is highly discouraged in CMake, so I thought this was the best solution.
Thank you. I've merged it.
Hello,
I tried to build the Java FFI libraries on both Windows and Linux. While this worked on Linux using the Makefile, the Windows library would not link properly. Instead of trying to fix the Windows build scripts which I thought were difficult to understand and maintain and error-prone, I created a CMakeLists.txt which compiles both the native bindings and the test JARs and performs the tests using ctest. It was useful for me, so I wanted to contribute it back.
I have tested the CMakeLists and the corresponding documentation on both Windows 10 x86_64 and Ubuntu 20.04 amd64, and the mclwrap library worked without issue on both. The mclelgamalwrap library still fails to compile on Windows and crashes on Linux, but I don't think that this is related to the build script. It did the same for me when I tried to build it using the existing scripts.