skoppe / spasm

Write single page applications in D that compile to webassembly
MIT License
218 stars 17 forks source link

errno unsupported platform #10

Closed WebFreak001 closed 5 years ago

WebFreak001 commented 5 years ago

Followed README instructions and copy pasted dom example code

> dub --compiler=ldc2 --build=release
Performing "release" build using ldc2 for x86_64.
bolts 0.11.1: building configuration "library"...
optional 0.10.1: building configuration "unittest"...
stdx-allocator 2.77.3: building configuration "library"...
spasm 0.1.7: building configuration "library"...
webasmtest ~master: building configuration "application"...
/home/webfreak/etc-bin/ldc2-1.14.0-linux-x86_64/bin/../import/core/memory.d(924,24): Deprecation: core.stdc.errno.getErrno is not visible from module memory
/home/webfreak/etc-bin/ldc2-1.14.0-linux-x86_64/bin/../import/core/memory.d(927,24): Deprecation: core.stdc.errno.setErrno is not visible from module memory
/home/webfreak/etc-bin/ldc2-1.14.0-linux-x86_64/bin/../import/core/stdc/errno.d(2042,5): Error: static assert:  "Unsupported platform"

app.d

import spasm.bindings;
import spasm.dom;
import spasm.types;

extern (C) export void _start()
{
  auto elem = document.createElement("div").as!HTMLElement;
  elem.style.backgroundColor = "green";
  elem.innerHTML = "BLA BLA!";
  elem.addEventListener("mouseover",(event){
      console.log("onmouseover");
      console.log(event);
      console.log(event.as!MouseEvent.clientX);
    });

  auto root = document.querySelector("body").front;
  root.appendChild(elem);
}

dub.sdl

name "webasmtest"
description "A minimal D application."
authors "webfreak"
copyright "Copyright © 2019, webfreak"
license "proprietary"
dependency "spasm" version="~>0.1.7"

ldc --version

LDC - the LLVM D compiler (1.14.0):
  based on DMD v2.084.1 and LLVM 7.0.1
  built with LDC - the LLVM D compiler (1.14.0)
  Default target: x86_64-unknown-linux-gnu
  Host CPU: znver1
  http://dlang.org - http://wiki.dlang.org/LDC

(precompiled ldc2 from github with wasm targets)

WebFreak001 commented 5 years ago

adding

dflags "-betterC"

to dub.sdl fixed it

skoppe commented 5 years ago

Thanks, I always put it in there, but didn't know it was required. Thought it was simply propagated from the parent project. Will update readme.