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
On Tue, May 5, 2015 at 10:05 AM, Hraban Luyat <hraban at 0brg.net> wrote:> gets me quite far, but it hangs on the use of __malloc_hook in the tests:[...]> 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.Presence of __malloc_hook is explicitly tested by the autoconf script; line 593 of configure.ac in my local tree. It won't attempt to use it unless that tests passes; does the emscriptem stuff run the configuration tests in the correct target environment? Are you overriding the build system? It's not clear to me why its failing.
2015-05-05 13:02 GMT+02:00 Gregory Maxwell <gmaxwell at gmail.com>:> Presence of __malloc_hook is explicitly tested by the autoconf script; > line 593 of configure.ac in my local tree. > > It won't attempt to use it unless that tests passes; does the > emscriptem stuff run the configuration tests in the correct target > environment? Are you overriding the build system? > > It's not clear to me why its failing.I'm not doing anything special, just the regular emscripten build instructions: $ ./autogen.sh $ emconfigure ./configure --prefix=/tmp --enable-fixed-point $ emmake make How do I check the targets? The output from configure and make can be found here: https://gist.github.com/hraban/d023b5f4be91fe987bde There is an archive download link on the right. Again, properly fixing this is one thing, just creating a work-around to at least get it to build is another. For example, just skipping the tests altogether when building under emscripten. It's a minor improvement over the status quo, but an improvement nonetheless. And probably worthwile. What do you think? If I knew anything about autotools I'd submit a patch myself, but alas. Sincerely, Hraban