Realm Flutter SDK: CMake Error at flutter/ephemeral/.plugin_symlinks/realm/linux/CMakeLists.txt:37

I’m trying to compile a Flutter app using Realm Flutter SDK. I’ve set a schema and generated the code successful. Compiling the Flutter application on Linux (Ubuntu 22.04) gives this error message from CMake.
CMake Error at flutter/ephemeral/.plugin_symlinks/realm/linux/CMakeLists.txt:37

I’ve tried to compile the same app on Windows without any problem. The CMake code that gives the error message is this:

execute_process(COMMAND "${FLUTTER_ROOT}/bin/flutter" "pub" "run" "realm" "install" "--target-os-type" "linux" "--package-name" "realm" #"--debug"
  OUTPUT_VARIABLE output
  RESULT_VARIABLE result
  COMMAND_ERROR_IS_FATAL ANY
)

Any help please.

The complete error message is:

flutter run -d linux
Launching lib/main.dart on Linux in debug mode...
pub finished with exit code 64
CMake Error at flutter/ephemeral/.plugin_symlinks/realm/linux/CMakeLists.txt:37 (execute_process):
  execute_process failed command indexes:

    1: "Child return code: 64"


Building Linux application...                                           
Exception: Unable to generate build files

Hi,
Could you check these versions and write back what they are

  • Cmake version
  • Flutter version
  • realm package version

Also could you run flutter run -d linux --verbose
and get the output of the Realm Install command from the flutter build output. Search for realm install or something related to the error in the build output.

During the build process Realm tries to install the realm binaries so the project can compile correctly with the correct realm native binaries. It seems this install command fails on your env.

@Lyubomir_Blagoev
CMake version: 3.22.1,
Flutter version: 3.0.3
Realm package version: realm: ^0.2.1+alpha (from Flutter project’s pubspec.yaml).

@Lyubomir_Blagoev
I could not find realm install so I’m posting the whole output here.

❯ flutter run -d linux --verbose
[  +85 ms] executing: uname -m
[  +43 ms] Exit code 0 from: uname -m
[        ] x86_64
[  +10 ms] executing: [/<hidden-path>/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +11 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 676cefaaff197f27424942307668886253e1ec35
[        ] executing: [/<hidden-path>/flutter/] git tag --points-at 676cefaaff197f27424942307668886253e1ec35
[  +17 ms] Exit code 0 from: git tag --points-at 676cefaaff197f27424942307668886253e1ec35
[        ] 3.0.3
[  +12 ms] executing: [/<hidden-path>/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +8 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/<hidden-path>/flutter/] git ls-remote --get-url origin
[  +14 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +149 ms] executing: [/<hidden-path>/flutter/] git rev-parse --abbrev-ref HEAD
[  +17 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +97 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +87 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +107 ms] Skipping pub get: version match.
[ +157 ms] Found plugin path_provider at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.11/
[  +10 ms] Found plugin path_provider_android at
/<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.16/
[   +5 ms] Found plugin path_provider_ios at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.10/
[  +20 ms] Found plugin path_provider_linux at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/
[   +7 ms] Found plugin path_provider_macos at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/
[   +9 ms] Found plugin path_provider_windows at
/<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.7/
[   +9 ms] Found plugin realm at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/realm-0.2.1+alpha/
[ +241 ms] Found plugin path_provider at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.11/
[   +2 ms] Found plugin path_provider_android at
/<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.16/
[   +1 ms] Found plugin path_provider_ios at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.10/
[        ] Found plugin path_provider_linux at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/
[        ] Found plugin path_provider_macos at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/
[   +1 ms] Found plugin path_provider_windows at
/<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.7/
[   +7 ms] Found plugin realm at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/realm-0.2.1+alpha/
[  +92 ms] Generating //dart/myproject/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +176 ms] Initializing file store
[  +18 ms] Skipping target: gen_localizations
[   +7 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents:
//dart/myproject/.dart_tool/package_config_subset,//dart/myproject/.dart_tool/flutter_build/dart_plugin_registrant.da
rt}
[  +58 ms] Found plugin path_provider at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.11/
[   +1 ms] Found plugin path_provider_android at
/<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.16/
[   +1 ms] Found plugin path_provider_ios at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.10/
[        ] Found plugin path_provider_linux at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/
[        ] Found plugin path_provider_macos at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/
[   +1 ms] Found plugin path_provider_windows at
/<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.7/
[   +3 ms] Found plugin realm at /<hidden-path>/flutter/.pub-cache/hosted/pub.dartlang.org/realm-0.2.1+alpha/
[  +31 ms] gen_dart_plugin_registrant: Complete
[   +1 ms] Skipping target: _composite
[   +9 ms] complete
[  +21 ms] Launching lib/main.dart on Linux in debug mode...
[   +8 ms] /<hidden-path>/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/<hidden-path>/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root
/<hidden-path>/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names
--experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill /tmp/flutter_tools.VDLUOD/flutter_tool.VSUVAL/app.dill
--packages //dart/myproject/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill
build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --source
//dart/myproject/.dart_tool/flutter_build/dart_plugin_registrant.dart --source package:flutter/src/dart_plugin_registrant.dart
-Dflutter.dart_plugin_registrant=file:////dart/myproject/.dart_tool/flutter_build/dart_plugin_registrant.dart
--enable-experiment=alternative-invalidation-strategy
[  +36 ms] Building Linux application...
[  +36 ms] <- compile package:myproject/main.dart
[   +2 ms] executing: [build/linux/x64/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DFLUTTER_TARGET_PLATFORM=linux-x64
//dart/myproject/linux
[+4329 ms] pub finished with exit code 64
[ +284 ms] CMake Error at flutter/ephemeral/.plugin_symlinks/realm/linux/CMakeLists.txt:37 (execute_process):
[   +4 ms]   execute_process failed command indexes:
[        ]     1: "Child return code: 64"
[        ] -- Configuring incomplete, errors occurred!
[        ] See also "//dart/myproject/build/linux/x64/debug/CMakeFiles/CMakeOutput.log".
[  +92 ms] Building Linux application... (completed in 4.7s)
[+10285 ms] Exception: Unable to generate build files
[  +17 ms] "flutter run" took 16,271ms.
[   +6 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:699:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:94:3)
           <asynchronous suspension>
           
           
[ +253 ms] ensureAnalyticsSent: 251ms
[   +1 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

Hi,
Could you upgrade realm to the latest version 0.3.1+beta and try again.

@Lyubomir_Blagoev
Upgrading to Realm 0.3.1+beta works. Thank you for your help.