使用Djinni开发Hello-World时卡在构建环节,求问题原因及排查方向
Hey there! As someone who’s fumbled through Djinni’s setup as a beginner, I know exactly how frustrating this stuck build can be. Let’s break down the likely issues and get your test running smoothly:
1. You Likely Forgot to Pull Git Submodules
Most Djinni-related repos use Git submodules to include the core Djinni tooling. When you fork the repo, these submodules don’t download automatically. Run this command in your repo root first to grab all missing dependencies:
git submodule update --init --recursive
This ensures you have the full Djinni source code locally, so the build doesn’t waste time scrambling to fetch missing components.
2. SBT 0.13.5 Download Is Stalling (Common with Old Versions)
The stuck "Getting org.scala-sbt sbt 0.13.5..." message is almost always a network issue—this older SBT version is glacial to fetch from default sources. Fix this by adding a faster mirror:
- Create or edit the file
~/.sbt/repositories(Linux/macOS) orC:\Users\<YourName>\.sbt\repositories(Windows) - Paste this config to use a faster mirror (adjust if needed for your region):
[repositories] local aliyun: http://maven.aliyun.com/nexus/content/groups/public/ typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly sonatype-oss-releases maven-central sonatype-oss-snapshots
Save the file, kill the stuck process, and re-run your command. The download should finish in seconds instead of hanging indefinitely.
3. Your Run Command Has a Typo
Looking at your command, there’s a clear typo: --va-package isn’t a valid Djinni parameter. You meant --java-package to specify your Java package name. Also, it’s smarter to output generated code into dedicated folders (instead of the root) to keep things organized. Here’s the corrected command:
src/run --java-out ./generated/java --java-package com.faze.ch.rt --cpp-out ./generated/cpp --jni-out ./generated/jni --idl hello-world.djinni
Just make sure the generated folder exists (or let the command create it if your system allows).
4. Pre-Build Djinni First (Optional but More Reliable)
If you want to avoid build delays during the run command, manually build Djinni first to get that step out of the way:
cd src sbt compile
Once that completes successfully, head back to the repo root and run the corrected src/run command above.
After fixing these steps, you should see your multi-language code (Java, C++, JNI) pop up in the specified output folders in no time!
内容的提问来源于stack exchange,提问作者Paul Alto

