Skip to content

Instantly share code, notes, and snippets.

@chaudum
Last active December 17, 2015 23:39
Show Gist options
  • Save chaudum/5690601 to your computer and use it in GitHub Desktop.
Save chaudum/5690601 to your computer and use it in GitHub Desktop.
Emscripten emcc does not find mm_malloc.h when using Macports clang-3.2

test.c

#include <stdio.h>
#include <mm_malloc.h>

int main(int argc, const char * argv[]) {
	float *floatBuffer = _mm_malloc(256*sizeof(float), 16);
	_mm_free(floatBuffer);
	printf("%s\n", "Done!");
}

Compiling test.c with Macports clang:

christian ~/ [master*] /opt/local/bin/clang -g -Wall -DNDEBUG -o test test.c
christian ~/ [master*] ./test
Done!

Setting Macports clang in .emscripten:

LLVM_ROOT = os.path.expanduser('/opt/local/bin') # directory

Compiling with Emscripten emcc:

christian ~/ [master*] emcc -g -Wall -DNDEBUG -o test.js test.c
clang: warning: argument unused during compilation: '-nostdinc++'
test.c:2:10: fatal error: 'mm_malloc.h' file not found
#include <mm_malloc.h>
     ^
1 error generated.
ERROR    emcc: compiler frontend failed to generate LLVM bitcode, halting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment