Code Monkey home page Code Monkey logo

Comments (17)

blagoev avatar blagoev commented on June 9, 2024

Hi,
thanks for reporting. This seems an oversight on our side. As a workaround you can just install a newer version of cmake.

Thanks

from realm-dart.

malaak-habashy avatar malaak-habashy commented on June 9, 2024

I'm getting the same error

Ubuntu 22.04.3 LTS (64-bit)
Flutter 3.13.2
Dart SDK version: 3.1.0

I updated cMake to:
cmake version 3.27.4

still getting the same error

CMake Error at flutter/ephemeral/.plugin_symlinks/realm/linux/CMakeLists.txt:38 (file):
file does not recognize sub-command REAL_PATH
Could not find file realm
Exception: Unable to generate build files

from realm-dart.

malaak-habashy avatar malaak-habashy commented on June 9, 2024

realm version: 1.2.0
works

realm versions: 1.3.0 and 1.4.0
don't work

from realm-dart.

thiagokisaki avatar thiagokisaki commented on June 9, 2024

I was able to fix it by adjusting the CMakeLists.txt.

To solve

file does not recognize sub-command REAL_PATH

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

Could not find file `realm`
Could not find file `realm`

I provided WORKING_DIRECTORY option to execute_process with a new declared variable:

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}")

from realm-dart.

blagoev avatar blagoev commented on June 9, 2024

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?

from realm-dart.

thiagokisaki avatar thiagokisaki commented on June 9, 2024

I can't update the CMake version because I installed Flutter using snap.

from realm-dart.

blagoev avatar blagoev commented on June 9, 2024

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.

from realm-dart.

thiagokisaki avatar thiagokisaki commented on June 9, 2024

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).

from realm-dart.

blagoev avatar blagoev commented on June 9, 2024

great. and thanks for reporting.

from realm-dart.

thiagokisaki avatar thiagokisaki commented on June 9, 2024

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.

It looks like Flutter installation with snap comes with a fixed CMake version and that can't be upgraded.
flutter/flutter#100183 (comment)

I installed a new CMake version:

cmake --version

Output:

cmake version 3.22.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

But flutter doctor -v still shows:

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

from realm-dart.

blagoev avatar blagoev commented on June 9, 2024

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.

from realm-dart.

Tembocs avatar Tembocs commented on June 9, 2024

@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.

from realm-dart.

cmedamine avatar cmedamine commented on June 9, 2024

is there any fix for this issue?

from realm-dart.

nirinchev avatar nirinchev commented on June 9, 2024

There's no fix, but there's a workaround suggested in this comment: #1381 (comment)

from realm-dart.

Tembocs avatar Tembocs commented on June 9, 2024

In case the context is lost here is the output from trying again.

flutter run -d linux
Launching lib/main.dart on Linux in debug mode...
Could not find file 'realm'
Could not find file 'realm'
CMake Error at cmake_install.cmake:124 (file):
  file INSTALL cannot find
  "~/<projectroot>/linux/flutter/ephemeral/.plugin_symlinks/realm/linux/binary/linux/librealm_dart.so":
  No such file or directory.


Building Linux application...
Exception: Build process failed

I can confirm again that the issue still persists.

  • Ubuntu 23.10
  • Flutter 3.16.5
  • CMake 3.27.4
  • Realm 1.6.1

The same app builds fine on Windows 11.

from realm-dart.

Tembocs avatar Tembocs commented on June 9, 2024

@blagoev any updates on this issue?

from realm-dart.

nirinchev avatar nirinchev commented on June 9, 2024

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.

from realm-dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.