bytecodealliance / wasm-micro-runtime

WebAssembly Micro Runtime (WAMR)
Apache License 2.0
4.79k stars 606 forks source link

memory may not be shared: threads not allowed #3680

Open subhakr opened 1 month ago

subhakr commented 1 month ago

Hi, here i am trying integrate wasm with sysbench benchmark profiling tool. i have compiled this sysbench with wasi-sdk 23 version. after compiling i am trying to run with iwasm runtime.

i am getting like this and my executable name is sysbench.

admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/sysbench_main$ /home/admin1/Downloads/runtimes_wasm/iwasm2 src/sysbench
WASM module load failed: invalid section id
admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/sysbench_main$ wasm-validate src/sysbench
0000a7f: error: memory may not be shared: threads not allowed
am__is_gnu_make = { \
  if test -z '$(MAKELEVEL)'; then \
    false; \
  elif test -n '$(MAKE_HOST)'; then \
    true; \
  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    true; \
  else \
    false; \
  fi; \
}
am__make_running_with_option = \
  case $${target_option-} in \
      ?) ;; \
      *) echo "am__make_running_with_option: internal error: invalid" \
              "target option '$${target_option-}' specified" >&2; \
         exit 1;; \
  esac; \
  has_opt=no; \
  sane_makeflags=$$MAKEFLAGS; \
  if $(am__is_gnu_make); then \
    sane_makeflags=$$MFLAGS; \
  else \
    case $$MAKEFLAGS in \
      *\\[\ \   ]*) \
        bs=\\; \
        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
          | sed "s/$$bs$$bs[$$bs $$bs   ]*//g"`;; \
    esac; \
  fi; \
  skip_next=no; \
  strip_trailopt () \
  { \
    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
  }; \
  for flg in $$sane_makeflags; do \
    test $$skip_next = yes && { skip_next=no; continue; }; \
    case $$flg in \
      *=*|--*) continue;; \
        -*I) strip_trailopt 'I'; skip_next=yes;; \
      -*I?*) strip_trailopt 'I';; \
        -*O) strip_trailopt 'O'; skip_next=yes;; \
      -*O?*) strip_trailopt 'O';; \
        -*l) strip_trailopt 'l'; skip_next=yes;; \
      -*l?*) strip_trailopt 'l';; \
      -[dEDm]) skip_next=yes;; \
      -[JT]) skip_next=yes;; \
    esac; \
    case $$flg in \
      *$$target_option*) has_opt=yes; break;; \
    esac; \
  done; \
  test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/sysbench
pkgincludedir = $(includedir)/sysbench
pkglibdir = $(libdir)/sysbench
pkglibexecdir = $(libexecdir)/sysbench
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-pc-linux-gnux32
host_triplet = wasm32-unknown-wasi
target_triplet = wasm32-unknown-wasi
bin_PROGRAMS = sysbench$(EXEEXT)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_aio.m4 \
    $(top_srcdir)/m4/ac_check_pgsql.m4 \
    $(top_srcdir)/m4/acx_pthread.m4 \
    $(top_srcdir)/m4/ax_check_compile_flag.m4 \
    $(top_srcdir)/m4/ax_compiler_vendor.m4 \
    $(top_srcdir)/m4/ax_gcc_archflag.m4 \
    $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
    $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
    $(top_srcdir)/m4/ax_tls.m4 $(top_srcdir)/m4/extensions.m4 \
    $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
    $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
    $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
    $(top_srcdir)/m4/sb_check_mysql.m4 \
    $(top_srcdir)/m4/sb_concurrency_kit.m4 \
    $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    $(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_sysbench_OBJECTS = sysbench.$(OBJEXT) db_driver.$(OBJEXT) sb_timer.$(OBJEXT) sb_options.$(OBJEXT) \
    sb_logger.$(OBJEXT)  sb_histogram.$(OBJEXT) \
    sb_rand.$(OBJEXT) sb_thread.$(OBJEXT) sb_barrier.$(OBJEXT) \
    sb_lua.$(OBJEXT) sb_util.$(OBJEXT) sb_counter.$(OBJEXT)
sysbench_OBJECTS = $(am_sysbench_OBJECTS)
am__DEPENDENCIES_1 =
#am__DEPENDENCIES_2 = drivers/mysql/libsbmysql.a \
#   $(am__DEPENDENCIES_1)
#am__DEPENDENCIES_3 = drivers/pgsql/libsbpgsql.a \
#   $(am__DEPENDENCIES_1)
sysbench_DEPENDENCIES = tests/fileio/libsbfileio.a \
    tests/threads/libsbthreads.a tests/memory/libsbmemory.a \
    tests/cpu/libsbcpu.a tests/mutex/libsbmutex.a \
    $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \
    $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
am__v_lt_1 = 
sysbench_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
    $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
    $(sysbench_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_$(V))
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo "  GEN     " $@;
am__v_GEN_1 = 
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
am__v_at_1 = 
DEFAULT_INCLUDES = -I. -I$(top_builddir)/config
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/sysbench.Po ./$(DEPDIR)/db_driver.Po  \
    ./$(DEPDIR)/sb_barrier.Po ./$(DEPDIR)/sb_counter.Po \
    ./$(DEPDIR)/sb_histogram.Po ./$(DEPDIR)/sb_logger.Po \
    ./$(DEPDIR)/sb_lua.Po ./$(DEPDIR)/sb_options.Po \
    ./$(DEPDIR)/sb_rand.Po ./$(DEPDIR)/sb_thread.Po \
    ./$(DEPDIR)/sb_timer.Po ./$(DEPDIR)/sb_util.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
    $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
    $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
    $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_$(V))
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
am__v_CC_0 = @echo "  CC      " $@;
am__v_CC_1 = 
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
    $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
    $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
am__v_CCLD_0 = @echo "  CCLD    " $@;
am__v_CCLD_1 = 
SOURCES = $(sysbench_SOURCES)
DIST_SOURCES = $(sysbench_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
    ctags-recursive dvi-recursive html-recursive info-recursive \
    install-data-recursive install-dvi-recursive \
    install-exec-recursive install-html-recursive \
    install-info-recursive install-pdf-recursive \
    install-ps-recursive install-recursive installcheck-recursive \
    installdirs-recursive pdf-recursive ps-recursive \
    tags-recursive uninstall-recursive
am__can_run_installinfo = \
  case $$AM_UPDATE_INFO_DIR in \
    n|no|NO) false;; \
    *) (install-info --version) >/dev/null 2>&1;; \
  esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
  distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
  $(RECURSIVE_TARGETS) \
  $(RECURSIVE_CLEAN_TARGETS) \
  $(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
    distdir distdir-am
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates.  Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
  BEGIN { nonempty = 0; } \
  { items[$$0] = 1; nonempty = 1; } \
  END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique.  This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
  dir0=`pwd`; \
  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
  sed_rest='s,^[^/]*/*,,'; \
  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
  sed_butlast='s,/*[^/]*$$,,'; \
  while test -n "$$dir1"; do \
    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
    if test "$$first" != "."; then \
      if test "$$first" = ".."; then \
        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
      else \
        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
        if test "$$first2" = "$$first"; then \
          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
        else \
          dir2="../$$dir2"; \
        fi; \
        dir0="$$dir0"/"$$first"; \
      fi; \
    fi; \
    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
  done; \
  reldir="$$dir2"
ACLOCAL = ${SHELL} '/home/admin1/sysbench_main/config/missing' aclocal-1.16
AMTAR = $${TAR-tar}
AM_CFLAGS = -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -Wvla
AM_CPPFLAGS =  -I$(top_srcdir)/src -I$(abs_top_builddir)/third_party/lua/inc -I$(abs_top_builddir)/third_party/concurrency_kit/include -DDATADIR=\"$(pkgdatadir)\" \
    -DLIBDIR=\"$(pkglibdir)\"
AM_DEFAULT_VERBOSITY = 1
AM_LDFLAGS = 
AR = /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/bin/ar
AUTOCONF = ${SHELL} '/home/admin1/sysbench_main/config/missing' autoconf
AUTOHEADER = ${SHELL} '/home/admin1/sysbench_main/config/missing' autoheader
AUTOMAKE = ${SHELL} '/home/admin1/sysbench_main/config/missing' automake-1.16
AWK = mawk
CC = /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/bin/clang-18 --target=wasm32-wasi-threads
CCDEPMODE = depmode=gcc3
CFLAGS = -O3 -funroll-loops --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot -pthread -fexceptions -DCK_MD_TSO -msimd128 -mnontrapping-fptoint -mbulk-memory
CK_CFLAGS = -I$(abs_top_builddir)/third_party/concurrency_kit/include
CK_CONFIGURE_FLAGS = 
CK_LIBS = /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot/lib/libck.a
CPP = /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/bin/clang-18 --target=wasm32-wasi-threads --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot
CPPFLAGS = -D_GNU_SOURCE -I/usr/local/include
CSCOPE = cscope
CTAGS = ctags
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DLLTOOL = false
DSYMUTIL = 
DUMPBIN = :
ECHO_C = 
ECHO_N = -n
ECHO_T = 
EGREP = /usr/bin/grep -E
ETAGS = etags
EXEEXT = 
FGREP = /usr/bin/grep -F
GREP = /usr/bin/grep
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/bin/clang-18
LDFLAGS = --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot -pthread -fexceptions -L/usr/local/lib
# Additional linker flags
LINKER_FLAGS = $(EM_FLAGS) -pthread  \
    -Wl,--shared-memory \
    -Wl,--export=__heap_base,--export=__data_end \
    -Wl,--export=malloc -Wl,--export=free \
    -Wl,--import-memory
LIBOBJS = 
LIBS = -lm 
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO = 
LN_S = ln -s
LTLIBOBJS = 
LT_SYS_LIBRARY_PATH = 
LUA_CFLAGS = -I$(abs_top_builddir)/third_party/lua/inc
LUA_LDFLAGS = 
LUA_LIBS = /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot/lib/liblua.a
MAKEINFO = ${SHELL} '/home/admin1/sysbench_main/config/missing' makeinfo
MANIFEST_TOOL = :
MKDIR_P = /usr/bin/mkdir -p
MYSQL_CFLAGS = 
MYSQL_LIBS = 
NM = nm
NMEDIT = 
OBJDUMP = objdump
OBJEXT = o
OTOOL = 
OTOOL64 = 
PACKAGE = sysbench
PACKAGE_BUGREPORT = https://github.com/akopytov/sysbench/issues
PACKAGE_NAME = sysbench
PACKAGE_STRING = sysbench 1.1.0
PACKAGE_TARNAME = sysbench
PACKAGE_URL = https://github.com/akopytov/sysbench
PACKAGE_VERSION = 1.1.0
PATH_SEPARATOR = :
PGSQL_CFLAGS = 
PGSQL_LIBS = 
PKG_CONFIG = /usr/bin/pkg-config
PKG_CONFIG_LIBDIR = 
PKG_CONFIG_PATH = /usr/lib/x86_64-linux-gnu/pkgconfig
PRTDIAG = 
PTHREAD_CC = /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/bin/clang-18 --target=wasm32-wasi-threads
PTHREAD_CFLAGS = 
PTHREAD_LIBS = 
RANLIB = ranlib
SB_GIT_SHA = -2ca9e3f
SED = /usr/bin/sed
SET_MAKE = 
SHELL = /bin/bash
STRIP = strip
USE_MYSQL = 
USE_PGSQL = 
VERSION = 1.1.0
abs_builddir = /home/admin1/sysbench_main/src
abs_srcdir = /home/admin1/sysbench_main/src
abs_top_builddir = /home/admin1/sysbench_main
abs_top_srcdir = /home/admin1/sysbench_main
ac_ct_AR = /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/bin/ar
ac_ct_CC = 
ac_ct_DUMPBIN = link -dump
acx_pthread_config = 
am__include = include
am__leading_dot = .
am__quote = 
am__tar = $${TAR-tar} chof - "$$tardir"
am__untar = $${TAR-tar} xf -
bindir = ${exec_prefix}/bin
build = x86_64-pc-linux-gnux32
build_alias = 
build_cpu = x86_64
build_os = linux-gnux32
build_vendor = pc
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = wasm32-unknown-wasi
host_alias = wasm32-unknown-wasi
host_cpu = wasm32
host_os = wasi
host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /home/admin1/sysbench_main/config/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = $(MKDIR_P)
mysqlconfig = 
oldincludedir = /usr/include
pdfdir = ${docdir}
pgconfig = 
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
runstatedir = ${localstatedir}/run
sb_have_pkg_config = yes
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target = wasm32-unknown-wasi
target_alias = 
target_cpu = wasm32
target_os = wasi
target_vendor = unknown
top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
SUBDIRS = drivers tests lua .

# The following check will be extended as new database drivers will be added
#mysql_ldadd = drivers/mysql/libsbmysql.a $(MYSQL_LIBS)
#pgsql_ldadd = drivers/pgsql/libsbpgsql.a $(PGSQL_LIBS)
sysbench_SOURCES = sysbench.c sysbench.h sb_timer.c sb_timer.h \
sb_options.c sb_options.h sb_logger.c sb_logger.h sb_list.h db_driver.h \
db_driver.c sb_histogram.c sb_histogram.h sb_rand.c sb_rand.h \
sb_thread.c sb_thread.h sb_barrier.c sb_barrier.h sb_lua.c \
sb_ck_pr.h \
sb_lua.h sb_util.h sb_util.c sb_counter.h sb_counter.c \
lua/internal/sysbench.lua.h lua/internal/sysbench.sql.lua.h \
lua/internal/sysbench.rand.lua.h lua/internal/sysbench.cmdline.lua.h  \
lua/internal/sysbench.histogram.lua.h \
xoroshiro128plus.h

sysbench_LDADD = tests/fileio/libsbfileio.a tests/threads/libsbthreads.a \
    tests/memory/libsbmemory.a tests/cpu/libsbcpu.a \
    tests/mutex/libsbmutex.a \
    $(mysql_ldadd) $(pgsql_ldadd) \
    $(LUA_LIBS) $(CK_LIBS)

sysbench_LDFLAGS = $(mysql_ldflags) \
    $(pgsql_ldflags) $(LUA_LDFLAGS)

all: all-recursive

.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
    @for dep in $?; do \
      case '$(am__configure_deps)' in \
        *$$dep*) \
          ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
            && { if test -f $@; then exit 0; else break; fi; }; \
          exit 1;; \
      esac; \
    done; \
    echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
    $(am__cd) $(top_srcdir) && \
      $(AUTOMAKE) --foreign src/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    @case '$?' in \
      *config.status*) \
        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
      *) \
        echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
        cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
    esac;

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh

$(top_srcdir)/configure:  $(am__configure_deps)
    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
    @$(NORMAL_INSTALL)
    @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
    if test -n "$$list"; then \
      echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
      $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
    fi; \
    for p in $$list; do echo "$$p $$p"; done | \
    sed 's/$(EXEEXT)$$//' | \
    while read p p1; do if test -f $$p \
     || test -f $$p1 \
      ; then echo "$$p"; echo "$$p"; else :; fi; \
    done | \
    sed -e 'p;s,.*/,,;n;h' \
        -e 's|.*|.|' \
        -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
    sed 'N;N;N;s,\n, ,g' | \
    $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
      { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
        if ($$2 == $$4) files[d] = files[d] " " $$1; \
        else { print "f", $$3 "/" $$4, $$1; } } \
      END { for (d in files) print "f", d, files[d] }' | \
    while read type dir files; do \
        if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
        test -z "$$files" || { \
        echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
        $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
        } \
    ; done

uninstall-binPROGRAMS:
    @$(NORMAL_UNINSTALL)
    @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
    files=`for p in $$list; do echo "$$p"; done | \
      sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
          -e 's/$$/$(EXEEXT)/' \
    `; \
    test -n "$$list" || exit 0; \
    echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
    cd "$(DESTDIR)$(bindir)" && rm -f $$files

clean-binPROGRAMS:
    @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
    echo " rm -f" $$list; \
    rm -f $$list || exit $$?; \
    test -n "$(EXEEXT)" || exit 0; \
    list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
    echo " rm -f" $$list; \
    rm -f $$list

sysbench$(EXEEXT): $(sysbench_OBJECTS) $(sysbench_DEPENDENCIES) $(EXTRA_sysbench_DEPENDENCIES) 
    @rm -f sysbench$(EXEEXT)
    $(AM_V_CCLD)$(sysbench_LINK) $(sysbench_OBJECTS) $(sysbench_LDADD) $(LIBS)

mostlyclean-compile:
    -rm -f *.$(OBJEXT)

distclean-compile:
    -rm -f *.tab.c

include ./$(DEPDIR)/db_driver.Po # am--include-marker
include ./$(DEPDIR)/sb_barrier.Po # am--include-marker
include ./$(DEPDIR)/sb_counter.Po # am--include-marker
include ./$(DEPDIR)/sb_histogram.Po # am--include-marker
include ./$(DEPDIR)/sb_logger.Po # am--include-marker
include ./$(DEPDIR)/sb_lua.Po # am--include-marker
include ./$(DEPDIR)/sb_options.Po # am--include-marker
include ./$(DEPDIR)/sb_rand.Po # am--include-marker
include ./$(DEPDIR)/sb_thread.Po # am--include-marker
include ./$(DEPDIR)/sb_timer.Po # am--include-marker
include ./$(DEPDIR)/sb_util.Po # am--include-marker
include ./$(DEPDIR)/sysbench.Po # am--include-marker

$(am__depfiles_remade):
    @$(MKDIR_P) $(@D)
    @echo '# dummy' >$@-t && $(am__mv) $@-t $@

am--depfiles: $(am__depfiles_remade)

.c.o:
    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
#   $(AM_V_CC)source='$<' object='$@' libtool=no \
#   DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
#   $(AM_V_CC_no)$(COMPILE) -c -o $@ $<

.c.obj:
    $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
#   $(AM_V_CC)source='$<' object='$@' libtool=no \
#   DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
#   $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`

