Open azc5OQ opened 1 year ago
first question, how to disable warnings coming from emcc? I tried getting rid of one annoying warning appearing everywhere, ... but.. the string "-Wno-expansion-to-defined" has no effect,
second question, how to make some functions accessible for use in javascript? There are symbols i want to make available in javascript. "allocate" is one of them, as you can see in this line in Makefile EXPORTED_RUNTIME_METHODS="['setValue', 'getValue','allocate']"
setValue and getValue can really be used, but "allocate" is always undefined.
thank you for reply
first question, how to disable warnings coming from emcc? I tried getting rid of one annoying warning appearing everywhere, ... but.. the string "-Wno-expansion-to-defined" has no effect,
That exactly the way to disable warning. emcc uses clang under the hood and we pass those options through to clang.
I think clang handles these options from left to right, so order can matter.. are you adding this option after -Wall
, for example?
If the problem persists can you post the full command line and the full compiler output containing the warning?
second question, how to make some functions accessible for use in javascript? There are symbols i want to make available in javascript. "allocate" is one of them, as you can see in this line in Makefile EXPORTED_RUNTIME_METHODS="['setValue', 'getValue','allocate']"
That also should just work. e.g.
$ ./emcc test/hello_world.c -s EXPORTED_RUNTIME_METHODS=allocate
$ grep allocate a.out.js
...
Module["allocate"] = allocate;
...
Does that not appear in your output?
BTW you can simplify your flags by using a simple comma sparated format for you symbol lists. e.g. just -sEXPORTED_FUNCTIONS=foo,bar
setValue and getValue can really be used, but "allocate" is always undefined.
thank you for reply
"solved" the problem, function really got exported, my bad. Problem with disabling the warning remains but it is not that important
are you adding this option after -Wall, for example?
i posted contents of Makefile, check where Wno-expansion-to-defined is used
this is the project that when I try to build, I get lot W-expansion-to-defined warnings https://github.com/azc5OQ/libopusjs
It would be extremely unlikely that `"-Wno-expansion-to-defined" doesn't work as expected. Can you show an example of a full command line where that is part of the command line and that warning still shows up?
Including the full build output would probably work too (assuming command lines are shown in the output of the build, at least when a command fails).
Im trying to build opus library. It builds, but there are problems.
here is what Makefile looks like
EMCC_OPTS=-Wno-expansion-to-defined -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="['_malloc','_allocate','_ALLOC_STACK']" -s EXPORTED_RUNTIME_METHODS="['setValue', 'getValue','allocate']"
LIBOPUS_STABLE=tags/v1.1.2
OPUS_DIR=./opus OPUS_OBJ=$(OPUS_DIR)/.libs/libopus.a
SPEEXDSP_DIR=./speexdsp SPEEXDSP_OBJ=$(SPEEXDSP_DIR)/libspeexdsp/.libs/libspeexdsp.a
DIST=./dist
OPUSJS=$(DIST)/libopus.js OPUSJS_EXPORTS:='_opus_encoder_create','_opus_encode_float','_opus_encoder_ctl','_opus_encoder_destroy','_malloc','_free','_opus_decoder_create','_opus_decode_float','_opus_decoder_ctl','_opus_decoder_destroy' SPEEXDSP_EXPORTS:='_speex_resampler_init','_speex_resampler_destroy','_speex_resampler_process_interleaved_float'
TARGETS=$(OPUS_OBJ) $(SPEEXDSP_OBJ) $(OPUSJS)
all: $(TARGETS) clean: rm -rf $(OPUS_OBJ) $(SPEEXDSP_OBJ) $(DIST) mkdir $(DIST)
submodule: cd $(OPUS_DIR); git checkout ${LIBOPUS_STABLE}
$(OPUSJS): $(OPUS_OBJ) $(SPEEXDSP_OBJ) emcc -o $@ $(EMCC_OPTS) -Wno-expansion-to-defined -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_RUNTIME_METHODS="['setValue', 'getValue','allocate']" -s EXPORTED_FUNCTIONS="[$(OPUSJS_EXPORTS),$(SPEEXDSP_EXPORTS)]" $(OPUS_OBJ) $(SPEEXDSP_OBJ)
$(OPUS_OBJ): submodule $(OPUS_DIR)/Makefile cd $(OPUS_DIR); emmake make $(OPUS_DIR)/Makefile: $(OPUS_DIR)/configure cd $(OPUS_DIR); emconfigure ./configure --disable-extra-programs --disable-doc $(OPUS_DIR)/configure: cd $(OPUS_DIR); ./autogen.sh $(SPEEXDSP_OBJ): $(SPEEXDSP_DIR)/Makefile cd $(SPEEXDSP_DIR); emmake make $(SPEEXDSP_DIR)/Makefile: $(SPEEXDSP_DIR)/configure cd $(SPEEXDSP_DIR); emconfigure ./configure --disable-examples $(SPEEXDSP_DIR)/configure: cd $(SPEEXDSP_DIR); ./autogen.sh