Question:

set contract error

Henry: 22 May 2022

I tried to set contract with the promotion account, but kept getting this error:

cleos set contract promotion car_promotion -p promotion Reading WAST/WASM from car_promotion/car_promotion.wasm... Using already assembled WASM... Publishing contract... 257134ms thread-0 main.cpp:2493 main ] Failed with error: Assert Exception (10) !"unresolvable": env.free

What's wrong?

Answer:
Lucas: 22 May 2022

This means that your WASM is compiled such that it expects the symbol free to be provided at run time by the environment. In our WebAssembly toolchain, any unresolvable symbol left over after linking will be assumed part of the "env" module and present at execution time.

We don't provide a free intrinsic as our memory model operates underneath a usual memory allocator. It is likely that your contract code is assuming too much about the environment or your build chain is missing our standard C, C++, or EOSIO libraries.