.c.lo:
    $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
    $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
#   $(AM_V_CC)source='$<' object='$@' libtool=yes \
#   DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
#   $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $<

mostlyclean-libtool:
    -rm -f *.lo

clean-libtool:
    -rm -rf .libs _libs

# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
#     (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
    @fail=; \
    if $(am__make_keepgoing); then \
      failcom='fail=yes'; \
    else \
      failcom='exit 1'; \
    fi; \
    dot_seen=no; \
    target=`echo $@ | sed s/-recursive//`; \
    case "$@" in \
      distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
      *) list='$(SUBDIRS)' ;; \
    esac; \
    for subdir in $$list; do \
      echo "Making $$target in $$subdir"; \
      if test "$$subdir" = "."; then \
        dot_seen=yes; \
        local_target="$$target-am"; \
      else \
        local_target="$$target"; \
      fi; \
      ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
      || eval $$failcom; \
    done; \
    if test "$$dot_seen" = "no"; then \
      $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
    fi; test -z "$$fail"

ID: $(am__tagged_files)
    $(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags

tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    set x; \
    here=`pwd`; \
    if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
      include_option=--etags-include; \
      empty_fix=.; \
    else \
      include_option=--include; \
      empty_fix=; \
    fi; \
    list='$(SUBDIRS)'; for subdir in $$list; do \
      if test "$$subdir" = .; then :; else \
        test ! -f $$subdir/TAGS || \
          set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
      fi; \
    done; \
    $(am__define_uniq_tagged_files); \
    shift; \
    if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
      test -n "$$unique" || unique=$$empty_fix; \
      if test $$# -gt 0; then \
        $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
          "$$@" $$unique; \
      else \
        $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
          $$unique; \
      fi; \
    fi
ctags: ctags-recursive

CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
    $(am__define_uniq_tagged_files); \
    test -z "$(CTAGS_ARGS)$$unique" \
      || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
         $$unique

GTAGS:
    here=`$(am__cd) $(top_builddir) && pwd` \
      && $(am__cd) $(top_srcdir) \
      && gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-recursive

cscopelist-am: $(am__tagged_files)
    list='$(am__tagged_files)'; \
    case "$(srcdir)" in \
      [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
      *) sdir=$(subdir)/$(srcdir) ;; \
    esac; \
    for i in $$list; do \
      if test -f "$$i"; then \
        echo "$(subdir)/$$i"; \
      else \
        echo "$$sdir/$$i"; \
      fi; \
    done >> $(top_builddir)/cscope.files

distclean-tags:
    -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
    $(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
    @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
    topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
    list='$(DISTFILES)'; \
      dist_files=`for file in $$list; do echo $$file; done | \
      sed -e "s|^$$srcdirstrip/||;t" \
          -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
    case $$dist_files in \
      */*) $(MKDIR_P) `echo "$$dist_files" | \
               sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
               sort -u` ;; \
    esac; \
    for file in $$dist_files; do \
      if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
      if test -d $$d/$$file; then \
        dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
        if test -d "$(distdir)/$$file"; then \
          find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
        fi; \
        if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
          cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
          find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
        fi; \
        cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
      else \
        test -f "$(distdir)/$$file" \
        || cp -p $$d/$$file "$(distdir)/$$file" \
        || exit 1; \
      fi; \
    done
    @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
      if test "$$subdir" = .; then :; else \
        $(am__make_dryrun) \
          || test -d "$(distdir)/$$subdir" \
          || $(MKDIR_P) "$(distdir)/$$subdir" \
          || exit 1; \
        dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
        $(am__relativize); \
        new_distdir=$$reldir; \
        dir1=$$subdir; dir2="$(top_distdir)"; \
        $(am__relativize); \
        new_top_distdir=$$reldir; \
        echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
        echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
        ($(am__cd) $$subdir && \
          $(MAKE) $(AM_MAKEFLAGS) \
            top_distdir="$$new_top_distdir" \
            distdir="$$new_distdir" \
        am__remove_distdir=: \
        am__skip_length_check=: \
        am__skip_mode_fix=: \
            distdir) \
          || exit 1; \
      fi; \
    done
check-am: all-am
check: check-recursive
all-am: Makefile $(PROGRAMS)
installdirs: installdirs-recursive
installdirs-am:
    for dir in "$(DESTDIR)$(bindir)"; do \
      test -z "$$dir" || $(MKDIR_P) "$$dir"; \
    done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive

install-am: all-am
    @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-recursive
install-strip:
    if test -z '$(STRIP)'; then \
      $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
        install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
          install; \
    else \
      $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
        install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
        "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
    fi
mostlyclean-generic:

clean-generic:

distclean-generic:
    -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
    -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)

maintainer-clean-generic:
    @echo "This command is intended for maintainers to use"
    @echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive

clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am

distclean: distclean-recursive
        -rm -f ./$(DEPDIR)/db_driver.Po
    -rm -f ./$(DEPDIR)/sb_barrier.Po
    -rm -f ./$(DEPDIR)/sb_counter.Po
    -rm -f ./$(DEPDIR)/sb_histogram.Po
    -rm -f ./$(DEPDIR)/sb_logger.Po
    -rm -f ./$(DEPDIR)/sb_lua.Po
    -rm -f ./$(DEPDIR)/sb_options.Po
    -rm -f ./$(DEPDIR)/sb_rand.Po
    -rm -f ./$(DEPDIR)/sb_thread.Po
    -rm -f ./$(DEPDIR)/sb_timer.Po
    -rm -f ./$(DEPDIR)/sb_util.Po
    -rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
    distclean-tags

dvi: dvi-recursive

dvi-am:

html: html-recursive

html-am:

info: info-recursive

info-am:

install-data-am:

install-dvi: install-dvi-recursive

install-dvi-am:

install-exec-am: install-binPROGRAMS

install-html: install-html-recursive

install-html-am:

install-info: install-info-recursive

install-info-am:

install-man:

install-pdf: install-pdf-recursive

install-pdf-am:

install-ps: install-ps-recursive

install-ps-am:

installcheck-am:

maintainer-clean: maintainer-clean-recursive
        -rm -f ./$(DEPDIR)/db_driver.Po
    -rm -f ./$(DEPDIR)/sb_barrier.Po
    -rm -f ./$(DEPDIR)/sb_counter.Po
    -rm -f ./$(DEPDIR)/sb_histogram.Po
    -rm -f ./$(DEPDIR)/sb_logger.Po
    -rm -f ./$(DEPDIR)/sb_lua.Po
    -rm -f ./$(DEPDIR)/sb_options.Po
    -rm -f ./$(DEPDIR)/sb_rand.Po
    -rm -f ./$(DEPDIR)/sb_thread.Po
    -rm -f ./$(DEPDIR)/sb_timer.Po
    -rm -f ./$(DEPDIR)/sb_util.Po
    -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-recursive

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
    mostlyclean-libtool

pdf: pdf-recursive

pdf-am:

ps: ps-recursive

ps-am:

uninstall-am: uninstall-binPROGRAMS

.MAKE: $(am__recursive_targets) install-am install-strip

.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
    am--depfiles check check-am clean clean-binPROGRAMS \
    clean-generic clean-libtool cscopelist-am ctags ctags-am \
    distclean distclean-compile distclean-generic \
    distclean-libtool distclean-tags distdir dvi dvi-am html \
    html-am info info-am install install-am install-binPROGRAMS \
    install-data install-data-am install-dvi install-dvi-am \
    install-exec install-exec-am install-html install-html-am \
    install-info install-info-am install-man install-pdf \
    install-pdf-am install-ps install-ps-am install-strip \
    installcheck installcheck-am installdirs installdirs-am \
    maintainer-clean maintainer-clean-generic mostlyclean \
    mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
    pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
    uninstall-binPROGRAMS

.PRECIOUS: Makefile

Please check the makefile and suggest me to solve this issue. or do i need to add any extra flags for my iwasm. Thanks in advance.

yamt commented 1 month ago

i guess you need to enable at least: -DWAMR_BUILD_LIB_WASI_THREADS=1 -DWAMR_BUILD_LIBC_WASI=1

subhakr commented 1 month ago

i guess you need to enable at least: -DWAMR_BUILD_LIB_WASI_THREADS=1 -DWAMR_BUILD_LIBC_WASI=1

make CFLAGS="-O3 -funroll-loops --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot -pthread -fexceptions -D_WASI_EMULATED_PROCESS_CLOCKS -DWAMR_BUILD_LIB_WASI_THREADS=1 -DWAMR_BUILD_LIBC_WASI=1 -matomics -mbulk-memory" LDFLAGS="--sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot \
              -pthread -fexceptions -Wl,--max-memory=1769472 -z stack-size=32768 \
              -Wl,--shared-memory -g -lwasi-emulated-mman -Wl,--export-all \
              -Wl,--no-entry,--strip-all -Wl,--export=__main_argc_argv \
              -Wl,--export=__heap_base -Wl,--export=__data_end \
              -pthread -lwasi-emulated-process-clocks"

I have included like this in my make command but still i am getting this issue

admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/sysbench_main$ /home/admin1/Downloads/runtimes_wasm/iwasm2 src/sysbench
WASM module load failed: invalid section id
admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/sysbench_main$ wasm-validate src/sysbench
0000db5: error: memory may not be shared: threads not allowed

suggest me if i am doing wrong

and this is my linking stage

libtool: link: /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/bin/clang-18 --target=wasm32-wasi-threads -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -Wvla -O3 -funroll-loops --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot -pthread -fexceptions -D_WASI_EMULATED_PROCESS_CLOCKS -DWAMR_BUILD_LIB_WASI_THREADS=1 -DWAMR_BUILD_LIBC_WASI=1 -matomics -mbulk-memory --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot -pthread -fexceptions -Wl,--max-memory=1769472 -z stack-size=32768 -Wl,--shared-memory -g -Wl,--export-all -Wl,--no-entry -Wl,--strip-all -Wl,--export=__main_argc_argv -Wl,--export=__heap_base -Wl,--export=__data_end -pthread -o sysbench sysbench.o db_driver.o sb_timer.o sb_options.o sb_logger.o sb_histogram.o sb_rand.o sb_thread.o sb_barrier.o sb_lua.o sb_util.o sb_counter.o  -lwasi-emulated-mman -lwasi-emulated-process-clocks tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/mutex/libsbmutex.a /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot/lib/liblua.a /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot/lib/libck.a -lm -pthread
make[2]: Leaving directory '/home/admin1/sysbench_main/src'
make[1]: Leaving directory '/home/admin1/sysbench_main/src'
Making all in tests
make[1]: Entering directory '/home/admin1/sysbench_main/tests'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/admin1/sysbench_main/tests'
make[1]: Entering directory '/home/admin1/sysbench_main'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/admin1/sysbench_main'
yamt commented 1 month ago

"-DWAMR_BUILD_LIB_WASI_THREADS=1 -DWAMR_BUILD_LIBC_WASI=1" are build options for wamr. not your app.

subhakr commented 1 month ago

"-DWAMR_BUILD_LIB_WASI_THREADS=1 -DWAMR_BUILD_LIBC_WASI=1" are build options for wamr.

Screenshot from 2024-08-01 16-49-18 iwasm_m64_e

and i am compiling with wasi-sdk23 version from initial stage i have enabled those two flags.

any other suggestions.

yamt commented 1 month ago

can you share your wasm module?

subhakr commented 1 month ago

can you share your wasm module? iwasm.zip

yamt commented 1 month ago

i meant src/sysbench.

subhakr commented 1 month ago

i meant src/sysbench.

yeah sure..

sysbench.zip

yamt commented 1 month ago

i meant src/sysbench.

yeah sure..

sysbench.zip

as this module seems using exception-handling, you need iwasm built with: -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_EXCE_HANDLING=1

also, i guess this module was built with an older setjmp/longjmp translation. libsetjmp.a shipped with wasi-sdk only supports the latest (unreleased) version of llvm.

subhakr commented 1 month ago

i meant src/sysbench.

yeah sure.. sysbench.zip

as this module seems using exception-handling, you need iwasm built with: -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_EXCE_HANDLING=1

also, i guess this module was built with an older setjmp/longjmp translation. libsetjmp.a shipped with wasi-sdk only supports the latest (unreleased) version of llvm.

Screenshot from 2024-08-01 19-16-23 image

After including these flags have the same issue.

and while building this module i did't face any issue with libsetjmp.a. so my assumption is i don't have issue with this library.

any other suggestions for this issue.

yamt commented 1 month ago

i meant src/sysbench.

yeah sure.. sysbench.zip

as this module seems using exception-handling, you need iwasm built with: -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_EXCE_HANDLING=1 also, i guess this module was built with an older setjmp/longjmp translation. libsetjmp.a shipped with wasi-sdk only supports the latest (unreleased) version of llvm.

Screenshot from 2024-08-01 19-16-23 image

After including these flags have the same issue.

have you rebuilt it after changing cmake options?

and while building this module i did't face any issue with libsetjmp.a. so my assumption is i don't have issue with this library.

your sysbench imports functions like env:saveSetjmp, which is a sign of setjmp issues.

any other suggestions for this issue.

subhakr commented 1 month ago

image

after running below command while doing make i am getting above error(PFA) cmake .. -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_EXCE_HANDLING=1

i have tried with cmake .. -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_EXCE_HANDLING=0 with this command iwasm is generating without any error i think exception is not yet implemented. Am i right? and for setjump i am not seeing any issue.For your reference i have attached the log.txt file. log.txt

yamt commented 1 month ago

image

after running below command while doing make i am getting above error(PFA) cmake .. -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_EXCE_HANDLING=1

i have tried with cmake .. -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_EXCE_HANDLING=0 with this command iwasm is generating without any error i think exception is not yet implemented. Am i right?

i don't know what wamr version you are using. in the latest version it works.

and for setjump i am not seeing any issue.For your reference i have attached the log.txt file. log.txt

i don't understand how this log is related to the sysbench binary you uploaded. i suspect it's a different module. anyway, if you don't trust me, it isn't my problem.

subhakr commented 1 month ago

No i trust you thats why i am asking you to suggest me.

yeah with latest one its working for exception flag.

admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/Documents/wasm-micro-runtime/product-mini/platforms/linux/build$ ./iwasm --version
iwasm 2.1.1
admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/Documents/wasm-micro-runtime/product-mini/platforms/linux/build$ ./iwasm /home/admin1/sysbench_main/src/sysbench
WASM module load failed: invalid limits flags
admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/Documents/wasm-micro-runtime/product-mini/platforms/linux/build$ wasm-validate /home/admin1/sysbench_main/src/sysbench
0000db5: error: memory may not be shared: threads not allowed

So now you are saying like problem with setjump library.

i don't understand how this log is related to the sysbench binary you uploaded. i suspect it's a different module.

sysbench.wasm and sysbench both are same only just i have converted to .wasm from sysbench module

if you don't mind can i get brief solution from your side regarding setjump like how can i see those errors and how to solve those issues.

Thanks in advance.

yamt commented 1 month ago

No i trust you thats why i am asking you to suggest me.

yeah with latest one its working for exception flag.


admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/Documents/wasm-micro-runtime/product-mini/platforms/linux/build$ ./iwasm --version
iwasm 2.1.1
admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/Documents/wasm-micro-runtime/product-mini/platforms/linux/build$ ./iwasm /home/admin1/sysbench_main/src/sysbench
WASM module load failed: invalid limits flags

have you enabled -DWAMR_BUILD_LIB_WASI_THREADS=1?

admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/Documents/wasm-micro-runtime/product-mini/platforms/linux/build$ wasm-validate /home/admin1/sysbench_main/src/sysbench 0000db5: error: memory may not be shared: threads not allowed

wasm-validate by default doesn't accept threads or exceptions.

So now you are saying like problem with setjump library.

i don't understand how this log is related to the sysbench binary you uploaded. i suspect it's a different module.

sysbench.wasm and sysbench both are same only just i have converted to .wasm from sysbench module

log.txt contains a lot of import resolution errors. otoh, sysbench module you provided doesn't have those imports. (thus errors in log.txt can't happen)

if you don't mind can i get brief solution from your side regarding setjump like how can i see those errors and how to solve those issues.

investigate the module (eg. by wasm2wat) and see what it imports. "saveSetjmp" etc are what's used to implement setjmp/longjmp for the old versions of emscripten. it isn't compatible with wasi-sdk libsetjmp.a.

here's an example script to build micropython, which is an application using setjmp/longjmp, with wasi-sdk libsetjmp.a. https://github.com/yamt/micropython/blob/unix-wasi/ports/unix/build-wasi.sh at this point, you need to use an unreleased version of llvm.

Thanks in advance.

subhakr commented 1 month ago

have you enabled -DWAMR_BUILD_LIB_WASI_THREADS=1?

yeah i have enabled this flags and recompiled but still have same issue.

admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/Documents/wasm-micro-runtime/product-mini/platforms/linux/build$ ./iwasm /home/admin1/sysbench_main/src/sysbench
WASM module load failed: invalid limits flags
admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/Documents/wasm-micro-runtime/product-mini/platforms/linux/build$ wasm-validate /home/admin1/sysbench_main/src/sysbench
0000db5: error: memory may not be shared: threads not allowed

investigate the module (eg. by wasm2wat) and see what it imports.

yeah i have used wasm-objdump command to see import functions. just for your reference i have attached this file. From this file only i got to know i am importing setjmp and longjmp functions.

import_functions.txt

it isn't compatible with wasi-sdk libsetjmp.a.

So upto get the unreleased version of LLVM means clang-19 that too it should become part for wasi-sdk , i can't move further for sysbench module. Am i right? Orelse any other methods are there to solve this issue. Please help to solve this issue if it's possible.

And am i facing issue with libsetjmp.a only or any other issues are there with my sysbench module. Pls let me know if its there any.

yamt commented 1 month ago

investigate the module (eg. by wasm2wat) and see what it imports.

yeah i have used wasm-objdump command to see import functions. just for your reference i have attached this file. From this file only i got to know i am importing setjmp and longjmp functions.

import_functions.txt

it isn't compatible with wasi-sdk libsetjmp.a.

So upto get the unreleased version of LLVM means clang-19 that too it should become part for wasi-sdk , i can't move further for sysbench module. Am i right? Orelse any other methods are there to solve this issue. Please help to solve this issue if it's possible.

you can install llvm-19 by yourself and use it with wasi-sdk. (as it's done in the micropython script shown above.)

if it's too cumbersome for you, maybe you need to wait for a future release of wasi-sdk with llvm-19. (probably in this summer.)

And am i facing issue with libsetjmp.a only or any other issues are there with my sysbench module. Pls let me know if its there any.

your sysbench module seems dying before actually using setjmp/longjmp. i guess it has more issues. but i don't know what they are.

spacetanuki% iwasm sysbench
[16:34:23:509 - 1108F2600]: warning: failed to link import function (env, __wasm_longjmp)
[16:34:23:509 - 1108F2600]: warning: failed to link import function (env, saveSetjmp)
[16:34:23:509 - 1108F2600]: warning: failed to link import function (env, getTempRet0)
[16:34:23:509 - 1108F2600]: warning: failed to link import function (env, testSetjmp)
Exception: out of bounds memory access
spacetanuki% wasm-opt --translate-to-exnref --enable-threads --enable-exception-handling --enable-bulk-memory -o sysbench.exnref sysbench
spacetanuki% toywasm --allow-unresolved-functions --wasi sysbench.exnref
Error: PTHREAD_SCOPE_SYSTEM is enabled so please add pthread_attr_setscope(&sb_thread_attr,PTHREAD_SCOPE_SYSTEM) function subha 
spacetanuki% 
subhakr commented 1 month ago
spacetanuki% iwasm sysbench
[16:34:23:509 - 1108F2600]: warning: failed to link import function (env, __wasm_longjmp)
[16:34:23:509 - 1108F2600]: warning: failed to link import function (env, saveSetjmp)
[16:34:23:509 - 1108F2600]: warning: failed to link import function (env, getTempRet0)
[16:34:23:509 - 1108F2600]: warning: failed to link import function (env, testSetjmp)
Exception: out of bounds memory access
spacetanuki% wasm-opt --translate-to-exnref --enable-threads --enable-exception-handling --enable-bulk-memory -o sysbench.exnref sysbench
spacetanuki% toywasm --allow-unresolved-functions --wasi sysbench.exnref
Error: PTHREAD_SCOPE_SYSTEM is enabled so please add pthread_attr_setscope(&sb_thread_attr,PTHREAD_SCOPE_SYSTEM) function subha 
spacetanuki% 

before giving preference to llvm-19, i would like to solve the remaing issues. from above CLI i can see pthread error. Like this how can i see the remaining errors. Can i get the CLI commnads to list out the issues with my sysbnech module.

yamt commented 1 month ago

Can i get the CLI commnads to list out the issues with my sysbnech module.

build iwasm with

cmake -DWAMR_BUILD_LIBC_BUILTIN=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_EXCE_HANDLING=1 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_LIBC_WASI=1 -DWAMR_BUILD_LIB_WASI_THREADS=1 ..
spacetanuki% iwasm sysbench
[17:12:01:491 - 10A6BF600]: warning: failed to link import function (env, __wasm_longjmp)
[17:12:01:491 - 10A6BF600]: warning: failed to link import function (env, saveSetjmp)
[17:12:01:491 - 10A6BF600]: warning: failed to link import function (env, getTempRet0)
[17:12:01:491 - 10A6BF600]: warning: failed to link import function (env, testSetjmp)
Error: PTHREAD_SCOPE_SYSTEM is enabled so please add pthread_attr_setscope(&sb_thread_attr,PTHREAD_SCOPE_SYSTEM) function subha 
spacetanuki% 

(it seems you get "out of bounds memory access" instead if you enable -DWAMR_BUILD_MEMORY64=1. i dunno why.)

i'm using macOS. but i guess it's same for linux.

subhakr commented 1 month ago

Hmm , i can see those errors gimme some time to resolve these errors.

subhakr commented 1 month ago

you can install llvm-19 by yourself and use it with wasi-sdk. (as it's done in the micropython script shown above.)

Hi, i would like install LLVM-19 May I get the steps to install this LLVM-19 as i told you i have resolved my application issues. now i am getting only following issues.

admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/sysbench_main$ /home/admin1/Documents/wasm-micro-runtime/product-mini/platforms/linux/build/iwasm  src/sysbench
[02:58:52:668 - 70933A067740]: warning: failed to link import function (env, __wasm_longjmp)
[02:58:52:668 - 70933A067740]: warning: failed to link import function (env, saveSetjmp)
[02:58:52:668 - 70933A067740]: warning: failed to link import function (env, getTempRet0)
[02:58:52:668 - 70933A067740]: warning: failed to link import function (env, testSetjmp)
Attempting to allocate 1064960 bytes of memory...
sysbench 1.1.0-2ca9e3f (using Lua Lua 5.3)

Exception: failed to call unlinked import function (env, saveSetjmp)