Git Product home page Git Product logo

Comments (14)

cremfert avatar cremfert commented on July 16, 2024

Hint: If I change the code to this:

#execute_process(COMMAND "${DART}" run
#                "${CMAKE_CURRENT_SOURCE_DIR}/../libsodium_version.dart"
#                OUTPUT_VARIABLE LIBSODIUM_VERSION_JSON
#                COMMAND_ERROR_IS_FATAL ANY
#)
set(LIBSODIUM_VERSION_JSON "{\"ffi\":\"1.0.18\",\"js\":\"0.7.9\"}")

(so adding manually the version information), everything works fine! It seems like dart cannot be executed from the CMake file. Any ideas, what the problem could be?

Thanks and best regards!

from libsodium_dart_bindings.

Skycoder42 avatar Skycoder42 commented on July 16, 2024

Huh, that is weird. Is the dart executable available in your PATH? What happens if you run dart --version in the same command prompt as the one where you run the build? However, the check in https://github.com/Skycoder42/libsodium_dart_bindings/blob/main/packages/sodium_libs/windows/CMakeLists.txt#L16 should already fail if dart was not found. Which CMake version are you using?

If thats not it, I am not sure where the problem is. In the CI-Pipeline, the build succeeds. Maybe you could replace the find program check with the following to see what is actually found:

if(DART)
  message("Found dart at: ${DART}")
else()
  message(FATAL_ERROR "Did not find dart in PATH!")
endif()

Also, running flutter build ... --verbose might output something useful, so it's worth a try.

from libsodium_dart_bindings.

cremfert avatar cremfert commented on July 16, 2024

I will check tomorrow - the dart executable is in the PATH, I can call dart --version so this shouldn't be the problem. Looks like the CMAKE process runs in a thread that does not have access to the path.

The error also does not say, that dart isn't available but that dart isn't a valid Win32 application.

I think it could be an issue with Win 11 and Visual Studio 2022 - would it be ok for you to tell me your Windows Version (10?) and the Visual Studio Version you are running? Then I will set up a VM and test it there.

Thanks a lot!

from libsodium_dart_bindings.

Skycoder42 avatar Skycoder42 commented on July 16, 2024

I am using the GitHub Actions CI with the windows-latest image. You can find more information on the image, including OS-Version and more here: https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md

I have not tested it on Windows 11 yet, so that might be the reason. And yes, the error message seems to indicate that cmake fails to pass the correct dart path to the subshell executing the command.

from libsodium_dart_bindings.

cremfert avatar cremfert commented on July 16, 2024

I just changed the code to:
execute_process(COMMAND "c:\\flutter\\bin\\cache\\dart-sdk\\bin\\dart.exe" run
now, it works - it seems like CMake resolve the dart.exe to something else, in my case to "C:\flutter\bin". Maybe I need to change my path then...

from libsodium_dart_bindings.

cremfert avatar cremfert commented on July 16, 2024

I found a fix: if I replace
execute_process(COMMAND "${DART}" run with exec_program("${DART}" run then it works. According to https://cmake.org/cmake/help/v3.0/command/execute_process.html, the execute_process does not spin up a shell and hence doesn't know about all the env variable. Would it be possible for you to test that as well and maybe commit it, if ok?

Thanks a lot!

from libsodium_dart_bindings.

Skycoder42 avatar Skycoder42 commented on July 16, 2024

That is weird. As far as I know, the dart executable is "linked" in the C:\flutter\bin directory (If I remember correctly, as a batch script), so that path should work as well. But maybe the execute_process cannot directly execute a script, that could be an explanation. Does your C:\flutter\bin contain a dart executable/script?

I also looked at the documentation of exec_program, and apparently, it is deprecated and should not be used anymore: https://cmake.org/cmake/help/v3.0/command/exec_program.html#command:exec_program

So I am unsure if I should actually use it. I think, maybe just explicitly using a shell (cmd /c "${DART}") might be enough.

from libsodium_dart_bindings.

cremfert avatar cremfert commented on July 16, 2024

I tried with cmd /c {DART} but it says: "The file cannot be found." :(

from libsodium_dart_bindings.

cremfert avatar cremfert commented on July 16, 2024

Bildschirmfoto 2022-03-29 um 12 21 02

This is my flutter\bin folder. There is only a batch file and a file named "dart" without extension. Maybe thats the linux version.

from libsodium_dart_bindings.

Skycoder42 avatar Skycoder42 commented on July 16, 2024

Okay, so I updated the native flutter parts of the plugin and changed the windows build to use "cmd /c ${dart} ...". The pipeline succeeds, so it seams to at least generally work.

Could you try the build with the lastest main branch? You can simply use a git-dependency in the pubspec for that:

dependencies:
  sodium_libs:
    git:
      url: https://github.com/Skycoder42/libsodium_dart_bindings.git
      path: packages/sodium_libs

from libsodium_dart_bindings.

Skycoder42 avatar Skycoder42 commented on July 16, 2024

So I tried it myself on a Windows 11 Machine with VS 2022 and I can build successfully. Did the changes on the master branch fix your problem?

from libsodium_dart_bindings.

cremfert avatar cremfert commented on July 16, 2024

Sorry for the delay, I'm currently traveling, but will have a look on it next week and give feedback! Thanks a lot for your effort!

from libsodium_dart_bindings.

cremfert avatar cremfert commented on July 16, 2024

Yes, it works - thank you so much for your help and support with this!

from libsodium_dart_bindings.

Skycoder42 avatar Skycoder42 commented on July 16, 2024

perfekt, then I will publish that soon

from libsodium_dart_bindings.

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.