New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter app not building on Linux. CMake Error at flutter/ephemeral/.plugin_symlinks/realm/linux/CMakeLists.txt:38 (file): file does not recognize sub-command REAL_PATH #1381
Comments
Hi, Thanks |
I'm getting the same error Ubuntu 22.04.3 LTS (64-bit) I updated cMake to: still getting the same error CMake Error at flutter/ephemeral/.plugin_symlinks/realm/linux/CMakeLists.txt:38 (file): |
realm version: 1.2.0 realm versions: 1.3.0 and 1.4.0 |
I was able to fix it by adjusting the To solve
Replace the line file(REAL_PATH ${APP_PUBSPEC_FILE} ABSOLUTE_PATH_APP_PUBSPEC_FILE) with: get_filename_component(ABSOLUTE_PATH_APP_PUBSPEC_FILE ${APP_PUBSPEC_FILE} REALPATH) To solve
I provided get_filename_component(ABSOLUTE_PATH_APP_DIR ${APP_DIR} REALPATH) execute_process(COMMAND "${FLUTTER_ROOT}/bin/dart" "run" "realm" "install" "--target-os-type" "linux" "--flavor" "flutter" #"--debug"
WORKING_DIRECTORY ${ABSOLUTE_PATH_APP_DIR}
OUTPUT_VARIABLE output
RESULT_VARIABLE result
# COMMAND_ERROR_IS_FATAL ANY
) execute_process(
COMMAND "${FLUTTER_ROOT}/bin/dart" "run" "realm" "metrics" "--verbose" "--flutter-root" "${FLUTTER_ROOT}/bin" "--target-os-type" "linux" "--target-os-version" "${CMAKE_HOST_SYSTEM_VERSION}" #"--pause-isolates-on-start" "--enable-vm-service"
# COMMAND ${CMAKE_COMMAND} -E true
WORKING_DIRECTORY ${ABSOLUTE_PATH_APP_DIR}
OUTPUT_VARIABLE output
RESULT_VARIABLE result
# COMMAND_ERROR_IS_FATAL LAST
) After all the changes, my file looks like this: cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME "realm")
project(${PROJECT_NAME} LANGUAGES CXX)
# This value is used when generating builds using this plugin, so it must
# not be changed.
set(PLUGIN_NAME "realm_plugin")
add_library(${PLUGIN_NAME} SHARED "realm_plugin.cpp")
apply_standard_settings(${PLUGIN_NAME})
set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter)
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
set(realm_bundled_libraries
"${PROJECT_SOURCE_DIR}/binary/linux/librealm_dart.so"
PARENT_SCOPE
)
# message ("CMAKE_BINARY_DIR is ${CMAKE_BINARY_DIR}")
# message ("PROJECT_SOURCE_DIR is ${PROJECT_SOURCE_DIR}")
# message ("CMAKE_CURRENT_SOURCE_DIR is ${CMAKE_CURRENT_SOURCE_DIR}")
# This works cause realm plugin is always accessed through the .plugin_symlinks directory.
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../ephemeral")
include(${EPHEMERAL_DIR}/generated_config.cmake)
set(APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../..")
# message ("APP_DIR is ${APP_DIR}")
get_filename_component(ABSOLUTE_PATH_APP_DIR ${APP_DIR} REALPATH)
# message ("ABSOLUTE_PATH_APP_DIR is ${ABSOLUTE_PATH_APP_DIR}")
set(APP_PUBSPEC_FILE "${APP_DIR}/pubspec.yaml")
# message ("APP_PUBSPEC_FILE is ${APP_PUBSPEC_FILE}")
# file(REAL_PATH ${APP_PUBSPEC_FILE} ABSOLUTE_PATH_APP_PUBSPEC_FILE)
get_filename_component(ABSOLUTE_PATH_APP_PUBSPEC_FILE ${APP_PUBSPEC_FILE} REALPATH)
# message ("ABSOLUTE_PATH_APP_PUBSPEC_FILE is ${ABSOLUTE_PATH_APP_PUBSPEC_FILE}")
file(READ "${ABSOLUTE_PATH_APP_PUBSPEC_FILE}" PUBSPEC_CONTENT)
string(REGEX MATCH "name:[ \r\n\t]*([a-z0-9_]*)" _ ${PUBSPEC_CONTENT})
# message ("Pubspec name 0 is ${CMAKE_MATCH_0}")
# message ("Package name is ${CMAKE_MATCH_1}")
set(BUNDLE_ID ${CMAKE_MATCH_1})
add_definitions(-DAPP_DIR_NAME="${APPLICATION_ID}")
add_definitions(-DBUNDLE_ID="${BUNDLE_ID}")
# message ("FLUTTER_TOOL_ENVIRONMENT is ${FLUTTER_TOOL_ENVIRONMENT}")
# message ("FLUTTER_ROOT is ${FLUTTER_ROOT}")
execute_process(COMMAND "${FLUTTER_ROOT}/bin/dart" "run" "realm" "install" "--target-os-type" "linux" "--flavor" "flutter" #"--debug"
WORKING_DIRECTORY ${ABSOLUTE_PATH_APP_DIR}
OUTPUT_VARIABLE output
RESULT_VARIABLE result
# COMMAND_ERROR_IS_FATAL ANY
)
message(STATUS "cmd output: ${output}")
message(STATUS "cmd result: ${result}")
# message("CMAKE_HOST_SYSTEM_VERSION ${CMAKE_HOST_SYSTEM_VERSION}")
execute_process(
COMMAND "${FLUTTER_ROOT}/bin/dart" "run" "realm" "metrics" "--verbose" "--flutter-root" "${FLUTTER_ROOT}/bin" "--target-os-type" "linux" "--target-os-version" "${CMAKE_HOST_SYSTEM_VERSION}" #"--pause-isolates-on-start" "--enable-vm-service"
# COMMAND ${CMAKE_COMMAND} -E true
WORKING_DIRECTORY ${ABSOLUTE_PATH_APP_DIR}
OUTPUT_VARIABLE output
RESULT_VARIABLE result
# COMMAND_ERROR_IS_FATAL LAST
)
message(STATUS "cmd output: ${output}")
message(STATUS "cmd result: ${result}")
|
If you update cmake to a version 3.19 or newer this should go away. are you sure you are using the newer cmake version on your env? |
I can't update the CMake version because I installed Flutter using snap. |
How is the cmake installed on the machine related to the Flutter install? You should be able to just install cmake on your machine separately. |
After changing the file I was able to make it work with CMake 3.16.3 and the latest realm package version (1.5.0). |
great. and thanks for reporting. |
It looks like Flutter installation with snap comes with a fixed CMake version and that can't be upgraded. I installed a new CMake version:
Output:
But
|
This makes sense now. Unfortunately for now we don't support this version from the snap. As a workaround you can use a version of Flutter that's not from the snap. Luckily this is easily achievable on all platforms. You can just install Flutter from the zip they provide. |
@blagoev I'm Ubuntu 23.04 x64 and my Flutter install is NOT from snap. I have CMake version 3.27.4 and Realm 1.5. I still get the same error message. Flutter version 3.13.5. |
is there any fix for this issue? |
There's no fix, but there's a workaround suggested in this comment: #1381 (comment) |
In case the context is lost here is the output from trying again.
I can confirm again that the issue still persists.
The same app builds fine on Windows 11. |
@blagoev any updates on this issue? |
This issue is closed because the original problem - incorrect cmake version being required is now resolved. The error message you're getting doesn't seem to be related to what this issue is about, so please file a new one. |
What happened?
Flutter application is not building on Linux after installing realm package.
It looks like we're trying to use a sub-command that has added in CMake 3.19 in CMakeLists.txt, while specifying the minimum CMake version as 3.10.
Note:
I installed Flutter using snap,
which comes with CMake 3.16.3.
Repro steps
Create an app:
Install realm:
Try to launch the app:
Output:
Dart: 3.0.6 / Flutter: 3.10.6
What Atlas Services are you using?
Local Database only
What type of application is this?
Flutter Application
Client OS and version
Ubuntu 22.04
Code snippets
No response
Stacktrace of the exception/crash you're getting
No response
Relevant log output
The text was updated successfully, but these errors were encountered: