szk2s/wasm-juce-experiment

Cannot compile codes with JUCE module as Wasm module

Opened this issue · 1 comments

szk2s commented

Expected Behavior

Write Test tone to audio device from browser

Steps to reproduce

# install dependencies
yarn

# compile
yarn compile

Error message

error: undefined symbol: _ZN4juce10MidiOutput10getDevicesEv
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: _ZN4juce10MidiOutput10openDeviceEi
error: undefined symbol: _ZN4juce14MessageManager26doPlatformSpecificShutdownEv
error: undefined symbol: _ZN4juce14MessageManager32doPlatformSpecificInitialisationEv
error: undefined symbol: _ZN4juce6Thread20setCurrentThreadNameERKNS_6StringE
error: undefined symbol: _ZN4juce6Thread5sleepEi
error: undefined symbol: _ZN4juce9MidiInput10getDevicesEv
error: undefined symbol: _ZN4juce9MidiInput10openDeviceEiPNS_17MidiInputCallbackE
error: undefined symbol: _ZN4juce9MidiInput5startEv
error: undefined symbol: _ZN4juce9MidiInputD1Ev
Error: Aborting compilation due to previous errors
shared:ERROR: '/Users/satoshi/emsdk/node/10.16.3_64bit/bin/node /Users/satoshi/repos/wasm-juce-example/node_modules/emsdk/fastcomp/emscripten/src/compiler.js /var/folders/qy/zhtj0kqx49b16v8zx6t4hl100000gn/T/tmpof1D28.txt /Users/satoshi/repos/wasm-juce-example/node_modules/emsdk/fastcomp/emscripten/src/library_pthread_stub.js' failed (1)
make: *** [main.js] Error 1
szk2s commented

After commenting out some lines depending on JUCE, all works fine.

// src/Main.cpp

#include "add1.h"
// #include "audio.h"
#include <iostream>
int main(int argc, char** argv) {
    std::cout << "Hello World" << std::endl;
    std::cout << "1 + 1 = " << add1(1) << std::endl;
    // initializeJuce();
    // playTestSound();
    return 0;
}
// Builds/WASM/Makefile
// Line #12

SOURCES = \
  $(SRC)/Main.cpp \
	$(SRC)/add1.cpp \
	# $(SRC)/audio.cpp

You can check the result with yarn serve