无法使用 emmake (Emscripten SDK) 编译 libpd

Can't compile libpd with emmake (Emscripten SDK)

我正在尝试使用 emscripten sdk 将 libpd 编译为 javascript 或 webassembly。根据一些文档,如果有 Makefile,可以使用 emmake make 编译它(没有使用 emconfigure,因为没有 ./configure 文件),但我得到以下错误:

/home/ian/Documents/emsdk/emscripten/1.37.37/emcc.py -DPD -DHAVE_UNISTD_H -DUSEAPI_DUMMY -I./pure-data/src -I./libpd_wrapper -I./libpd_wrapper/util -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -fPIC -I"/usr/lib/jvm/default-java/include/linux" -DHAVE_LIBDL -ffast-math -funroll-loops -fomit-frame-pointer -O3 -DLIBPD_EXTRA      -c -o pure-data/src/d_array.o pure-data/src/d_array.c
pure-data/src/d_array.c:523:2: error: No byte order defined
#error No byte order defined
 ^
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
<integrado>: fallo en las instrucciones para el objetivo 'pure-data/src/d_array.o'
make: *** [pure-data/src/d_array.o] Error 1

有什么想法吗?你认为可以编译这个库吗?

更新:按照@zakki 的回答中的建议调整每个抱怨文件后 我收到另一个错误:

libpd_wrapper/util/ringbuffer.c:18:12: fatal error: 'stdatomic.h' file not found
  #include <stdatomic.h>

那个文件有这个内容:

#if __STDC_VERSION__ >= 201112L // use stdatomic if C11 is available
  #include <stdatomic.h> // HERE IS WHERE ERROR GOES
  #define SYNC_FETCH(ptr) atomic_fetch_or((_Atomic int *)ptr, 0)
  #define SYNC_COMPARE_AND_SWAP(ptr, oldval, newval) \
          atomic_compare_exchange_strong((_Atomic int *)ptr, &oldval, newval)
//Some other definitions that I didn't put here

我前段时间阅读了一些关于 C++11 问题的帖子,我该如何解决这个问题?

更新 2:添加 && !defined(__EMSCRIPTEN__) 后现在可以编译了,但是我收到了这个我不明白的警告:

WARNING:root:Dynamic libraries (.so, .dylib, .dll) are currently not supported by Emscripten. For build system emulation purposes, Emscripten will now generate a static library file (.bc) with the suffix '.so'. For best practices, please adapt your build system to directly generate a static LLVM bitcode library by setting the output suffix to '.bc.')

Emscripten 有 endian.h。所以将 defined(__EMSCRIPTEN__) 添加到 ifdef.

#if defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) || \
    defined(ANDROID) || defined(__EMSCRIPTEN__)
#include <endian.h>
#endif

其次,好像Emscripten bug

#if __STDC_VERSION__ >= 201112L && !defined(__EMSCRIPTEN__)