Giter VIP home page Giter VIP logo

Comments (12)

Mereep avatar Mereep commented on July 23, 2024 1

So I'd replace "MingW + WSL2 + Debian" in your setup with "WSL1 + Ubuntu" and it should all work. Want to give it a try?

Actually I am a bit afraid to break my other stuffs when switching to WSL 1 (have some more containers running for mobile APP development).

However, you made me try the "within-WSL"-way from where I left off last time, and found some fix which actually let me progress further with my build docker-attempt from inside WSL 2 (https://github.com/docker/compose/issues/7495#issuecomment-643120005) which - without the mentioned fix - crashed like that:

:/mnt/c/Go/src/github.com/hyperledger/fabric$ make docker
Building Docker image hyperledger/fabric-baseos
docker build --force-rm  -f images/baseos/Dockerfile \
        --build-arg GO_VER=1.14.12 \
        --build-arg ALPINE_VER=3.12 \
         \
        -t hyperledger/fabric-baseos ./images/baseos
[+] Building 0.9s (3/3) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.1s
 => => transferring dockerfile: 328B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 2B                                                                                    0.0s
 => ERROR [internal] load metadata for docker.io/library/alpine:3.12                                               0.7s
------
 > [internal] load metadata for docker.io/library/alpine:3.12:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exec: "docker-credential-desktop.exe": executable file not found in $PATH, out: ``
make: *** [Makefile:241: build/images/baseos/.dummy-amd64-2.2.2-snapshot-bebb75fd1] Error 1

Well, I got another error later (which was happening due to executing the make docker step from within my previously created Windows Go intallation directory). So I redid all the steps before (setting up paths, rechecking out everything in the linux home). I then could compile the fabric tools aswell as the fabric-(ca) docker images.

So it seems I can run the stuff up until the point where I left off of Windows now

:~/go/src/trade-network/bash$ ../../github.com/hyperledger/fabric/build/bin/cryptogen generate --config=./crypto-config.yaml
exporterorg.trade.com
importerorg.trade.com
carrierorg.trade.com
regulatororg.trade.com

I will try following the book from there again. I will report back if I run into the next problems (or if I succeed). Thanks so far :)

from trade-network.

Mereep avatar Mereep commented on July 23, 2024 1

Sure, thanks so far :)

from trade-network.

VRamakrishna avatar VRamakrishna commented on July 23, 2024

When you say "point 2", what instruction are you referring to? It is in one of the READMEs or is it in the book? The fabric folder is a clone of the Hyperledger Fabric github project, which you can clone to your machine. Is that cloning step not mentioned in the instructions?

from trade-network.

Mereep avatar Mereep commented on July 23, 2024

I mean the book (Position Preparing the network). I think I cloned it as written?

That's where I am right now:

C:\Go\src\github.com\hyperledger>git remote show origin
* remote origin
  Fetch URL: https://github.com/hyperledger/fabric.git
  Push  URL: https://github.com/hyperledger/fabric.git

C:\Go\src\github.com\hyperledger>mingw32-make.exe docker
Der Befehl "cut" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
"Building Docker image hyperledger/fabric-baseos"
"build/images/baseos - docker build --force-rm "
Syntaxfehler.
mingw32-make.exe: *** [Makefile:226: build/images/baseos/.dummy-amd64-2.2.2-snapshot-1de0825e7] Error 1

