Problems with EOS Studio

You need to add the eosio accounts private key in order to be able to create accounts.

Import this priv key to your wallet.
5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

Carlos Z

1 Like

Going back to compilation, I don’t see any .abi file being generated. I searched with the graphical file manager from the root and nothing came up. Remember, when I compile, it always locks up and the .wasm file is always .wasm.tmp.... and a few other characters. So I renamed it, but now that I see no .abi file, I’m wondering if it’s compiling correctly. Also, in cleos set contract ted /home/ted/EOSStudio ./helloworld.wasm --abi dogcontract.abi -p ted@active, why do we enter path ./file rather than just path/file which I noticed gets interpreted strangely and doesn’t work.

the dot . before the back slash means to look into the same folder as you are currently in the session, so if you are inside folder /home/ted/EOSStudio, instead of writing the same path for each file that exist into that folder, you use ./helloworld.wasm for example, to refer ‘In this same folder’.

Also, have you tried to update the nodeos version? might be that the SDK is not compatible with the syntax version.

Carlos Z

1 Like

The latest verified release is v2.0.8 at https://github.com/EOSIO/eos/releases. I did wget https://github.com/EOSIO/eos/releases/download/v2.0.8/eosio_2.0.8-1-ubuntu-18.04_amd64.deb and then sudo apt install ./eosio_2.0.8-1-ubuntu-18.04_amd64.deb but the results are the same. It still freezes at compile, creates extra characters after wasm.temp, and does not generate a .abi file.

1 Like

So might be a syntax error, try to delete some functions, remove them temporary, until it compile, then start adding the functions until all the contract compiles.

The idea is to know if one function is the one that is getting the compiler stuck.

Carlos Z

1 Like

I took out all of the actions and functions. Below is what’s left. Below that is the .wasm file which is a little different this time, but it froze again after a couple of empty ricardian warnings and no abi file was generated. Remember, before I added the code for the inline actions, I used Excel to verify that my code was absolutely identical to what you had in Github.

#include <eosio/eosio.hpp>
#include <eosio/asset.hpp>

using namespace std;
using namespace eosio;

CONTRACT dogcontract : public contract {
public:
using contract::contract;
dogcontract(name receiver, name code, datastream<const char*> ds)
:contract(receiver, code, ds)
, currency_symbol(“DOGCOIN”, 0){}
/*
** Function insert the name and age of a dog with the dog_id.
** Owner can not be changed in this function.
*/

private:
  const symbol currency_symbol; //to check if payment match our currency symbol

    //table struct dog data
    TABLE dog{
        int id; //unique ID for index
        std::string dog_name;
        int age;
        name owner; //eos account name, owner of dogs
        //get primary key by ID variable
        uint64_t primary_key() const{return id;}
        //get dogs by owner index
        uint64_t by_owner() const{return owner.value;}
    };//end table dog

    //table struct balance, used to manage account funds
    TABLE balance {
        asset funds; //asset is EOS type for tokens
        //primary key for table, never used but need it
        uint64_t primary_key() const{return funds.symbol.raw();}
    };//end table balance

    //define table type index
    typedef multi_index<"dogs"_n, dog, indexed_by<"byowner"_n, const_mem_fun<dog, uint64_t, &dog::by_owner>>> dog_index;
    //index for balance table
    typedef multi_index<"balances"_n, balance> balance_index;
};

Here is what’s in the .wasm file (after a bunch of these �):

.eosio_abi�{"____comment":“This file was generated with eosio-abigen. DO NOT EDIT “,“version”:“eosio::abi/1.1”,“structs”:[{“name”:“balance”,“base”:””,“fields”:[{“name”:“funds”,“type”:“asset”}]},{“name”:“dog”,“base”:"",“fields”:[{“name”:“id”,“type”:“int32”},{“name”:“dog_name”,“type”:“string”},{“name”:“age”,“type”:“int32”},{“name”:“owner”,“type”:“name”}]}],“types”:[],“actions”:[],“tables”:[{“name”:“balances”,“type”:“balance”,“index_type”:“i64”,“key_names”:[],“key_types”:[]},{“name”:“dogs”,“type”:“dog”,“index_type”:“i64”,“key_names”:[],“key_types”:[]}],“ricardian_clauses”:[],“variants”:[],“abi_extensions”:[]}

