worldwide-asset-exchange / wax-cdt-legacy

WAX Contract Development Toolkit
MIT License
16 stars 8 forks source link

Compiler (make) fails for unobvious reasons. Solved: eosio.cdt needs upgraded #11

Open SteversIO opened 3 years ago

SteversIO commented 3 years ago

I'm getting this error when trying to build the atomicassets smart contract.

error: else expression without matching if
0000bd7: error: OnElseExpr callback failed

so far it looks like eosio.cdt needs upgraded to at least 1.6.2 to prevent this per this issue.

Its taking forever to upgrade so i'll let you know if this actually fixes the issue. I hand-reviewed all code and nothing seems like it should actually be triggering this error. Its also an open source contract that many people use, so im baffled why this is happening.

SteversIO commented 3 years ago

Hi all. Okay i did verify that the solution is to upgrade eosio-cpp. The best option for doing this is upgrading the entire eosio.cdt package. Doing it the manual install way allows all the eosio programs to install as well.

# 1A) Verifying location of eosio-cpp
which eosio-cpp
> /usr/local/bin/eosio-cpp

# 1B) Discovering its just a symbolic link
ls -la /user/local/bin
> eosio-cpp -> ../eosio.cdt/bin/eosio-cpp

# 2A) Update eosio.cdt
git clone --recursive https://github.com/eosio/eosio.cdt
cd eosio.cdt && \
mkdir build && \
cd build && \
cmake .. && \
make -j8

# 2B) Install globally to: /usr/local/eosio.cdt to take advantage of symbolic link
sudo make install

# 3B) verify install successful
eosio-cpp --version
> eosio-cpp version 1.7.0

I then ran the eosio-cpp on the contract and it compiled successfully. In addition, it deployed with zero issues.

eosio-cpp -I="include" -abigen src/main.cpp -o contract.wasm
cleos set contract <contract_name> $contract_dir -p account@active
SteversIO commented 3 years ago

I'd like to leave this issue here so others can be made aware of this. I spent 5+ hours today working my way through this. The WAX developer guide makes you think you should be using cmake and make to build the contracts. Then later in the documentation it states that eosio-cpp is recommended.

I'm super excited to be working on WAX but this is definitely going to prevent newcomers that aren't as senior in their skillset.

themeadery commented 3 years ago

Agreed, this is annoying. The wax fork of eosio-cpp is WAY behind and thus the docker images. Please merge new updates!