Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Document/Implement Eosio SDK #246

Closed
4 of 5 tasks
nathanielhourt opened this issue Aug 28, 2017 · 10 comments
Closed
4 of 5 tasks

Document/Implement Eosio SDK #246

nathanielhourt opened this issue Aug 28, 2017 · 10 comments

Comments

@nathanielhourt
Copy link
Contributor

nathanielhourt commented Aug 28, 2017

Goal:
Have Eosio SDK which contains everything necessary to write, build, and test Eos contracts on a Linux operating system.

[Goalposts moved, see comments below; the below description is no longer valid, but provides useful context]

Components of the SDK:

  • Eos Blockchain software (eosd, eosc)
  • Eos standard library (eoslib)
  • Toolchain (wasm-llvm, s2wasm)
  • Contract compiler script (eoscpp)
  • Skeleton contract project (hello world contract impl, test cases, CMakeLists.txt)

SDK installs to /opt/eosiosdk, and contains all of the above components in a standard Linux software directory structure:

/opt/eosiosdk/bin contains {eosd, eosc, toolchain binaries, s2wasm, eoscpp}
/opt/eosiosdk/include contains eoslib
/opt/eosiosdk/lib contains eos, fc libraries
/opt/eosiosdk/share/eosiocontract/skeleton contains skeleton contract project

How to develop an Eosio contract:

  • Download/install SDK
  • Run eoscpp --newcontract mycontract
    • Creates mycontract folder and populates it with skeleton contract
    • Interpolates mycontract name into skeleton
  • Implement contract/test cases
  • Run cmake .
    • Finds Eosio SDK
    • Creates Makefile or equivalent
  • Run make or equivalent
    • Runs eoscpp to compile mycontract.cpp to mycontract.wast
  • Run make test or equivalent
    • Creates mycontract.wast.hpp from mycontract.wast
    • Builds test program against mycontract.wast.hpp
    • Runs test program
  • To deploy, run eosc contract mycontract mycontract.wast mycontract.abi
@nathanielhourt nathanielhourt added this to the Test Network Release milestone Aug 28, 2017
@nathanielhourt nathanielhourt self-assigned this Aug 28, 2017
@bytemaster
Copy link
Contributor

Related to this would be integration of a tool that automatically generates mycontract.abi based upon comments / annotations within contract. Not necessary to close this issue, just adding it to the list of tools that need to be included in the final SDK.

@kimziv
Copy link

kimziv commented Aug 29, 2017

awesome

@nathanielhourt
Copy link
Contributor Author

Tried making a CMake project which includes the various SDK components as subdirectory projects, and builds and installs the relevant targets only... This is not something CMake supports, and I ran into dead ends with every dirty hack and workaround I tried, so I've ditched CMake and am now evaluating using a simple shell script that downloads, builds, and assembles the SDK.

@nathanielhourt
Copy link
Contributor Author

Rolling with the shell script for now, because it makes things work.

I've written a super basic eoscpp now; all that remains is to put together a skeleton project w/ test cases

@nathanielhourt
Copy link
Contributor Author

Ported contract project w/ cmake to build w/ eoscpp. Using that as the basis for the skeleton project. No test cases as yet.

@nathanielhourt
Copy link
Contributor Author

nathanielhourt commented Sep 5, 2017

Todo:

  • Add test cases
  • Implement renaming to new project name (in eoscpp) when copying skeleton

@nathanielhourt
Copy link
Contributor Author

It has been decided that the SDK should be part of Eos, rather than Eos part of the SDK which is the typical pattern. This is because we want to build and run Eos contracts as part of the Eos build and test process.

To accomplish this, it is proposed to put the build script (presently build.sh in the SDK repo) into the Eos repo, but rewrite it to remove the Eos build steps and have it build/install the toolchain outside of the Eos repo (where?), in contrast to the previous bundled SDK design which keeps all components within a single dedicated install tree (recommended: /opt/eosiosdk). The Eos cmake must be updated to locate the toolchain, and generate a copy of eoscpp that contains a hard-coded reference to it, instead of the autodetection eoscpp currently uses (can't autodetect, as eoscpp is becoming part of Eos, but the toolchain is installed separately). Furthermore, eoscpp must be rewritten to detect whether it's being run as part of the source distribution of Eos, in which case it must auto-locate the Eos binaries, or whether it's being run as installed as part of Eos within the OS, as the paths to binaries change depending on whether Eos is installed or not (ie <srcdir>/programs/eosd/eosd vs <installpath>/bin/eosd)

Todo:

  • Re-engineer build.sh
    • Remove Eos build/install steps
    • Move script into Eos repo
    • Amend script to build/install toolchain somewhere outside of Eos repo
  • Update eoscpp
    • Replace eoscpp script with cmake input file (cmake must generate script now)
    • Detect whether Eos is installed or running from build dir, adapt accordingly
    • Remove toolchain autodetection in favor of hard-coded paths from cmake
  • Update Eos cmake
    • Locate toolchain (whether installed by build.sh or some other manner)
    • Generate a copy of eoscpp with hardcoded path to toolchain
    • Restructure contracts to build with eoscpp
      • Ideally, restructure contract tests to be part of their parent contract's build rather than Eos's
    • Unify SDK's eoslib and Eos's copy, as these have fallen out of sync

@nathanielhourt nathanielhourt removed their assignment Sep 12, 2017
@pavybez
Copy link

pavybez commented Sep 13, 2017

We will break this task into following staged steps:

  1. Integrate eoscpp into eos repository (without generation from cmake).
  2. Modify build.sh to take the path of installed dependencies and generate cmake for eos and eoscpp.
  3. Modify build.sh to build/install all dependencies in user desired folder.

@pavybez pavybez self-assigned this Sep 13, 2017
@pavybez
Copy link

pavybez commented Sep 14, 2017

Initial version completed.

@pavybez pavybez closed this as completed Sep 14, 2017
@amodi01
Copy link

amodi01 commented Dec 15, 2017

@nathanhourt @pavybez we not able to compile the code. Getting below errors. Please provide assistance.

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /usr/bin/c++
Build flags: -Wno-error=implicit-fallthrough=
Id flags:

The output was:
1
cc1plus: error: -Werror=implicit-fallthrough=: no option -Wimplicit-fallthrough=

taokayan pushed a commit to taokayan/eos that referenced this issue May 15, 2019
Added support for non-type template params and fix issue with typedefs to template types.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants