-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Newbie problem building chat example as standalone #307
Comments
I think I'm starting to understand what's going on: reading the Makefile, That causes all of the go import paths in the So in order to use |
If you want to build go get -d github.com/libp2p/go-libp2p
wget https://raw.githubusercontent.com/libp2p/go-libp2p/master/examples/chat/chat.go
go build chat.go This should build it without any problem. |
@futurechimp you are right, you have to use |
@upperwal I get the same errors as previously:
As a guess, that looks like possible version drift between the example code and whatever version @florianlenz cool, thanks for the confirmation, I think it's starting to make more sense now. If a PR to the README would help, I am very happy to do that, explaining that to use libp2p in your own code you need to:
Alternately, if the fix is to somehow get things to Just Work in code using |
@futurechimp I see. It looks like that. I don't know if
Although Apart from this if you happen to use If you are using |
Ah, strange. I had actually deleted nearly everything in
^^ that worked. I don't currently understand how, as I deleted everything in |
Just a guess. With this all the outdated libraries are also gone. So when you did plus you also did
which I guess is empty at first. So again |
At that point, the dependencies were still broken I think, that's what was confusing. I'm not sure which combination of mistakes I was making caused that though. Incorporating the In order to get going and try to write some code, I've committed a bit of a sin against dependency management for the moment. This is the minimal list of libs to temporarily ignore in order to get a
Thanks for your help @upperwal, it's really helpful when getting into a new library for the first time! |
👍 |
I've had some problems getting the libp2p
chat
example running. I'm going to document things here so that if others have the same problems there's maybe a pointer to help them.If anybody can let me know how to get around the problems I'm having in a less hacky way, I promise a PR to the docs if that will help :).
First, I installed as per the instructions in the project README:
I was able to easily build the chat example from within its place in the libp2p project:
This worked happily as advertised.
Next step: copy it verbatim into a separate directory in a new project and get it working on its own, so I could start to modify it for my own purposes.
Initially I had a few
gx
related problems:As noted by people in IRC this was caused by PATH problems. I had some conflicting entries in
~/.bashrc
and~/.bash_profile
. Check your PATH closely if you get errors like this.Once those were fixed, a new error appeared:
It appears to me that whatever version of
"github.com/libp2p/go-libp2p-net"
(and others) needed by the example is not being found bygo build
.I have gotten the build to work by applying a suggestion I saw in another ticket:
gx-go rewrite
. This didn't work at first, but I reasoned that the working example code in the main project must be getting version information from somewhere inside thelibp2p
codebase.I copied
go-libp2p
'spackage.json
into my new project, rangx-go rewrite
again, and it converted most "normal"go
paths togx
paths, allowing the example code to build without errors.The final set of imports that worked are:
Is this
gx-go rewrite
trick the normal way to do things when you want to write your own project incorporating libp2p? If so, I'm happy to discuss a bit to clarify and then offer a PR for it.The text was updated successfully, but these errors were encountered: