The c++ library ‘clij2fft’ implements several FFT based algorithms built on top of clFFT. This library is indepentent of java.
Running the javacppbuild.cpp script should orchestrate all parts of the build process by calling cppbuild.sh
, mvn install
, and then copying the native wrapper to the lib directory.
For completeness (and to help troubleshoot) the build process is described in more detail below.
Visual Studio Community 2019 c++ compiler
Git for Windows with Bash Terminal
clij2-fft/lib/win64/
directory.clij2-fft/lib/linux64/
directory.You will need to install clFFT
from here using homebrew.
To build on macosx or mac m1/m2 (arm64) perform the following
The macosx the native library libclij2fft needs to be modified with install_name_tool
in order for it to find clFFT
in it’s current directory (ie when both are installed in a conda environment and are in /mambaforge/envs/current_environment/lib)
install_name_tool -change libclFFT.2.dylib @rpath/libclFFT.2.dylib ../../../lib/macosx-arm64/libclij2fft.dylib
If targeting both macosx and macosx-arm64 you can build a universal binary using ‘lipo’
lipo -create -output lib/macosx-universal2/libclFFT.dylib lib/macosx/libclFFT.dylib lib/macosx-arm64/libclFFT.dylib`
clij2-fft/lib/macosx/
or clij2-fft/lib/macosx-arm64
directory.A 64 bit c++ compiler is needed to create the wrapper. In windows from Start menu run ‘x64 Native Tools Command Prompt for VS 2019’. In Linux/MacOsx make sure a 64 bit c++ compiler (ie gcc) is installed.
Run ‘mvn install -Dgpg.skip’ from the command line or GUI. NOTE: -Dgpg.skip is needed to skip signing if building for testing or local installation.
If the javacpp part of the native build is successful a wrapper libary called jniclij2fftWrapper
will be created and put into the target/classes/net/haesleinhuepf/clijx/plugins/$PLATFORM/
directory. We want to copy the library into the top level lib folder (currently we store the libraries in github). That can be done with the following bash snippet….
case $PLATFORM in
linux-x86_64)
echo "copy jni wrapper"
cp target/classes/net/haesleinhuepf/clijx/plugins/$PLATFORM/libjniclij2fftWrapper.so lib/linux64/
;;
macosx-x86_64)
echo "copy jni wrapper"
cp target/classes/net/haesinhuepf/clijx/plugins/$PLATFORM/libjniclij2fftWrapper.dylib lib/macosx/
;;
macosx-arm64)
echo "copy jni wrapper"
cp target/classes/net/haesinhuepf/clijx/plugins/$PLATFORM/libjniclij2fftWrapper.dylib lib/macosx-arm64/
;;
windows-x86_64)
echo "copy jni wriapper"
cp target/classes/net/haesleinhuepf/clijx/plugins/windows-x86_64/jniclij2fftWrapper.dll lib/win64/
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
;;
There is a fiji update site at https://sites.imagej.net/clijx-deconvolution
where we push the artifacts. After a build you need to
clij2-fft_{version}.jar
to the Fiji.app/plugins
directory.lib/{platform}/{lib}clij2fft.{dll/so/dylib}
to the corresponding location in Fiji.app/lib
.lib/{platform}/{lib}jniclij2fftWrapper.{dll/so/dylib}
to the corresponding location in Fiji.app/lib
.Then perform Fiji update site steps. A description of how to work with update sites can be found here.
If you do not have a c compiler installed you may want to just build the java part of the plugin.
We recommend searching the ImageSC Forum for more information. Please ask questions on the forum if previous discussions are unclear.