eosiocpp compilation error when following hello world contract tutorial is still occurring

Created on 9 Apr 2018  路  18Comments  路  Source: EOSIO/eos

I am running on the dawn-v3.0.0 tag, and I'm following the most recent tutorial: https://github.com/EOSIO/eos/wiki/Tutorial-Getting-Started-With-Contracts
I'm using Ubuntu 17.10 Server.
The error below occurs when I try to compile hello.cpp and generate the hello.wast file using eosiocpp:
jae@hkeos:~/eos-dawn-v3.0.0/eos/build/tools$./eosiocpp -o ../contracts/hello/hello.wast ../contracts/hello/hello.cpp

../contracts/hello/hello.cpp:1:10: fatal error: 'eosiolib/eosio.hpp' file not
      found
#include <eosiolib/eosio.hpp>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.

I've already tried sudo make install again, but it didn't work.

1439

Most helpful comment

Hey guys, sorry I should have commented how I fixed this much earlier.

I ran while in the build folder:

$ sudo su
$ make install
$ su <username>

Then, I compiled again, and everything worked :)

All 18 comments

You can do this to set a contract :

cleos set contract eosio build/contracts/hello

You can go https://eosfans.io/topics/193 to find the answer.

Error is not on the deployment stage, it's when I try to compile using eosiocpp

Hi @jchung00, I had the same problem you are having now. Given that you have done sudo make install and everything seems correct with your installation, try then moving the hello contract code to another folder, out of contracts/. That worked for me. It is always good to keep software installation and workspace separate.

Hope it helps.

Same issue here... any solution?

I'm on OSX High Sierra 10.13.3 -- I ran the ./eosio_build.sh (without sudo)

Ok!

I made it work after going to build folder and running sudo make install

Perhaps it's a missing command in the build script or it's running without sudo...

Getting the same issue here on ubuntu 17.10 with the latest master. Ran sudo make install in the build folder again, tried moving to a different folder and still getting the error compiling from the skeleton. 2 errors and 5 warnings

eosiocpp -o helloworld.wast helloworld.cpp

In file included from helloworld.cpp:5:
In file included from ./helloworld.hpp:5:
In file included from /usr/local/include/eosiolib/eosio.hpp:7:
In file included from /usr/local/include/eosiolib/action.hpp:7:
In file included from /usr/local/include/eosiolib/datastream.hpp:9:
In file included from /root/opt/boost_1_66_0/include/boost/container/flat_map.hpp:26:
In file included from /root/opt/boost_1_66_0/include/boost/container/new_allocator.hpp:24:
/root/opt/boost_1_66_0/include/boost/container/throw_exception.hpp:56:21: warning: address of array 'msg' will always evaluate to 'true' [-Wpointer-bool-conversion]
BOOST_ASSERT(!msg);
~^~~
/root/opt/boost_1_66_0/include/boost/assert.hpp:60:36: note: expanded from macro 'BOOST_ASSERT'

define BOOST_ASSERT(expr) assert(expr)

                               ^~~~

/usr/local/include/musl/upstream/include/assert.h:8:28: note: expanded from macro 'assert'

define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))

                       ^

In file included from helloworld.cpp:5:
In file included from ./helloworld.hpp:5:
In file included from /usr/local/include/eosiolib/eosio.hpp:7:
In file included from /usr/local/include/eosiolib/action.hpp:7:
In file included from /usr/local/include/eosiolib/datastream.hpp:9:
In file included from /root/opt/boost_1_66_0/include/boost/container/flat_map.hpp:26:
In file included from /root/opt/boost_1_66_0/include/boost/container/new_allocator.hpp:24:
/root/opt/boost_1_66_0/include/boost/container/throw_exception.hpp:64:25: warning: address of array 'msg' will always evaluate to 'true' [-Wpointer-bool-conversion]
BOOST_ASSERT_MSG(!msg, str);
~^~~
/root/opt/boost_1_66_0/include/boost/assert.hpp:61:46: note: expanded from macro 'BOOST_ASSERT_MSG'

define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))

                                         ^~~~

/usr/local/include/musl/upstream/include/assert.h:8:28: note: expanded from macro 'assert'

define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))

                       ^

In file included from helloworld.cpp:5:
In file included from ./helloworld.hpp:5:
In file included from /usr/local/include/eosiolib/eosio.hpp:7:
In file included from /usr/local/include/eosiolib/action.hpp:7:
In file included from /usr/local/include/eosiolib/datastream.hpp:9:
In file included from /root/opt/boost_1_66_0/include/boost/container/flat_map.hpp:26:
In file included from /root/opt/boost_1_66_0/include/boost/container/new_allocator.hpp:24:
/root/opt/boost_1_66_0/include/boost/container/throw_exception.hpp:72:25: warning: address of array 'msg' will always evaluate to 'true' [-Wpointer-bool-conversion]
BOOST_ASSERT_MSG(!msg, str);
~^~~
/root/opt/boost_1_66_0/include/boost/assert.hpp:61:46: note: expanded from macro 'BOOST_ASSERT_MSG'

define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))

                                         ^~~~

/usr/local/include/musl/upstream/include/assert.h:8:28: note: expanded from macro 'assert'

define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))

                       ^

