Rust
Create a new project with cargo init --bin and add the following to your Cargo.toml file.
See the example code in GitHub.
Rust doesn't prescribe any particular structure for your project's layout on the end user's device filesystem. The following is one recommendation
- AppRoot/AppExecutable - The path of your app's executable. Everything else should be relative to this. The binary component of Ditto may optionally be statically linked into this executable (default).
- AppRoot/libdittoffi.dll - The path to the binary ditto library if using the shared library version. Configure your app's linker to search for the library here (e.g. @executable_path/../libdittoffi.dylib). You will need to copy this shared library from target/<profile>/build/dittolive-ditto-sys<hash>/out when distributing your app.
- AppRoot/ditto_data/ - Base directory for all locally stored Ditto data.
The rust compiler is natively capable of cross-compiling for a wide range of targets. You will need to configure a local .cargo/config.toml file in the root of your project directory to provide the necessary rustc, linker, and potentially C compiler arguments. For most targets you will need to provide an alternative sysroot for your target (not host) platform, often exposing a POSIX C library, header files, binutils, and a linker.
The Ditto SDK build.rs script failed to download an appropriate ditto binary for your target platform. Look at the build script's log at target/<profile>/build/dittolive-ditto-sys-<hash>/stderr for any errors.
Check your internet connection is live and Ditto version number is correct. Inspect the downloaded library in the cargo build cache (default is target/<profile>/build/dittolive-ditto-sys-<hash>/out/libdittoffi.{a,dylib,so,dll}) using your platforms utilties such as file, otool, readelf or similar. Try updating to the latest release of dittolive-ditto. You can also manually download the binary yourself.
- Try updating to a more recent version of dittolive-ditto .
- Manually download the library yourself and verify it completes successfully.
- Force the build script to look for the library in a specific directory by exporting DITTOFFI_SEARCH_PATH during compilation and execution.