emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
2.96k stars 676 forks source link

How to use a fork emscripten version? #1268

Closed luciouskami closed 1 year ago

luciouskami commented 1 year ago

I did operations follow the docs, but my patch didn't work. The reason of I want use costum build because I found an exception.


#00 dlfree
#01 operator delete(void*)
#02 void std::__2::__libcpp_operator_delete[abi:v160004]<void*>(void*)
#03 void std::__2::__do_deallocate_handle_size[abi:v160004]<>(void*, unsigned long)
#04 std::__2::__libcpp_deallocate[abi:v160004](void*, unsigned long, unsigned long)
#05 std::__2::allocator<std::__2::__shared_ptr_emplace<common::timer_wait_t, std::__2::allocator<common::timer_wait_t>>>::deallocate[abi:v160004](std::__2::__shared_ptr_emplace<common::timer_wait_t, std::__2::allocator<common::timer_wait_t>>*, unsigne...
#06 std::__2::allocator_traits<std::__2::allocator<std::__2::__shared_ptr_emplace<common::timer_wait_t, std::__2::allocator<common::timer_wait_t>>>>::deallocate[abi:v160004](std::__2::allocator<std::__2::__shared_ptr_emplace<common::timer_wait_t, std:...
#07 std::__2::__shared_ptr_emplace<common::timer_wait_t, std::__2::allocator<common::timer_wait_t>>::__on_zero_shared_weak()
#08 std::__2::__shared_weak_count::__release_weak()
#09 std::__2::__shared_weak_count::__release_shared[abi:v160004]()
#10 std::__2::shared_ptr<common::timer_base_t>::~shared_ptr[abi:v160004]()
#11 std::__2::shared_ptr<common::timer_base_t>::operator=[abi:v160004](std::__2::shared_ptr<common::timer_base_t>&&)
#12 common::timer_manager_t::tick_update()
#13 common::timer_manager_t::update(unsigned int)
#14 common::timer_manager_t::init()::$_0::operator()(unsigned int, unsigned long) const
#15 common::timer_manager_t::init()::$_0::__invoke(unsigned int, unsigned long)

callback  fail: Exception: out of bounds memory access

I use wasm-micro-runtime for runtime.

Then I add a printf in dlmalloc.c

void dlfree(void* mem) {
    /*
     Consolidate freed chunks with preceeding or succeeding bordering
     free chunks, if they exist, and then place in a bin.  Intermixed
     with special cases for top, dv, mmapped chunks, and usage errors.
     */

    if (mem != 0) {
        printf("222222222222222");
        printf("111111111111 dlfree ptr: 0x%p",mem);

but no output print How can I slove that?

kripken commented 1 year ago

Emscripten will auto-build libraries as it needs them, so if you modify dlmalloc.c and then delete libdlmalloc* (which will be in the cache dir) then next time you run emcc it will rebuilt it with your changes.

luciouskami commented 1 year ago

Emscripten will auto-build libraries as it needs them, so if you modify dlmalloc.c and then delete libdlmalloc* (which will be in the cache dir) then next time you run emcc it will rebuilt it with your changes.

thank you.