CesiumGS/cesium-unity

Android build broken on v1.9.0

j9liu opened this issue · 4 comments

Reported on the forum here.

User experiencing problems building for Android with the following circumstances:

  • on cesium-unity-samples project
  • Unity 2023.2.17f
  • Cesium for Unity 1.9.0

Reportedly, this doesn't happen with v1.8.0. They've shared this callstack with us:

An error occurred while building CesiumForUnityNative. See E:\UnityProject\cesium-unity-samples-1.9.0\Packages\com.cesium.unity\native~\build-Android-arm64\build.log for details. The command-line was:
cmake --build “E:\UnityProject\cesium-unity-samples-1.9.0\Packages\com.cesium.unity\native~\build-Android-arm64” --config Debug --parallel 21 --target install
UnityEngine.Debug:LogError (object)
CesiumForUnity.CompileCesiumForUnityNative:RunAndLog (System.Diagnostics.ProcessStartInfo,System.IO.StreamWriter,string) (at ./Packages/com.cesium.unity/Editor/CompileCesiumForUnityNative.cs:512)
CesiumForUnity.CompileCesiumForUnityNative:BuildNativeLibrary (CesiumForUnity.CompileCesiumForUnityNative/LibraryToBuild) (at ./Packages/com.cesium.unity/Editor/CompileCesiumForUnityNative.cs:478)
CesiumForUnity.CompileCesiumForUnityNative:OnPostBuildPlayerScriptDLLs (UnityEditor.Build.Reporting.BuildReport) (at ./Packages/com.cesium.unity/Editor/CompileCesiumForUnityNative.cs:210)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Hub\Editor\2023.2.17f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath “C:\Program Files\Unity\Hub\Editor\2023.2.17f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.6.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “assembleDebug”

To diagnose this, we need to see the log file mentioned in the error message.

Yep. I asked the user for more information before opening the issue. (Just wanted to do so before I forgot.)

They posted the full log here. It looks like this is the offending error:

make[2]: *** No rule to make target ‘extern/cesium-native/extern/draco/CMakeFiles/draco_compression_attributes_pred_schemes_enc.dir/4903a2f1d67bacb7cbad22462a10a95f/prediction_scheme_encoder_factory.cc.o’, needed by ‘extern/cesium-native/extern/draco/libdracod.a’. Stop.

I remember that mid-March, we updated the Draco library in CesiumGS/cesium-native#829. This was probably incorporated into the April Cesium for Unity release.

Notice that same file is mentioned earlier in the log:

CMake Warning in extern/cesium-native/extern/draco/CMakeLists.txt:
The object file directory

E:/UnityProject/cesium-unity-samples-1.9.0/Packages/com.cesium.unity/native~/build-Android-arm64/extern/cesium-native/extern/draco/CMakeFiles/draco_compression_attributes_pred_schemes_enc.dir/
has 192 characters. The maximum full path to an object file is 250
characters (see CMAKE_OBJECT_PATH_MAX). Object file

4903a2f1d67bacb7cbad22462a10a95f/prediction_scheme_encoder_factory.cc.o
cannot be safely placed under this directory. The build may not work
correctly.

It's possible this user doesn't have long paths enabled. This is mentioned as a requirement in the prerequisites section of the developer setup instructions:
https://github.com/CesiumGS/cesium-unity/blob/main/Documentation~/developer-setup.md

It's also possible that long paths are enabled, but the path is too long anyway (even when Windows has no path limit, some tools do). Moving the project to E:\a or similar is a good way to exclude that possibility.

Turned out it was the long paths issue, thanks @kring !