Yes, I also tried to install Linux Essentials (e.g., the missing `cutยด) but it will just fire the next errors.

from trade-network.

VRamakrishna avatar VRamakrishna commented on July 23, 2024

Page 128 of the book begins with: (These shell scripts were tested on Ubuntu Linux and macOS Catalina and small
modifications may be required for other distributions, a task that is left to the users.)

We haven't run the steps natively on Windows, though as long as you have the right tools (git, make, docker, etc.) installed and the environment variables set appropriately, it should all work. I did test out everything on a Ubuntu Vagrant VM (VirtualBox on Windows) though, so if you are in a position to do that, the instructions should work off the bat.

That said, it looks like your cloning was messed up in some way. Even in Windows, when you run the command git clone https://github.com/hyperledger/fabric.git -b release-2.2, it ought to create a folder named fabric in your current working directory and when you cd into it, you should see the source code and be able to build images using make docker. Did you instead try to clone straight to the hyperledger folder, which is what it looks like from your git remote.... command above? I'd recommend re-running the clone command exactly as is in the book.

from trade-network.

Mereep avatar Mereep commented on July 23, 2024

I redid the step and made sure it's cloned exactly into the fabric directory under hyperledger. It didn't change a thing. It still throws syntax errors. All dependencies are installed (as stated I can launch Hyperledger nodes from within VS Code).

C:\Go\src\github.com\hyperledger\fabric>make docker
Der Befehl "cut" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
"Building Docker image hyperledger/fabric-baseos"
Syntaxfehler.
make: *** [Makefile:225: build/images/baseos/.dummy-amd64-2.2.2-snapshot-bebb75fd1] Error 1

C:\Go\src\github.com\hyperledger\fabric>

Also the same using mingw

C:\Go\src\github.com\hyperledger\fabric>mingw32-make.exe docker
Der Befehl "cut" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
"Building Docker image hyperledger/fabric-baseos"
Syntaxfehler.
mingw32-make.exe: *** [Makefile:225: build/images/baseos/.dummy-amd64-2.2.2-snapshot-bebb75fd1] Error 1

I also installed coreutils in order to make cut available which then asked for libintl3.dll which I made available by installing gnuwin using chocolatey. After all of that I still get thrown the following:

C:\Go\src\github.com\hyperledger\fabric>make docker
cut: Trenner muss ein einzelnes Zeichen sein
"cut --help" gibt weitere Informationen.
"Building Docker image hyperledger/fabric-baseos"
Syntaxfehler.
make: *** [Makefile:225: build/images/baseos/.dummy-amd64-2.2.2-snapshot-bebb75fd1] Error 1

Complaining for a specific cut-call argument error (literally saying that the separator has to be a single character). I am just stuck here.

I did test out everything on a Ubuntu Vagrant VM (VirtualBox on Windows) though, so if you are in a position to do that, the instructions should work off the bat.

That does not work for me (and many others) since there is a problem with docker and virtualbox (or vmware for that matter): It's kinda a XOR-situation there: You cannot have Docker and virtualbox/vmware at the same time. This is due to HyperV which has to be either turned on (Docker) or off (Virtualbox).

from trade-network.

VRamakrishna avatar VRamakrishna commented on July 23, 2024

I'm not sure the Makefile in fabric is equipped for installing on Windows. I'd suggest visiting the Fabric chat sites to inquire about this; you can start on this channel: https://chat.hyperledger.org/channel/fabric. If you wish, you can visit the JIRA page to find out if others have faced a similar issue, or to report a bug (but I'd first try the chat option and see if someone there can help you): https://jira.hyperledger.org/projects/FAB/issues.

I can't really help you here as I haven't tried installing and running this natively on Windows. Also, for the reason you stated above, I can't install HyperV on my PC because I'm too dependent on VirtualBox myself. And as we mentioned in the book, the instructions we provide were only tested on Ubuntu Linux and macOS Catalina; we just didn't have the bandwidth (or resources at the time) to test on other platforms.
I'm willing to try a Windows installation sometime (need to set up a computer first), but it'll be on a best effort basis, so I can't promise when I'll have anything for you. (Sorry, but I'm already busy with a full time job.)


Alternatively, and strictly speaking, you don't need to build and install Fabric from source. Those instructions were provided as a suggestion. To run the network nodes, you need docker images for the various components (peer, orderer, etc.) on your system tagged with the right labels as expected by our scripts. It's just that if you successfully build from source, you'll have those images built and ready. But you can as well download the same images from docker hub. In fact, this will happen automatically when you run the shell scripts within trade-network; if docker-compose can't find images on your system, it'll attempt to pull them from the hub.

So you can skip the fabric source building and move on to the next steps. But, you may still face some issues. The scripts in trade-network, at least in the bash folder were tested on bash in Ubuntu. We don't have Windows batch file equivalents. But I'd encourage you to at least try and report back. I'll help the best I can.

from trade-network.

Mereep avatar Mereep commented on July 23, 2024

Thanks for your time end effort and my respects for building such a project in your spare time. Imagine this being a really big burden.

Progress: I tried to dig a bit into the problem with the failing make files. Fundamentally there seems to be one concrete error which makes all commands fail under windows: You will always find patterns like @mkdir -p $(@D). -p is not valid for Windows (this literally creates a directory named -p). Quick fix here is using @mkdir "$(@D)" | true instead (windows always creates recursive; the | true is to have make resuming even when the dir is already there).

I will try today to make it work. If I find more I will update this post.

I also ordered a Mac for hopefully not running into the trouble when I have it. My employee wants Blockchain; fast. Many dependent components. Until September I need sth working.

Edit: Small Update:
I tried a bit, but the path mkdir stuff is not the only thing which can only work in unix. Also lines like GOBIN=$(abspath $(@D)) go install -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F)) cannot work under Windows. It is hust no valid syntax to inject some environment into a program like that. MakeFiles seem to have their own syntax for that (export)

However I made that also go away with sth like this in the header:

ifeq ($(OS),Windows_NT)
	detected_os = "windows"
	export GOBIN=$(abspath $(@D))
else
	detected_os = $(shell uname)
endif

and appropriate

$(BUILD_DIR)/bin/%:
		@echo "Building $@"
ifeq ($(detected_os), "windows")
		@mkdir "$(@D)" | true
		go install -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))
else
		@mkdir -p $(@D)
		GOBIN=$(abspath $(@D)) go install -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))

endif

(we are at configtxgen) but this does just crash on the next error:

go install -tags "" -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=2.2.2 -X github.com/hyperledger/fabric/common/metadata.CommitSHA=bebb75fd1 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger" github.com/hyperledger/fabric/cmd/configtxgen
# github.com/DataDog/zstd
cgo: exec C:\Program: exec: "C:\\Program": file does not exist

which looks like some path wants to go to Program Files but cannot due to someone forgetting to put " around something. I don't know where this is spilled out from, though. I think fixing the Makefiles just doesn't work when people insist on writing unix-only Makes relying on unix-only syntax. Even though Make seems to come with syntax just doing the same. Since I never wrote a Makefile, I am not sure if it is a good invest trying to fix everything that comes still there.

To sum up: I think, I will try the Docker-Hub way :)

from trade-network.

VRamakrishna avatar VRamakrishna commented on July 23, 2024

@Mereep I got a Windows setup working and was able to run the full stack (from app in VSCode down to contracts in docker containers).

Catch is I'm using WSL Ubuntu rather than Cygwin (which is what you are using for your shell, right?) I have a Windows 10 Pro machine with Hyper-V enabled. I installed Docker Desktop and am running the Docker engine in Windows. I'm also running VSCode in Windows and launching apps from the IDE. In WSL Ubuntu (version is set to 1 as the Docker engine was crashing with WSL 2), I'm doing everything else: cloning and building Fabric, cloning and running scripts in trade-network.

If this setup works for you, I can provide more detailed instructions.

from trade-network.

Mereep avatar Mereep commented on July 23, 2024

Hi, thanks for the response :-)

Catch is I'm using WSL Ubuntu rather than Cygwin

My setup was actually MingW + WSL 2 + Debian + HyperV enabled (for docker).

My VS Code installation can run the example node from within the IDE properly with this setting. But at this point I don't know how applicable this would be for the trade-network, since in the book there are several commands / build steps involving the custom script.

I also found the pre-compiled binaries for the machine (e.g., configtxgen) which I could successfully use for executing the first steps manually (i.e., creating those channel artifacts for the organisations). However, I stopped at that point, since I felt I will run into many more trouble when doing all the steps manually. The configuration seemed pretty intense at this moment to a level I only partially knew what I am doing, hence not being able to fix random errors. If all this stuff is achievable from within the IDE that would be a great win (also for non-windows users I suppose ;-).

Since I made my university now buy me a Mac machine, I delayed that stuff at this point until I receive it and play a bit with HL Besu meanwhile, which I could build on my machine (it's java-based).

from trade-network.

VRamakrishna avatar VRamakrishna commented on July 23, 2024

But at this point I don't know how applicable this would be for the trade-network, since you in the book there are commands from your custom scripts involved.

As long as you run these scripts in a WSL Ubuntu bash shell, everything will work as expected (I verified this). You can download precompiled configtxgen, etc., binaries if you want but you can also follow instructions in the book to build Fabric docker images from source (also the other prerequisites like the APT packages and Golang).

So I'd replace "MingW + WSL2 + Debian" in your setup with "WSL1 + Ubuntu" and it should all work. Want to give it a try?

from trade-network.

VRamakrishna avatar VRamakrishna commented on July 23, 2024

@Mereep Can we close this issue? If you face other issues or need help, you can open another one in the future.

from trade-network.

Related Issues (13)

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.