In file included from helloworld.cpp:5:
In file included from ./helloworld.hpp:5:
In file included from /usr/local/include/eosiolib/eosio.hpp:7:
In file included from /usr/local/include/eosiolib/action.hpp:7:
In file included from /usr/local/include/eosiolib/datastream.hpp:9:
In file included from /root/opt/boost_1_66_0/include/boost/container/flat_map.hpp:26:
In file included from /root/opt/boost_1_66_0/include/boost/container/new_allocator.hpp:24:
/root/opt/boost_1_66_0/include/boost/container/throw_exception.hpp:80:25: warning: address of array 'msg' will always evaluate to 'true' [-Wpointer-bool-conversion]
BOOST_ASSERT_MSG(!msg, str);
~^~~
/root/opt/boost_1_66_0/include/boost/assert.hpp:61:46: note: expanded from macro 'BOOST_ASSERT_MSG'

define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))

                                         ^~~~

/usr/local/include/musl/upstream/include/assert.h:8:28: note: expanded from macro 'assert'

define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))

                       ^

In file included from helloworld.cpp:5:
In file included from ./helloworld.hpp:5:
In file included from /usr/local/include/eosiolib/eosio.hpp:7:
In file included from /usr/local/include/eosiolib/action.hpp:7:
In file included from /usr/local/include/eosiolib/datastream.hpp:9:
In file included from /root/opt/boost_1_66_0/include/boost/container/flat_map.hpp:26:
In file included from /root/opt/boost_1_66_0/include/boost/container/new_allocator.hpp:24:
/root/opt/boost_1_66_0/include/boost/container/throw_exception.hpp:88:25: warning: address of array 'msg' will always evaluate to 'true' [-Wpointer-bool-conversion]
BOOST_ASSERT_MSG(!msg, str);
~^~~
/root/opt/boost_1_66_0/include/boost/assert.hpp:61:46: note: expanded from macro 'BOOST_ASSERT_MSG'

define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))

                                         ^~~~

/usr/local/include/musl/upstream/include/assert.h:8:28: note: expanded from macro 'assert'

define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0)))

                       ^

helloworld.cpp:15:39: error: no matching conversion for functional-style cast from 'uint64_t' (aka 'unsigned long long') to 'eosio::name'
eosio::print( "Hello World: ", eosio::name(code), "->", eosio::name(action), "\n" );
^~~~
/usr/local/include/eosiolib/types.hpp:75:11: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'uint64_t' (aka 'unsigned long long') to
'const eosio::name' for 1st argument
struct name {
^
/usr/local/include/eosiolib/types.hpp:75:11: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'uint64_t' (aka 'unsigned long long') to 'eosio::name' for
1st argument
/usr/local/include/eosiolib/types.hpp:75:11: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
helloworld.cpp:15:64: error: no matching conversion for functional-style cast from 'uint64_t' (aka 'unsigned long long') to 'eosio::name'
eosio::print( "Hello World: ", eosio::name(code), "->", eosio::name(action), "\n" );
^~~~~~
/usr/local/include/eosiolib/types.hpp:75:11: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'uint64_t' (aka 'unsigned long long') to
'const eosio::name' for 1st argument
struct name {
^
/usr/local/include/eosiolib/types.hpp:75:11: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'uint64_t' (aka 'unsigned long long') to 'eosio::name' for
1st argument
/usr/local/include/eosiolib/types.hpp:75:11: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
5 warnings and 2 errors generated.

It looks like contracts/skeleton/skeleton.cpp was last updated on March 22 (826f241330d531ac09af24ff49ea8656213a99fc) and commit b49eb6477c34cac2d00c2345a6dcd1c0f4e1f3e3 on the 28th removed the eosio::name constructor that took a uint64_t.

This happens to me as well on dawn-v3.0.0. OS is ubuntu 16.04.

Did anyone figured out the solution to the problem with "5 warnings and 2 errors generated"?

@vasa-develop Changing eosio::name(code) to eosio::name{code} and eosio::name(action) to eosio::name{action} in the .cpp file generated should fix the errors. its an issue with the code generated by the skeleton.

Hey guys, sorry I should have commented how I fixed this much earlier.

I ran while in the build folder:

$ sudo su
$ make install
$ su <username>

Then, I compiled again, and everything worked :)

@jchung00 doing sudo make install again does not solve it for me.

@javierjmc could you post the command you use after you moved it out to another folder? Thank you.

@swswsw well assuming you have a terminal on your home directory and eos is installed there:

$ mkdir eos-workspace
$ mv eos/build/contracts/hello/ ~/eos-workspace

Then you can go to eos-workspace/hello/ and compile from there.
You can also move the folder through the GUI if you have one.

@javierjmc thanks, but obviously I tried moving it to other folder before, but it didn't work, so I was wondering if you did anything special when you issue the compile command? Like including another folder. If it is g++, we can include path with -I command, but eosiocpp doesn't seem to have that option.

for build skeleton contract in DAWN 3.0
just replace sting:
eosio::print( "Hello World: ", eosio::name(code), "->", eosio::name(action), "\n" );
with:
eosio::print( "Hello World: ", eosio::name{code}, "->", eosio::name{action}, "\n" );

I got this error too, and I solved it by sudo make install in /build then sudo eosiocpp .....
I guess sudo make install is not required, maybe the libs were installed with root authority by the automated build script. I didn't figure it out at the beginning because I didn't get promoted with a dialog asking for password when running the automated build script. And now I found that's because my current account can access all cmd with root without pwd, lol.
good luck.

FYI, ubuntu 16.04, current master branch.

mac:

cd build
sudo make install

Then, I compiled again, and everything worked .

Was this page helpful?
0 / 5 - 0 ratings