Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile bdwgc for emscripten #163

Closed
intrigus opened this issue May 26, 2017 · 18 comments
Closed

Can't compile bdwgc for emscripten #163

intrigus opened this issue May 26, 2017 · 18 comments

Comments

@intrigus
Copy link

Hello, I'm trying to compile bdwgc for emscripten, but it fails during compilation.
If you need more information I'm happy to provide it.

This is the error:

os_dep.c:1258:9: error: None of HEURISTIC* and *STACKBOTTOM defined!
#       error None of HEURISTIC* and *STACKBOTTOM defined!
        ^

Used versions and more information:

emcc --version

emcc (Emscripten gcc/clang-like replacement) 1.37.8 (commit df8796f8b4ef113dd5b6724c2e374d655487f61c)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The bdwgc version is 7.6.0.
I'm running the following commands on my Mac.

$: emconfigure ./configure --without-threads --disable-threads
$: emmake make
depbase=`echo allchblk.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT allchblk.lo -MD -MP -MF $depbase.Tpo -c -o allchblk.lo allchblk.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT allchblk.lo -MD -MP -MF .deps/allchblk.Tpo -c allchblk.c  -fno-common -DPIC -o .libs/allchblk.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT allchblk.lo -MD -MP -MF .deps/allchblk.Tpo -c allchblk.c -o allchblk.o >/dev/null 2>&1
depbase=`echo alloc.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT alloc.lo -MD -MP -MF $depbase.Tpo -c -o alloc.lo alloc.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT alloc.lo -MD -MP -MF .deps/alloc.Tpo -c alloc.c  -fno-common -DPIC -o .libs/alloc.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT alloc.lo -MD -MP -MF .deps/alloc.Tpo -c alloc.c -o alloc.o >/dev/null 2>&1
depbase=`echo blacklst.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT blacklst.lo -MD -MP -MF $depbase.Tpo -c -o blacklst.lo blacklst.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT blacklst.lo -MD -MP -MF .deps/blacklst.Tpo -c blacklst.c  -fno-common -DPIC -o .libs/blacklst.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT blacklst.lo -MD -MP -MF .deps/blacklst.Tpo -c blacklst.c -o blacklst.o >/dev/null 2>&1
depbase=`echo checksums.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT checksums.lo -MD -MP -MF $depbase.Tpo -c -o checksums.lo checksums.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT checksums.lo -MD -MP -MF .deps/checksums.Tpo -c checksums.c  -fno-common -DPIC -o .libs/checksums.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT checksums.lo -MD -MP -MF .deps/checksums.Tpo -c checksums.c -o checksums.o >/dev/null 2>&1
depbase=`echo dbg_mlc.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT dbg_mlc.lo -MD -MP -MF $depbase.Tpo -c -o dbg_mlc.lo dbg_mlc.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT dbg_mlc.lo -MD -MP -MF .deps/dbg_mlc.Tpo -c dbg_mlc.c  -fno-common -DPIC -o .libs/dbg_mlc.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT dbg_mlc.lo -MD -MP -MF .deps/dbg_mlc.Tpo -c dbg_mlc.c -o dbg_mlc.o >/dev/null 2>&1
depbase=`echo dyn_load.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT dyn_load.lo -MD -MP -MF $depbase.Tpo -c -o dyn_load.lo dyn_load.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT dyn_load.lo -MD -MP -MF .deps/dyn_load.Tpo -c dyn_load.c  -fno-common -DPIC -o .libs/dyn_load.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT dyn_load.lo -MD -MP -MF .deps/dyn_load.Tpo -c dyn_load.c -o dyn_load.o >/dev/null 2>&1
depbase=`echo finalize.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT finalize.lo -MD -MP -MF $depbase.Tpo -c -o finalize.lo finalize.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT finalize.lo -MD -MP -MF .deps/finalize.Tpo -c finalize.c  -fno-common -DPIC -o .libs/finalize.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT finalize.lo -MD -MP -MF .deps/finalize.Tpo -c finalize.c -o finalize.o >/dev/null 2>&1
depbase=`echo gc_dlopen.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT gc_dlopen.lo -MD -MP -MF $depbase.Tpo -c -o gc_dlopen.lo gc_dlopen.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT gc_dlopen.lo -MD -MP -MF .deps/gc_dlopen.Tpo -c gc_dlopen.c  -fno-common -DPIC -o .libs/gc_dlopen.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT gc_dlopen.lo -MD -MP -MF .deps/gc_dlopen.Tpo -c gc_dlopen.c -o gc_dlopen.o >/dev/null 2>&1
depbase=`echo gcj_mlc.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT gcj_mlc.lo -MD -MP -MF $depbase.Tpo -c -o gcj_mlc.lo gcj_mlc.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT gcj_mlc.lo -MD -MP -MF .deps/gcj_mlc.Tpo -c gcj_mlc.c  -fno-common -DPIC -o .libs/gcj_mlc.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT gcj_mlc.lo -MD -MP -MF .deps/gcj_mlc.Tpo -c gcj_mlc.c -o gcj_mlc.o >/dev/null 2>&1
depbase=`echo headers.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT headers.lo -MD -MP -MF $depbase.Tpo -c -o headers.lo headers.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT headers.lo -MD -MP -MF .deps/headers.Tpo -c headers.c  -fno-common -DPIC -o .libs/headers.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT headers.lo -MD -MP -MF .deps/headers.Tpo -c headers.c -o headers.o >/dev/null 2>&1
depbase=`echo mach_dep.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT mach_dep.lo -MD -MP -MF $depbase.Tpo -c -o mach_dep.lo mach_dep.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT mach_dep.lo -MD -MP -MF .deps/mach_dep.Tpo -c mach_dep.c  -fno-common -DPIC -o .libs/mach_dep.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT mach_dep.lo -MD -MP -MF .deps/mach_dep.Tpo -c mach_dep.c -o mach_dep.o >/dev/null 2>&1
depbase=`echo malloc.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT malloc.lo -MD -MP -MF $depbase.Tpo -c -o malloc.lo malloc.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT malloc.lo -MD -MP -MF .deps/malloc.Tpo -c malloc.c  -fno-common -DPIC -o .libs/malloc.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT malloc.lo -MD -MP -MF .deps/malloc.Tpo -c malloc.c -o malloc.o >/dev/null 2>&1
depbase=`echo mallocx.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT mallocx.lo -MD -MP -MF $depbase.Tpo -c -o mallocx.lo mallocx.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT mallocx.lo -MD -MP -MF .deps/mallocx.Tpo -c mallocx.c  -fno-common -DPIC -o .libs/mallocx.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT mallocx.lo -MD -MP -MF .deps/mallocx.Tpo -c mallocx.c -o mallocx.o >/dev/null 2>&1
depbase=`echo mark.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT mark.lo -MD -MP -MF $depbase.Tpo -c -o mark.lo mark.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT mark.lo -MD -MP -MF .deps/mark.Tpo -c mark.c  -fno-common -DPIC -o .libs/mark.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT mark.lo -MD -MP -MF .deps/mark.Tpo -c mark.c -o mark.o >/dev/null 2>&1
depbase=`echo mark_rts.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT mark_rts.lo -MD -MP -MF $depbase.Tpo -c -o mark_rts.lo mark_rts.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT mark_rts.lo -MD -MP -MF .deps/mark_rts.Tpo -c mark_rts.c  -fno-common -DPIC -o .libs/mark_rts.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT mark_rts.lo -MD -MP -MF .deps/mark_rts.Tpo -c mark_rts.c -o mark_rts.o >/dev/null 2>&1
depbase=`echo misc.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT misc.lo -MD -MP -MF $depbase.Tpo -c -o misc.lo misc.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT misc.lo -MD -MP -MF .deps/misc.Tpo -c misc.c  -fno-common -DPIC -o .libs/misc.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT misc.lo -MD -MP -MF .deps/misc.Tpo -c misc.c -o misc.o >/dev/null 2>&1
depbase=`echo new_hblk.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT new_hblk.lo -MD -MP -MF $depbase.Tpo -c -o new_hblk.lo new_hblk.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT new_hblk.lo -MD -MP -MF .deps/new_hblk.Tpo -c new_hblk.c  -fno-common -DPIC -o .libs/new_hblk.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT new_hblk.lo -MD -MP -MF .deps/new_hblk.Tpo -c new_hblk.c -o new_hblk.o >/dev/null 2>&1
depbase=`echo obj_map.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT obj_map.lo -MD -MP -MF $depbase.Tpo -c -o obj_map.lo obj_map.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT obj_map.lo -MD -MP -MF .deps/obj_map.Tpo -c obj_map.c  -fno-common -DPIC -o .libs/obj_map.o
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT obj_map.lo -MD -MP -MF .deps/obj_map.Tpo -c obj_map.c -o obj_map.o >/dev/null 2>&1
depbase=`echo os_dep.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
	/bin/sh ./libtool  --tag=CC   --mode=compile /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H   -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src    -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long  -fno-strict-aliasing  -MT os_dep.lo -MD -MP -MF $depbase.Tpo -c -o os_dep.lo os_dep.c &&\
	mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  /Users/simon/Downloads/emsdk_portable/emscripten/incoming/emcc -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Wall -Wextra -Wpedantic -Wno-long-long -fno-strict-aliasing -MT os_dep.lo -MD -MP -MF .deps/os_dep.Tpo -c os_dep.c  -fno-common -DPIC -o .libs/os_dep.o
os_dep.c:1258:9: error: None of HEURISTIC* and *STACKBOTTOM defined!
#       error None of HEURISTIC* and *STACKBOTTOM defined!
        ^
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
make[1]: *** [os_dep.lo] Error 1
make: *** [all-recursive] Error 1
@ivmai
Copy link
Owner

ivmai commented May 29, 2017

Emscripten support is added in commits 7d2905e, 4eaea0a. But it seems it was not tested on mac host.
Could you please try the following fix?

diff --git a/os_dep.c b/os_dep.c
index 0f22b80..398e974 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -1179,7 +1179,7 @@ GC_INNER size_t GC_page_size = 0;
# define GET_MAIN_STACKBASE_SPECIAL
#elif !defined(BEOS) && !defined(AMIGA) && !defined(OS2)
&& !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
- && !defined(GC_OPENBSD_THREADS)
+ && !defined(STACK_NOT_SCANNED) && !defined(GC_OPENBSD_THREADS)
&& (!defined(GC_SOLARIS_THREADS) || defined(_STRICT_STDC))

# if defined(LINUX) && defined(USE_GET_STACKBASE_FOR_MAIN)

@intrigus
Copy link
Author

Compiling works with this patch.

Linking with my code also works, but fails at runtime.

Test code is from https://github.com/ivmai/bdwgc/blob/master/tests/leak_test.c saved as gc_test.c

$: emcc -Iinclude .libs/libgc.dylib gc_test.c -o test.html
warning: unresolved symbol: llvm_frameaddress

Exception at runtime:

pre-main prep time: 68 ms
printErr @ test.html:1249
test.html:1249 GC_get_stack_base failed
printErr @ test.html:1249
test.html:1249 exception thrown: abort() at Error
    at jsStackTrace (file:///Users/simon/Downloads/bdwgc/test.js:1111:13)
    at stackTrace (file:///Users/simon/Downloads/bdwgc/test.js:1128:12)
    at Object.abort (file:///Users/simon/Downloads/bdwgc/test.js:28704:44)
    at _abort (file:///Users/simon/Downloads/bdwgc/test.js:1711:22)
    at _GC_get_main_stack_base (file:///Users/simon/Downloads/bdwgc/test.js:18380:3)
    at _GC_init (file:///Users/simon/Downloads/bdwgc/test.js:17556:10)
    at _main (file:///Users/simon/Downloads/bdwgc/test.js:20012:2)
    at Object.asm._main (file:///Users/simon/Downloads/bdwgc/test.js:28339:19)
    at Object.callMain (file:///Users/simon/Downloads/bdwgc/test.js:28578:30)
    at doRun (file:///Users/simon/Downloads/bdwgc/test.js:28642:60)
printErr @ test.html:1249
test.js:227 Uncaught abort() at Error
    at jsStackTrace (file:///Users/simon/Downloads/bdwgc/test.js:1111:13)
    at stackTrace (file:///Users/simon/Downloads/bdwgc/test.js:1128:12)
    at Object.abort (file:///Users/simon/Downloads/bdwgc/test.js:28704:44)
    at _abort (file:///Users/simon/Downloads/bdwgc/test.js:1711:22)
    at _GC_get_main_stack_base (file:///Users/simon/Downloads/bdwgc/test.js:18380:3)
    at _GC_init (file:///Users/simon/Downloads/bdwgc/test.js:17556:10)
    at _main (file:///Users/simon/Downloads/bdwgc/test.js:20012:2)
    at Object.asm._main (file:///Users/simon/Downloads/bdwgc/test.js:28339:19)
    at Object.callMain (file:///Users/simon/Downloads/bdwgc/test.js:28578:30)
    at doRun (file:///Users/simon/Downloads/bdwgc/test.js:28642:60)

llvm_frameaddress is defined as this, but I'm not sure if it's even called at runtime because it's not in the stacktrace. (Maybe it has been inlined, don't know)

  function _llvm_frameaddress() {
  Module['printErr']('missing function: llvm_frameaddress'); abort(-1);
  }

Anyway thanks for you help :)
I'm not sure if this is a bug in bdwgc or in emscripten, but if it works for Unity it should probably also work for me :)

Will open an issue in emscripten, if it's indeed a problem with emscripten.
If you need anything else from I'm happy to provide it.

@ivmai
Copy link
Owner

ivmai commented May 29, 2017

Have you checked the master with the given diff or gc 7.6.0 (with the diff)?

@intrigus
Copy link
Author

I have checked bdwgc 7.6.0 with the diff
This compiles fine but fails at runtime. (As stated here #163 (comment) )
Without the patch it didn't even compile.

I'm going to try bdwgc master with the diff and also emscripten master with bdwgc master.

Any other suggestions?

@intrigus
Copy link
Author

Judging from the generated javascript GC_get_stack_base is not implemented in emscripten (GC_UNIMPLEMENTED = 3) that's why this line fails with an abort

bdwgc/os_dep.c

Line 1467 in 408ea9f

ABORT("GC_get_stack_base failed");

function _GC_get_stack_base($0) {
 $0 = $0|0;
 var $1 = 0, label = 0, sp = 0;
 sp = STACKTOP;
 STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(16|0);
 $1 = $0;
 STACKTOP = sp;
 return 3; // GC_UNIMPLEMENTED @line 1454 "os_dep.c"
}
function _GC_get_main_stack_base() {
 var $0 = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, label = 0, sp = 0;
 sp = STACKTOP;
 STACKTOP = STACKTOP + 16|0; if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(16|0);
 $0 = sp;
 $1 = (_GC_get_stack_base($0)|0); //@line 1466 "os_dep.c"
 $2 = ($1|0)!=(0); //@line 1466 "os_dep.c"
 if ($2) { // GC_get_stack_base(&sb) != GC_SUCCESS
  $3 = HEAP32[138]|0; //@line 1467 "os_dep.c"
  FUNCTION_TABLE_vi[$3 & 31](5159); //@line 1467 "os_dep.c"
  _abort(); //@line 1467 "os_dep.c" // ABORT("GC_get_stack_base failed");
  // unreachable; //@line 1467 "os_dep.c"
 } else {
  $4 = HEAP32[$0>>2]|0; //@line 1469 "os_dep.c"
  STACKTOP = sp;return ($4|0); //@line 1469 "os_dep.c"
 }
 return (0)|0;
}

@ivmai
Copy link
Owner

ivmai commented May 29, 2017

  1. Could you also please checkout commit 7d2905e and try it?
  2. Could you also please try bdwgc master + diff above + comment out GC_stackbottom = GC_get_main_stack_base() in misc.c ?

@intrigus
Copy link
Author

ad 1. 7d2905e Works fine.
ad 2. Going to try now.

@ivmai
Copy link
Owner

ivmai commented May 29, 2017

Hmm. Discard 2. Could you please try 4eaea0a ? If it works then bisect starting from 4eaea0a and finishing at gc7_6_0.

@juj
Copy link
Contributor

juj commented May 29, 2017

I recall poking a codebase that built Boehm some time earlier. Since JavaScript/asm.js/WebAssembly is not able to access the function call stack or the local data stack, it is not possible for Boehm to perform its stack walking operation to find which objects are rooted by the stack. To work around that, codebases generally only do Boehm GC steps when the stack is empty so it is known that there are no objects that would be rooted by the stack, and Boehm is compiled in a mode that disables stack walking since it does not apply.

If that is already being done, and assuming the build issue is only a technicality of appeasing the compiler to see the correct symbols, then I suppose any no-op implementation might work (i.e. return stack base = address 0, stack size = 0). Alternatively, you can try hooking the functions to the pthread_attr_getstack function (http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getstack.html) which should be functional in both singlethreaded and multithreaded builds. Though reading this stack has very different meaning than the native stack, and won't contain function local GC objects.

@intrigus
Copy link
Author

intrigus commented May 30, 2017

I made a mistake, I thought that I use version 7.6.0 but my version is much newer.
Anyway I found these two issues.
One is new the other one is already known.
I didn't yet bisect #163 (comment) because I don't know whether it may be solved by solving (1) or (2).

@ivmai I've bisected and found two issues.

(1) Compile error issue:

See https://gist.github.com/intrigus/ef1f0bf9f19f164611f9a1c97ac58e05#file-gistfile2-txt

(2) Another new issue I found

https://gist.github.com/intrigus/ef1f0bf9f19f164611f9a1c97ac58e05#file-gistfile1-txt

@ivmai
Copy link
Owner

ivmai commented May 31, 2017

Thank you, @juj. I will add a comment to gcconfig.h

@ivmai
Copy link
Owner

ivmai commented May 31, 2017

@intrigus, I have analyzed the commits you referenced. Please try the following fix (for master):

diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index bf17dd63..7aa9e504 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -817,8 +817,8 @@
# define OS_TYPE "EMSCRIPTEN"
# define CPP_WORDSZ 32
# define ALIGNMENT 4
-# define DATASTART (ptr_t)NULL
-# define DATAEND (ptr_t)NULL
+# define DATASTART (ptr_t)ALIGNMENT
+# define DATAEND (ptr_t)ALIGNMENT
# define STACK_NOT_SCANNED
# endif

diff --git a/os_dep.c b/os_dep.c
index 0f22b80e..d941afcd 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -1252,7 +1252,7 @@ GC_INNER size_t GC_page_size = 0;
# endif
# endif
}
-# elif defined(CPPCHECK)
+# elif defined(STACK_NOT_SCANNED) || defined(CPPCHECK)
result = NULL;
# else
# error None of HEURISTIC* and *STACKBOTTOM defined!

@intrigus
Copy link
Author

intrigus commented Jun 2, 2017

After applying the diff it compiles but fails at runtime with yet another error.
Will have to bisect again :)

ivmai added a commit that referenced this issue Jun 20, 2017
Issue #163 (bdwgc).

DATASTART is tested to have a non-null value in GC_register_data_segments,
so the macro should not be defined to null even if it is not really
used (null value typically means that the corresponding weak symbol
is not resolved).

* include/private/gcconfig.h [SYMBIAN || __EMSCRIPTEN__] (DATASTART,
DATAEND): Change to a non-null value (ALIGNMENT).
ivmai added a commit that referenced this issue Jun 20, 2017
Issue #163 (bdwgc).

* os_dep.c [!BEOS && !AMIGA && !OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32
&& !GC_OPENBSD_THREADS && !STACKBOTTOM && !HEURISTIC1 && !HEURISTIC2
&& !LINUX_STACKBOTTOM && !FREEBSD_STACKBOTTOM] (GC_get_main_stack_base):
Set result to null if STACK_NOT_SCANNED (instead of #error).
ivmai pushed a commit that referenced this issue Jun 23, 2017
Issue #163 (bdwgc).

* include/private/gcconfig.h [__EMSCRIPTEN__] (STACK_NOT_SCANNED): Add
comment (explaining the reason of defining this macro).
ivmai added a commit that referenced this issue Jul 2, 2017
Issue #163 (bdwgc).

DATASTART is tested to have a non-null value in GC_register_data_segments,
so the macro should not be defined to null even if it is not really
used (null value typically means that the corresponding weak symbol
is not resolved).

* include/private/gcconfig.h [SYMBIAN || __EMSCRIPTEN__] (DATASTART,
DATAEND): Change to a non-null value (ALIGNMENT).
ivmai added a commit that referenced this issue Jul 2, 2017
Issue #163 (bdwgc).

* os_dep.c [!BEOS && !AMIGA && !OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32
&& !GC_OPENBSD_THREADS && !STACKBOTTOM && !HEURISTIC1 && !HEURISTIC2
&& !LINUX_STACKBOTTOM && !FREEBSD_STACKBOTTOM] (GC_get_main_stack_base):
Set result to null if STACK_NOT_SCANNED (instead of #error).
@ylluminate
Copy link

@ivmai @juj @intrigus you may wish to take a look at the discussion over here: WebAssembly/binaryen#1312 (comment)

It appears that we could get a workable solution for getting this going as per @kripken via binaryen for emscripten.

@ivmai
Copy link
Owner

ivmai commented Mar 21, 2018

Is there anything to do regarding this issue?

@ivmai ivmai closed this as completed Mar 23, 2018
@ylluminate
Copy link

@ivmai I've had some other pressing issues that have precluded my doing anything here. Has anyone been able to get this working, and if so or otherwise, could you post your findings?

@ivmai
Copy link
Owner

ivmai commented Mar 23, 2018

Has anyone been able to get this working, and if so or otherwise, could you post your findings?

I think all the mentioned commits are included in v7.6.4 release

@ylluminate
Copy link

Thanks very much @ivmai. It would be interesting to see if anyone has a blog post or a demo of this working to see the finer points as it now stands in this usecase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants