EOS Contracts Nube Troubleshooting Tech Note #2: a fix for compiling the EOSIO 1.1.4 hello Contract Tutorial

in #eos6 years ago

Preample

I'm going to share the solutions to the bumps in the road I hit as I come up to speed on writing EOS Contracts.

This stuff changes really fast, and if you're reading this a few months from now, and this article isn't solving your problems, look for a more recent article that takes into account the most recent changes... also, check my github repo linked below because I likely just updated this same script.

The kludge/solution provided below for compiling/linking was done for EOSIO v1.1.4 (I've got one for v1.0.10 also if you happen to need it.

The Meat

TL;DR: Skip the docker container; it's more headache than it's worth (at least until block.one fixes it or unless you're pretty familiar with docker and can fix it yourself. I may take this on as my next project). Just download and compile the source code, install the executables, as laid out below, and use my script to fix the problems you'll run into: https://github.com/mikefreemen/eos/tree/master/fixBuildFor1.1.4

Well, I got through the eosio.token contract tutorial and moved onto the hello world tutorial. I couldn't compile the contract because of how paths work between the host machine and the docker container. I tried to edit the docker-compose.yml file according to a suggestion by luckyyang, and I tried just working directly in the docker container in a manner kind of related to ntheile's suggestion, but the paths continued to be a problem. I was already considering giving up on the docker-based solution until I had made more progress, so i opted to throw in the towel for the sake of progress. So, I built the source from scratch.

To do that, you clone the github eos repo, cd into the eos folder that creates, and run eosio_build.sh. Then you do a set of push-ups or get a coffee or whatever you do when you have a while to wait for a build.

When the build was done, I ran the tests provided at the end of the build. Then I did the sudo make install in the build folder.

But when I tried to compile the hello contract, I still had compilation issues.

Turns out that the eosiocpp tool is looking for header files, and they're not where it expects.

So I wrote up some instructions and write a script for moving around files so that what the compiler and linker expect are where they expect them.

And now I'm back in action. Given the time I've put into this and the number of places online I've seen people asking this same question, I hope this saves you some time.

Solution is in my repo at https://github.com/mikefreemen/eos/tree/master/fixBuildFor1.1.4

Go EOS!