Merge pull request #9111 from ethereum/emscriptenTest

Switch to emscripten upstream backend.
This commit is contained in:
chriseth 2020-06-04 16:24:47 +02:00 committed by GitHub
commit 92a9f44afa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 14 deletions

View File

@ -598,7 +598,7 @@ jobs:
b_ems: b_ems:
docker: docker:
- image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-1 - image: ethereum/solidity-buildpack-deps:emsdk-1.39.15-2
environment: environment:
TERM: xterm TERM: xterm
steps: steps:

View File

@ -26,11 +26,9 @@
# contains a Makefile in the docker/ subdirectory that can be used to create the # contains a Makefile in the docker/ subdirectory that can be used to create the
# required base image using: # required base image using:
# #
# make version=1.39.15-fastcomp build # make version=1.39.15 build
# #
# TODO: switch to the upstream backend by removing "-fastcomp". FROM emscripten/emsdk:1.39.15 AS base
#
FROM emscripten/emsdk:1.39.15-fastcomp AS base
ADD emscripten.jam /usr/src ADD emscripten.jam /usr/src
RUN set -ex; \ RUN set -ex; \
@ -47,6 +45,7 @@ RUN set -ex; \
-DZ3_BUILD_TEST_EXECUTABLES=OFF \ -DZ3_BUILD_TEST_EXECUTABLES=OFF \
-DZ3_BUILD_EXECUTABLE=OFF \ -DZ3_BUILD_EXECUTABLE=OFF \
-DZ3_SINGLE_THREADED=ON \ -DZ3_SINGLE_THREADED=ON \
-DCMAKE_CXX_FLAGS="-s DISABLE_EXCEPTION_CATCHING=0" \
..; \ ..; \
make; make install; \ make; make install; \
rm -r /usr/src/z3; \ rm -r /usr/src/z3; \
@ -61,6 +60,6 @@ RUN set -ex; \
echo "using emscripten : : em++ ;" >> project-config.jam ; \ echo "using emscripten : : em++ ;" >> project-config.jam ; \
./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \ ./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \
--with-system --with-filesystem --with-test --with-program_options \ --with-system --with-filesystem --with-test --with-program_options \
cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \ cxxflags="-s DISABLE_EXCEPTION_CATCHING=0 -Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \
--prefix=/emsdk/emscripten/sdk/system install; \ --prefix=/emsdk/emscripten/sdk/system install; \
rm -r /usr/src/boost_1_73_0 rm -r /usr/src/boost_1_73_0

View File

@ -8,6 +8,7 @@ Language Features:
Compiler Features: Compiler Features:
* Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism. * Build system: Update the soljson.js build to emscripten 1.39.15 and boost 1.73.0 and include Z3 for integrated SMTChecker support without the callback mechanism.
* Build system: Switch the emscripten build from the fastcomp backend to the upstream backend.
* Code Generator: Do not introduce new internal source references for small compiler routines. * Code Generator: Do not introduce new internal source references for small compiler routines.
* Commandline Interface: Adds new option ``--base-path PATH`` to use the given path as the root of the source tree (defaults to the root of the filesystem). * Commandline Interface: Adds new option ``--base-path PATH`` to use the given path as the root of the source tree (defaults to the root of the filesystem).
* SMTChecker: Support array ``length``. * SMTChecker: Support array ``length``.

View File

@ -16,9 +16,11 @@
include(EthCheckCXXCompilerFlag) include(EthCheckCXXCompilerFlag)
eth_add_cxx_compiler_flag_if_supported(-fstack-protector-strong have_stack_protector_strong_support) if(NOT EMSCRIPTEN)
if(NOT have_stack_protector_strong_support) eth_add_cxx_compiler_flag_if_supported(-fstack-protector-strong have_stack_protector_strong_support)
if(NOT have_stack_protector_strong_support)
eth_add_cxx_compiler_flag_if_supported(-fstack-protector) eth_add_cxx_compiler_flag_if_supported(-fstack-protector)
endif()
endif() endif()
eth_add_cxx_compiler_flag_if_supported(-Wimplicit-fallthrough) eth_add_cxx_compiler_flag_if_supported(-Wimplicit-fallthrough)
@ -109,15 +111,13 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
# Re-enable exception catching (optimisations above -O1 disable it) # Re-enable exception catching (optimisations above -O1 disable it)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
# Remove any code related to exit (such as atexit) # Remove any code related to exit (such as atexit)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXIT_RUNTIME=0")
# Remove any code related to filesystem access # Remove any code related to filesystem access
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_FILESYSTEM=1") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FILESYSTEM=0")
# Remove variables even if it needs to be duplicated (can improve speed at the cost of size)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s AGGRESSIVE_VARIABLE_ELIMINATION=1")
# Allow memory growth, but disable some optimisations # Allow memory growth, but disable some optimisations
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
# Disable eval() # Disable eval()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_DYNAMIC_EXECUTION=1") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DYNAMIC_EXECUTION=0")
# Disable greedy exception catcher # Disable greedy exception catcher
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NODEJS_CATCH_EXIT=0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NODEJS_CATCH_EXIT=0")
# Abort if linking results in any undefined symbols # Abort if linking results in any undefined symbols

View File

@ -54,6 +54,10 @@ cmake \
-DTESTS=0 \ -DTESTS=0 \
.. ..
make -j 4 soljson make -j 4 soljson
# Patch soljson.js for backwards compatibility.
# TODO: remove this with 0.7.
# "viiiii" encodes the signature of the callback function.
sed -i -e 's/addFunction(func,sig){/addFunction(func,sig){sig=sig||"viiiii";/' libsolc/soljson.js
cd .. cd ..
mkdir -p upload mkdir -p upload