I forgot to mention, when I start EOS, I see this item at the bottom. Seems like it might be necessary, but I want to be sure. EOS programs

1 Like

Yes, it is completely necessary, might the why your contract is failing at compiling, cuz the eosio compiler will find which system contracts refer to keywords on your contract.

Install it try to run your contract again.

Carlos Z

1 Like

Unfortunately, I got identical results after installing.

1 Like

Ok, but which contract are you trying to compile? the helloworld or my dog contract?

also which command are you using at compilation?

Carlos Z

Dog contract only. Here’s the line:
eosio-cpp -abigen -o dogcontract.wasm src/dogcontract.cpp

What do you think @thecil?

1 Like

Hey man, sorry for the late reply!!

Now, try to do the following:
Create a new ‘helloworld’ project (delete any existent), it will create a helloworld contract, try to compile and deploy that one.

In case you face the same error, i think it could be the docker…

Carlos Z

1 Like

OK cool. That seems to have fixed whatever it was that was causing it to lock up. Below is I’m getting, now and this is even after I added the actions and functions back into the cpp file. You said before you didn’t think the header file mattered here, but that was my first thought. I’d add the file at https://github.com/thecil/public/blob/master/EOS/dogcontract/include/dogs.contract/dogs.hpp, but it doesn’t quite seem to match up with the cpp file. The actions have different names and there are redundancies like with the table struct definitions that don’t seem right to me.

ted@ted-VirtualBox:~/EOSStudio/helloworld$ eosio-cpp -abigen -o helloworld.wasm src/helloworld.cpp
Warning, empty ricardian clause file
Warning, empty ricardian clause file
/usr/opt/eosio.cdt/1.6.1/bin/wasm-ld: error: fatal failure: contract with no actions and trying to create dispatcher

1 Like

@thecil, this should be an easy one for you.

1 Like

Yeah, so if the contract is empty, it compiles, so the problem is not the compiler, I still think that you should build the basic structure of a contract, just add 1 function that returns ‘hello world’ (you can also use the template that is created by EOS Studio).

IF you succeed to compile a fresh contract, there is a problem with the syntax of your contract, I advice to follow the same process, with your same contract, just leave it with 1 function, if it compiles, add more functionality and compile again, and so on.

The problem could be in a bad declaration that we are not seeing, thats why the best way to debug the error, is just to test all the functions until one trigger the error.

Carlos Z

1 Like

The problem I’m having with the helloworld template that EOS Studio generates is I’ll get a compile error about not being able to find the .hpp file. I tried just adding include/hellotest.hpp to the end of the compile statement, but that didn’t work. I don’t see any examples of compile lines online that include a reference to the header file. I either need to be able to do that or I need to simplify the code or add a reference to something already in eosio like dogcontract did with #include <eosio/eosio.hpp> and #include <eosio/asset.hpp> so it doesn’t need a custom header file. If I try to simplify the code, the problem is so many things in there trigger compile errors that indicate it doesn’t recognize these things, so it would be hard to know what to eliminate and still end up with code that makes sense.

1 Like

Are you sure you install the “system contracts” from the EOS Studio setup process?

The helloworld template also create the header file (in the include folder). So when you run the compiler for the .cpp file (which include helloworld.hpp) it should load the header file, there is no need to specify to the compiler where is the header file, cuz the .cpp already mention it.

Carlos Z

OK, I’m back. Hope all is well with you. I’m working to reconnect with where I was at. Starting at re-creating a basic auto-generated contract, I am back to the problem with the .hpp file even though it is clearly referenced in the cpp file. Here’s how it looks:

ted@ted-VirtualBox:~/EOS Studio/hellotest2$ eosio-cpp -abigen -o hellotest2.wasm src/hellotest2.cpp
/home/ted/EOS Studio/hellotest2/src/hellotest2.cpp:1:10: fatal error:
‘hellotest2.hpp’ file not found
#include <hellotest2.hpp>
^~~~~~~~~~~~~~~~
1 error generated.
Error while processing /home/ted/EOS Studio/hellotest2/src/hellotest2.cpp.
abigen error

try with #include <./hellotest2.hpp> or #include "hellotest2.hpp". :face_with_monocle:

Carlos Z