higuma / mp3-lame-encoder-js

MP3 encoder for browsers using LAME
MIT License
132 stars 20 forks source link

Emscripten compile error: undefined symbol #16

Open floydback opened 5 years ago

floydback commented 5 years ago

Hi! Could anyone help me with Emscripten compiler?

I want to change lame version to 3.100 and add wasm version. As start I try to recompile current code but I got this error:

emcc -O1 -s ALLOW_MEMORY_GROWTH=0 -s EXPORTED_FUNCTIONS=@src/exports.json --pre-js src/pre.js --post-js src/post.js -s ASM_JS=1 -o lib/Mp3LameEncoder.js output/lame-3.99.5/libmp3lame/VbrTag.o output/lame-3.99.5/libmp3lame/bitstream.o output/lame-3.99.5/libmp3lame/encoder.o output/lame-3.99.5/libmp3lame/fft.o output/lame-3.99.5/libmp3lame/id3tag.o output/lame-3.99.5/libmp3lame/lame.o output/lame-3.99.5/libmp3lame/newmdct.o output/lame-3.99.5/libmp3lame/presets.o output/lame-3.99.5/libmp3lame/psymodel.o output/lame-3.99.5/libmp3lame/quantize.o output/lame-3.99.5/libmp3lame/quantize_pvt.o output/lame-3.99.5/libmp3lame/reservoir.o output/lame-3.99.5/libmp3lame/set_get.o output/lame-3.99.5/libmp3lame/tables.o output/lame-3.99.5/libmp3lame/takehiro.o output/lame-3.99.5/libmp3lame/util.o output/lame-3.99.5/libmp3lame/version.o
error: undefined symbol: AnalyzeSamples
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: GetTitleGain
error: undefined symbol: InitGainAnalysis
error: undefined symbol: VBR_encode_frame
error: undefined symbol: hip_decode1_unclipped
error: undefined symbol: hip_decode_exit
error: undefined symbol: hip_decode_init
error: undefined symbol: hip_set_debugf
error: undefined symbol: hip_set_errorf
error: undefined symbol: hip_set_msgf
error: undefined symbol: init_xrpow_core_sse
Error: Aborting compilation due to previous errors
shared:ERROR: '/Users/me/emsdk/node/8.9.1_64bit/bin/node /Users/me/emsdk/emscripten/1.38.21/src/compiler.js /tmp/tmphnc5i60c.txt /Users/me/emsdk/emscripten/1.38.21/src/library_pthread_stub.js' failed (1)

ps. MacOS, Node v8.9.1, Python 3.7.1, ruby 2.5.1, git 2.17.2, java version "1.8.0_121", gcc 4.2.1

phikes commented 3 years ago

Although an old issue here is my solution.

Either comment in the "missing" source files in the Rakefile:

LIBMP3LAME_FILES = [
  'bitstream.c',
  'encoder.c',
  'fft.c',
  #'gain_analysis.c',
  'id3tag.c',
  'lame.c',
  #'mpglib_interface.c',
  'newmdct.c',
  'psymodel.c',
  'presets.c',
  'quantize.c',
  'quantize_pvt.c',
  'reservoir.c',
  'set_get.c',
  'tables.c',
  'takehiro.c',
  'util.c',
  #'vbrquantize.c',
  'VbrTag.c',
  #'vector/xmm_quantize_sub.c',
  'version.c'
]

or compile with:

EMCC_LINK_OPTIONS = [
  '-s ERROR_ON_UNDEFINED_SYMBOLS=0',
# ...