|
| 1 | +# Troubleshooting guide for bundling issues in Splice |
| 2 | + |
| 3 | +This guide outlines steps to resolve common issues that a contributor might encounter during Splice's bundling process. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Install **`nix`**, **`direnv`**, and **`sbt`** as per [DEVELOPMENT.md](./DEVELOPMENT.md) |
| 8 | +- Ensure access to JFrog Artifactory (`splice-developers` team). Contact your team lead if access is denied. |
| 9 | + |
| 10 | +## Steps |
| 11 | + |
| 12 | +### 1. Setup Environment |
| 13 | + |
| 14 | +- Clone the repository: `git clone https://github.com/hyperledger-labs/splice.git`. |
| 15 | +- Navigate to the project directory: `cd splice`. |
| 16 | +- Enable **`direnv`** to load environment variables (e.g., `DAML_COMPILER_VERSION`): |
| 17 | + |
| 18 | + ```bash |
| 19 | + direnv allow |
| 20 | + ``` |
| 21 | + |
| 22 | +- Verify: `echo $DAML_COMPILER_VERSION` should match the value in [daml-compiler-sources.json](./nix/daml-compiler-sources.json). |
| 23 | + |
| 24 | +### 2. Clean Build Artifacts |
| 25 | + |
| 26 | +- Remove stale artifacts to fix deduplication errors: |
| 27 | + |
| 28 | + ```bash |
| 29 | + make clean-all |
| 30 | + ``` |
| 31 | + |
| 32 | +- The following commands can also be ran alternatively: `sbt clean; sbt cleanCnDars` |
| 33 | + |
| 34 | +### 3. Unset custom DAML SDK version |
| 35 | + |
| 36 | +- Prevent version conflicts by disposing manual overrides in **`$DAML_SDK_VERSION`** |
| 37 | + |
| 38 | + ```bash |
| 39 | + unset DAML_SDK_VERSION |
| 40 | + ``` |
| 41 | + |
| 42 | +- Verify in SBT: |
| 43 | + |
| 44 | + ```bash |
| 45 | + sbt |
| 46 | + ``` |
| 47 | + |
| 48 | +- Wait for the SBT server to start, then: |
| 49 | + |
| 50 | + ```bash |
| 51 | + eval sys.env.foreach(println(_)) |
| 52 | + ``` |
| 53 | + |
| 54 | + Ensure **`DAML_SDK_VERSION`** is absent or matches the value in `daml.yaml`. |
| 55 | + |
| 56 | +### 4. Bundle |
| 57 | + |
| 58 | +- Execute in a **`direnv`**-enabled terminal: |
| 59 | + |
| 60 | + ```bash |
| 61 | + sbt bundle |
| 62 | + ``` |
| 63 | + |
| 64 | +- If deduplication errors persist, repeat step 2. |
| 65 | + |
| 66 | +### 5. Handle Sphinx Errors (if encountered) |
| 67 | + |
| 68 | +If you see **`Environment variable VERSION must be set`** or **`locale.Error: unsupported locale setting`** from **`sphinx-build`**, these may occur during documentation generation. To troubleshoot: |
| 69 | + |
| 70 | +- Set the **`VERSION`** environment variable to match the `-D version` value (e.g., `0.4.0`): |
| 71 | + |
| 72 | + ```bash |
| 73 | + export VERSION=0.4.0 |
| 74 | + ``` |
| 75 | + |
| 76 | +- Set a valid locale to resolve **`unsupported locale setting`** errors (common on macOS): |
| 77 | + |
| 78 | + ```bash |
| 79 | + export LC_ALL=en_US.UTF-8 |
| 80 | + export LANG=en_US.UTF-8 |
| 81 | + ``` |
| 82 | + |
| 83 | +- Run the **`sphinx-build`** command manually to verify: |
| 84 | + |
| 85 | + ```bash |
| 86 | + sphinx-build -M html ./docs/src ./docs/html -D version=0.4.0 -W |
| 87 | + ``` |
| 88 | + |
| 89 | +- Check the output in `./docs/html` to confirm documentation generation. |
| 90 | +- If the error persists, ensure you are in the **`nix`** shell environment (`direnv allow`) and verify the Python/Sphinx version matches `nix/shell.nix` (e.g., `python3.12-sphinx-7.4.7`). |
| 91 | + |
| 92 | +> Note: The Sphinx error may not block the core sbt bundle process, so you can proceed unless other critical errors arise. |
| 93 | + |
| 94 | +### 6. Start Canton for testing |
| 95 | + |
| 96 | +- After a successful **`sbt bundle`**, start the Canton instance for testing: |
| 97 | + |
| 98 | + ```bash |
| 99 | + ./scripts/start-canton.sh |
| 100 | + ``` |
| 101 | + |
| 102 | +- If you encounter a **`java.net.BindException: Address already in use`** error: |
| 103 | + - Check for processes using port `5000` |
| 104 | + |
| 105 | + ```bash |
| 106 | + lsof -i :5000 |
| 107 | + ``` |
| 108 | + |
| 109 | + - On **macOS**, disable `AirPlay Receiver` in `System Settings > General > AirDrop & Handoff`, as it may occupy port **`5000`**. Refer to the screenshot below for guidance (**macOS 13 Ventura** and newer). |
| 110 | + |
| 111 | +  |
| 112 | + |
| 113 | + - An alternative option is to modify **`apps/app/src/test/resources/simple-topology-canton.conf`** and set a different port for the monitoring service (e.g., `port = 5001`). |
| 114 | + |
| 115 | + ```yaml |
| 116 | + canton.monitoring { |
| 117 | + metrics { |
| 118 | + jvm-metrics.enabled = true |
| 119 | + reporters = [{ |
| 120 | + type = prometheus |
| 121 | + address = "0.0.0.0" |
| 122 | + port = 5001 |
| 123 | + }] |
| 124 | + } |
| 125 | + } |
| 126 | + ``` |
| 127 | + |
| 128 | + - Stop any running Canton instances: |
| 129 | + |
| 130 | + ```bash |
| 131 | + ./scripts/stop-canton.sh |
| 132 | + ``` |
| 133 | + |
| 134 | + - Verify no residual Canton processes are running: |
| 135 | + |
| 136 | + ```bash |
| 137 | + ./scripts/list-background-processes.sh |
| 138 | + ``` |
| 139 | + |
| 140 | + - If Canton processes persist, kill them manually: |
| 141 | + |
| 142 | + ```bash |
| 143 | + kill <PID> |
| 144 | + ``` |
| 145 | + |
| 146 | +- Verify successful startup: |
| 147 | + - Check the **`tmux`** session for Canton output: |
| 148 | + |
| 149 | + ```bash |
| 150 | + tmux attach |
| 151 | + ``` |
| 152 | + |
| 153 | + - Look for logs in log/canton.out or log/canton-simtime.out to confirm the Canton instance is running. |
| 154 | + - Ensure the Canton instance starts without errors (e.g., no port conflicts). |
| 155 | + |
| 156 | +### Additional notes |
| 157 | + |
| 158 | +- Always run SBT commands from a terminal with `direnv` enabled to ensure the `nix` environment is correctly set up. |
| 159 | +- If JFrog access issues persist, confirm with your team lead that all necessary team members have been added to the `splice-developers` group. |
| 160 | +- For persistent issues, consult the Splice repository’s documentation or raise an issue in the repository for further assistance. |
0 commit comments