[opus] Compiling opus with emscripten: malloc_hook

Hraban Luyat hraban at 0brg.net
Tue May 5 03:05:13 PDT 2015


Hi xiph,

I'm trying to compile libopus from git.xiph.org/opus.git with
emscripten. The regular:

$ emconfigure ./configure --enable-fixed-point
$ emmake make

gets me quite far, but it hangs on the use of __malloc_hook in the tests:

tests/test_opus_api.c:1776:16: error: use of undeclared identifier
'__malloc_hook'; did you mean 'malloc_hook'?
   orig_malloc=__malloc_hook;
               ^~~~~~~~~~~~~
               malloc_hook
tests/test_opus_api.c:74:7: note: 'malloc_hook' declared here
void *malloc_hook(__attribute__((unused)) size_t size,
      ^
tests/test_opus_api.c:1777:4: error: use of undeclared identifier
'__malloc_hook'
   __malloc_hook=malloc_hook;
   ^
tests/test_opus_api.c:1782:7: error: use of undeclared identifier
'__malloc_hook'
      __malloc_hook=orig_malloc;
      ^
tests/test_opus_api.c:1808:15: error: use of undeclared identifier
'__malloc_hook'
              __malloc_hook=orig_malloc;
              ^
tests/test_opus_api.c:1815:15: error: use of undeclared identifier
'__malloc_hook'
              __malloc_hook=orig_malloc;
              ^
tests/test_opus_api.c:1828:18: error: use of undeclared identifier
'__malloc_hook'
                 __malloc_hook=orig_malloc;
                 ^
tests/test_opus_api.c:1835:18: error: use of undeclared identifier
'__malloc_hook'
                 __malloc_hook=orig_malloc;
                 ^
tests/test_opus_api.c:1846:7: error: use of undeclared identifier
'__malloc_hook'
      __malloc_hook=orig_malloc;
      ^
tests/test_opus_api.c:1850:4: error: use of undeclared identifier
'__malloc_hook'
   __malloc_hook=orig_malloc;
   ^


As a work-around, I just %s/__malloc_hook/malloc_hook/g. I don't need
the tests for emscripten so I don't care if this is correct or not.

But does anyone know of a proper fix that could find its way back
upstream? It would be nice if libopus were emscripten compatible out
of the box.

Cheers,

Hraban


More information about the opus mailing list