I follow a bit of that post 
[https://forum.nim-lang.org/t/2838#18350](https://forum.nim-lang.org/t/2838#18350)
 and other to get start compiling to wasm.

But I'm stock with some error. Anyone tried to compile to wasm recently?

First error is that the compiler is complaining that I don't have 'mach.h'

So I modified the config to include it -I/usr/include
    
    
    @if emscripten:
       ...
      cpu = "i386"
      passC = "-s WASM=1 -s 'BINARYEN_METHOD=\"native-wasm\"' -I/usr/include 
-Iemscripten "
      ...
    @end
    
    
    
    Run

Now I have a couple of architecture error
    
    
    Error: execution of an external compiler program 
'/emsdk/emscripten/1.38.12/emcc -c -w -s WASM=1 -s 
'BINARYEN_METHOD="native-wasm"' -I/usr/include -Iemscripten -O3  
-I/usr/local/Cellar/nim/0.18.0_1/nim/lib -o 
/private/var/workspace/fl/cacheim/src/nimcache/stdlib_typetraits.o 
/private/var/workspace/fl/cacheim/src/nimcache/stdlib_typetraits.c' failed with 
exit code: 1
    
    In file included from 
/private/var/workspace/fl/cacheim/src/nimcache/stdlib_typetraits.c:10:
    In file included from /usr/local/Cellar/nim/0.18.0_1/nim/lib/nimbase.h:255:
    In file included from /usr/include/limits.h:63:
    /usr/include/sys/cdefs.h:763:2: error: Unsupported architecture
    #error Unsupported architecture
     ^
    In file included from 
/private/var/workspace/fl/cacheim/src/nimcache/stdlib_typetraits.c:10:
    In file included from /usr/local/Cellar/nim/0.18.0_1/nim/lib/nimbase.h:255:
    In file included from /usr/include/limits.h:64:
    /usr/include/machine/limits.h:8:2: error: architecture not supported
    #error architecture not supported
     ^
    In file included from 
/private/var/workspace/fl/cacheim/src/nimcache/stdlib_typetraits.c:10:
    In file included from /usr/local/Cellar/nim/0.18.0_1/nim/lib/nimbase.h:256:
    In file included from /usr/include/stddef.h:64:
    In file included from /usr/include/_types.h:27:
    In file included from /usr/include/sys/_types.h:33:
    /usr/include/machine/_types.h:34:2: error: architecture not supported
    #error architecture not supported
     ^
    In file included from 
/private/var/workspace/fl/cacheim/src/nimcache/stdlib_typetraits.c:10:
    In file included from /usr/local/Cellar/nim/0.18.0_1/nim/lib/nimbase.h:256:
    In file included from /usr/include/stddef.h:64:
    In file included from /usr/include/_types.h:27:
    /usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'
    typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
            ^
    /usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'
    typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
            ^
    /usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'
    typedef __int32_t       __darwin_dev_t;         /* dev_t */
            ^
    /usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'
    typedef __uint32_t      __darwin_gid_t;         /* [???] process and group 
IDs */
            ^
    /usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'
    typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or 
gid_t*/
            ^
    /usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'
    typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit 
inodes */
            ^
    /usr/include/sys/_types.h:68:9: error: unknown type name 
'__darwin_natural_t'
    typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
            ^
    /usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'
    typedef __uint16_t      __darwin_mode_t;        /* [???] Some file 
attributes */
            ^
    /usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'
    typedef __int64_t       __darwin_off_t;         /* [???] Used for file 
sizes */
            ^
    /usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'
    typedef __int32_t       __darwin_pid_t;         /* [???] process and group 
IDs */
            ^
    /usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'
    typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
            ^
    /usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'
    typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
            ^
    /usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'
    typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
            ^
    /usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'
    typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
            ^
    In file included from 
/private/var/workspace/fl/cacheim/src/nimcache/stdlib_typetraits.c:10:
    In file included from /usr/local/Cellar/nim/0.18.0_1/nim/lib/nimbase.h:256:
    In file included from /usr/include/stddef.h:69:
    In file included from /usr/include/sys/_types/_ptrdiff_t.h:31:
    /usr/include/machine/types.h:37:2: error: architecture not supported
    #error architecture not supported
     ^
    In file included from 
/private/var/workspace/fl/cacheim/src/nimcache/stdlib_typetraits.c:10:
    In file included from /usr/local/Cellar/nim/0.18.0_1/nim/lib/nimbase.h:256:
    In file included from /usr/include/stddef.h:69:
    /usr/include/sys/_types/_ptrdiff_t.h:32:9: error: unknown type name 
'__darwin_ptrdiff_t'; did you mean '__darwin_pthread_t'?
    typedef __darwin_ptrdiff_t ptrdiff_t;
            ^~~~~~~~~~~~~~~~~~
            __darwin_pthread_t
    /usr/include/sys/_pthread/_pthread_types.h:118:35: note: 
'__darwin_pthread_t' declared here
    typedef struct _opaque_pthread_t *__darwin_pthread_t;
                                      ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
    
    
    
    Run

I'm guessing that now it use /usr/include instead of emscripten one. But How do 
I solve my mach.h not found if I don't do this? Anyone with a idea? 

Reply via email to