emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.89k stars 3.32k forks source link

'CoreMIDI/CoreMIDI.h' file not found #15119

Open JSmithOner opened 3 years ago

JSmithOner commented 3 years ago

I'm trying to port rtMidi to WebAssembly, it compile just fine when using the dummy version but when asking to compile with MACOSX_CORE flag the compiler is not able to find CoreMidi I get

rtmidi/RtMidi.h:642:10: fatal error: 'CoreMIDI/CoreMIDI.h' file not found

I've ran emcc -O3 -s WASM=1 -s --bind -I rtmidi rtmidi/RtMidi.cpp rtmidi/rtmidi_c.cpp -s ASSERTIONS=1 -D__MACOSX_CORE__ on a mac

the include is as follow #include <CoreMIDI/CoreMIDI.h>.

The clang installed with XCode Command Line Tool normally finds it as it is linked to the correct file system Path. emcc is not linked to this include path and cannot find it.

running $emcc -v gives me the following output:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.30 (f782b50a7f8dded7cd0e2c7ee4fed41ab743f5c0)
clang version 14.0.0 (https://github.com/llvm/llvm-project c4048d8f50aaf2c4c13b8d3e138abc34a22da754)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /Users/vv/Documents/Techs/emsdk/emsdk/upstream/bin 

where running g++ -v gives me this output:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

and I'm on BigSur 11.5.2 on a mac mini m1

Thnaks in advance

kripken commented 3 years ago

Emscripten output runs in a JS or wasm environment, and it cannot access local system APIs like CoreMIDI. It can only access APIs available on the web, or in Node.js, or in wasm VMs etc.

Emscripten does try to emulate POSIX and other common APIs as much as possible. Maybe this library can be built using SDL, or OpenAL, which emscripten does support?

JSmithOner commented 3 years ago

@kripken Thank you for your answer, yes just figured that out. That's too bad but that's the way it works. I wanted to emulate WebMIDI on every browsers but I can't.Thanks again.