-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Cannot import and use a dependency #44
Comments
I have the same error and patching |
in for your use case however it appears, given the edit you made, that what you want is for this line to be removed and this line be changed to say |
Hi @nektro ! I don't understand you first paragraph, because in this case both I will try to describe my actual situation and not an example, maybe it will be more clear !
I edited the zig.mod files of each libraries following your advice of the second paragraph. Here is the zig.mod files of each libraries: # http zig.mod
id: a2vh8na282lel0as4l57ibmjje9oqt2o2fajm5hofpsbqoa8
name: http
main: src/main.zig
license: 0BSD
description: HTTP core types for Zig 🦴
dependencies: # h11 zig.mod
id: 7noqknvqkyyup91axamyzfiet5r41k9apsb9wzbn9ay3l2jc
name: h11
license: 0BSD
description: I/O agnostic HTTP/1.1 implementation for Zig 🦎
root_dependencies:
- src: git https://github.com/ducdetronquito/http branch-release/0.2.0 # requestz zig.mod
id: 86gq5kz04nyy4e7eq2njytvqivd2unre6i965ol3p5gz7cw3
name: requestz
license: 0BSD
description: HTTP client for Zig 🦎
root_dependencies:
- src: git https://github.com/nektro/iguanaTLS commit-d49c382
- src: git https://github.com/MasterQ32/zig-network commit-b9c5282
- src: git https://github.com/ducdetronquito/http branch-release/0.2.0
- src: git https://github.com/ducdetronquito/h11 branch-release/0.2.0 What am I missing ^^ ? Thanks in advance, and have a nice day ! |
After toying a bit, here are the zig.mod files that make each library importable from another library along with its dependencies, and being able to run tests on each library. # http zig.mod
id: a2vh8na282lel0as4l57ibmjje9oqt2o2fajm5hofpsbqoa8
name: http
main: src/main.zig
license: 0BSD
description: HTTP core types for Zig 🦴
dependencies: # h11 zig.mod
id: 7noqknvqkyyup91axamyzfiet5r41k9apsb9wzbn9ay3l2jc
name: h11
license: 0BSD
description: I/O agnostic HTTP/1.1 implementation for Zig 🦎
root_dependencies:
- src: git https://github.com/ducdetronquito/http branch-release/0.2.0
dependencies:
- src: git https://github.com/ducdetronquito/http branch-release/0.2.0 # requestz zig.mod
id: 86gq5kz04nyy4e7eq2njytvqivd2unre6i965ol3p5gz7cw3
name: requestz
license: 0BSD
description: HTTP client for Zig 🦎
root_dependencies:
- src: git https://github.com/nektro/iguanaTLS commit-d49c382
- src: git https://github.com/MasterQ32/zig-network commit-b9c5282
- src: git https://github.com/ducdetronquito/http branch-release/0.2.0
- src: git https://github.com/ducdetronquito/h11 branch-release/0.2.0
dependencies:
- src: git https://github.com/nektro/iguanaTLS commit-d49c382
- src: git https://github.com/MasterQ32/zig-network commit-b9c5282
- src: git https://github.com/ducdetronquito/http branch-release/0.2.0
- src: git https://github.com/ducdetronquito/h11 branch-release/0.2.0 Could you explain me why I must define both |
so since all of the manifests you described are libraries, you want to set then in any testing code you import the package by the name you set in |
Unfortunately, doing that put me into the same situation described in my first comment of this issue: importing a dependency by name crashes when running |
do you have a copy of your build.zig? |
https://github.com/nektro/zig-double this is an example repo that shows off the structure i explained above |
Thanks I will have a look at it :) |
how'd it go? (happy to chat on discord too) |
Hi @nektro Not very far as I have not much time to work on Zig these days... I keep you in touch when I will work on it again ! |
It seems that the use of the term "root_dependencies" is not very intuitive, and its difference with "dependencies" is not clearly described in the documentation :-( My misunderstanding of root_dependencies
Hi @nektro!
It looks like in deps.zig the necessary packages were not added
After manual editing of deps.zig, the build was successful
|
Hi @nektro ,
I think I encountered a bug or it can be just be me misusing zigmod !
Steps to reproduce:
I created a small library zigmod_dep that provide an
add
function.(To create the library, I juste used
zig init-lib
andzigmod init
)I created an other library zigmod_base that uses
zigmod_dep.add
.(To create the library, I juste used
zig init-lib
andzigmod init
)When running the tests of
zigmod_base
, it does not find thezigmod_dep
package and crashes with the following error:To fix the error, and be able to compile I just patched
deps.zig
inzigmod_base
as such:I hope I have clear enough to help you reproduce it :)
The text was updated successfully, but these errors were encountered: