Skip to content
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

Fix FFI example fails to find dependent package test_utils #3894

Closed
igouy opened this issue Mar 11, 2022 · 5 comments · Fixed by #5881
Closed

Fix FFI example fails to find dependent package test_utils #3894

igouy opened this issue Mar 11, 2022 · 5 comments · Fixed by #5881
Assignees
Labels
a.libraries Relating to the Dart standard libraries. dev.interop Relates to use of native code as part of your Dart app e1-hours Can complete in < 8 hours of normal, not dedicated, work fix.bug Needs fix of incorrect copy, code, or visual p2-medium Necessary but not urgent concern. Resolve when possible. st.triage.ltw Indicates Lead Tech Writer has triaged

Comments

@igouy
Copy link

igouy commented Mar 11, 2022

Page URL

https://dart.dev/guides/libraries/c-interop#building-and-running

Page source

No response

Describe the problem

$ dart pub get
Resolving dependencies... 
Because hello_world_ffi depends on test_utils from path which doesn't exist (could
  not find package test_utils at "../test_utils"), version solving failed.

Expected fix

I expect "an example of building the dynamic library and executing the Dart app" to work when followed.

The "hello_world example has the following files" does not mention "../test_utils"

Additional context

No response

@parlough parlough added p2-medium Necessary but not urgent concern. Resolve when possible. docs e1-hours Can complete in < 8 hours of normal, not dedicated, work labels Mar 11, 2022
@parlough
Copy link
Member

Hi @igouy, thanks again for opening an issue.

I'm curious, did you just install the linked files in the instructions? Currently they are meant as more of an example to loosely follow and understand, not necessarily as a template. Therefore for testing purposes, it require files elsewhere in the samples repository.

I'm thinking we can make it clear it, that to test this example, you should start by cloning the samples repository and working on it from there. That way no files are missed and its easier than downloading files one by one. Then adding a comment in the pubspec.yaml that the extra dependency can be removed if it's their own project.

For your purposes, if you don't want to clone the entire samples repository to test it, you can simply remove the extra dependency on test_utils at the bottom of the pubspec.yaml: https://github.com/dart-lang/samples/blob/master/ffi/hello_world/pubspec.yaml#L18-L19

I'll work on those improvements, thanks again!

@igouy
Copy link
Author

igouy commented Mar 13, 2022

I'm curious, did you just install the linked files in the instructions?

Yes I (not ironically) "literally" followed the instructions.

an example to loosely follow

It's hello world! Make it so I can copy and paste stuff into a terminal window and it just works.

@parlough
Copy link
Member

Thanks for clarifying!

I'll see if we can move everything within the directory to avoid the external directory dependency, making it easier to just copy and paste from the sample you want to use.

@atsansone atsansone added a.libraries Relating to the Dart standard libraries. fix.bug Needs fix of incorrect copy, code, or visual st.triage.ltw Indicates Lead Tech Writer has triaged dev.interop Relates to use of native code as part of your Dart app labels Apr 29, 2023
@atsansone
Copy link
Contributor

@johnpryan : This looks like an error with the sample in the pubspec.yaml at line 22. It points to ../test_utils which does not exist in the sample. ../test/ does. If that's the case, could you update it? Thanks!

@atsansone atsansone changed the title could not find package test_utils FFI example fails to find dependent package test_utils Apr 29, 2023
@atsansone atsansone removed the docs label Apr 29, 2023
@johnpryan
Copy link
Contributor

The test_utils package is used for testing the sample. There might be a better way to test the sample without causing confusion.

@johnpryan johnpryan removed their assignment May 3, 2023
@atsansone atsansone changed the title FFI example fails to find dependent package test_utils Fix FFI example fails to find dependent package test_utils May 15, 2024
@atsansone atsansone assigned atsansone and unassigned johnpryan May 23, 2024
atsansone added a commit that referenced this issue May 30, 2024
Fixes #3894
Expands on this issue by updating links to code examples, updating style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a.libraries Relating to the Dart standard libraries. dev.interop Relates to use of native code as part of your Dart app e1-hours Can complete in < 8 hours of normal, not dedicated, work fix.bug Needs fix of incorrect copy, code, or visual p2-medium Necessary but not urgent concern. Resolve when possible. st.triage.ltw Indicates Lead Tech Writer has triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants