Fix compilation for emcc

This commit is contained in:
jiegec 2020-03-11 22:08:02 +08:00
parent dd8ebf7873
commit 7b679eecb3
4 changed files with 8 additions and 3 deletions

View File

@ -237,7 +237,7 @@ ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
EMCCFLAGS := -Os -Wno-warn-absolute-paths EMCCFLAGS := -Os -Wno-warn-absolute-paths
EMCCFLAGS += --memory-init-file 0 --embed-file share -s NO_EXIT_RUNTIME=1 EMCCFLAGS += --memory-init-file 0 --embed-file share -s NO_EXIT_RUNTIME=1
EMCCFLAGS += -s EXPORTED_FUNCTIONS="['_main','_run','_prompt','_errmsg']" EMCCFLAGS += -s EXPORTED_FUNCTIONS="['_main','_run','_prompt','_errmsg']"
EMCCFLAGS += -s TOTAL_MEMORY=128*1024*1024 EMCCFLAGS += -s TOTAL_MEMORY=134217728
# https://github.com/kripken/emscripten/blob/master/src/settings.js # https://github.com/kripken/emscripten/blob/master/src/settings.js
CXXFLAGS += $(EMCCFLAGS) CXXFLAGS += $(EMCCFLAGS)
LDFLAGS += $(EMCCFLAGS) LDFLAGS += $(EMCCFLAGS)
@ -895,6 +895,7 @@ config-emcc: clean
echo 'ENABLE_ABC := 0' >> Makefile.conf echo 'ENABLE_ABC := 0' >> Makefile.conf
echo 'ENABLE_PLUGINS := 0' >> Makefile.conf echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
echo 'ENABLE_READLINE := 0' >> Makefile.conf echo 'ENABLE_READLINE := 0' >> Makefile.conf
echo 'ENABLE_ZLIB := 0' >> Makefile.conf
config-mxe: clean config-mxe: clean
echo 'CONFIG := mxe' > Makefile.conf echo 'CONFIG := mxe' > Makefile.conf

View File

@ -1,2 +1,3 @@
ifneq ($(CONFIG),emcc)
OBJS += frontends/rpc/rpc_frontend.o OBJS += frontends/rpc/rpc_frontend.o
endif

View File

@ -695,7 +695,6 @@ void log_check_expected()
log_warn_regexes.clear(); log_warn_regexes.clear();
log("Expected error pattern '%s' found !!!\n", item.second.pattern.c_str()); log("Expected error pattern '%s' found !!!\n", item.second.pattern.c_str());
#ifdef EMSCRIPTEN #ifdef EMSCRIPTEN
log_files = backup_log_files;
throw 0; throw 0;
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
_exit(0); _exit(0);

View File

@ -341,7 +341,11 @@ int run_command(const std::string &command, std::function<void(const std::string
if (!process_line) if (!process_line)
return system(command.c_str()); return system(command.c_str());
#ifdef EMSCRIPTEN
FILE *f = nullptr;
#else
FILE *f = popen(command.c_str(), "r"); FILE *f = popen(command.c_str(), "r");
#endif
if (f == nullptr) if (f == nullptr)
return -1; return -1;