ncannasse / webidl

Haxe support for WebIDL
MIT License
90 stars 16 forks source link

new try to compile sample on mac #5

Closed aliokan closed 5 years ago

aliokan commented 5 years ago

New year, new try :) but I still facing errors :/

With Haxe nightly build

make js
haxe -lib webidl --macro "SampleModule.buildLibCpp()"
haxe -lib webidl --macro "SampleModule.buildLibJS()"
> python /Users/user/Documents/GIT-REPOS/emsdk/emscripten/1.38.21/emcc.py -O2 -c point.cpp -o point.bc
> python /Users/user/Documents/GIT-REPOS/emsdk/emscripten/1.38.21/emcc.py -O2 -c libpoint.cpp -o libpoint.bc
> make -f Makefile.tmp
python "/Users/user/Documents/GIT-REPOS/emsdk/emscripten/1.38.21/emcc.py" point.bc libpoint.bc -O2 -s EXPORT_NAME="'libpoint'" --memory-init-file 0 -o libpoint.js
haxe -js sample.js -lib webidl -main Sample -dce full
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
make: *** [js] Error 1

Haxe 3.4.7

make js
haxe -lib webidl --macro "SampleModule.buildLibCpp()"
/Users/user/haxe/haxelib/webidl/1,0,0/webidl/Parser.hx:82: characters 28-29 : Unexpected (
/Users/user/haxe/haxelib/webidl/1,0,0/webidl/Parser.hx:87: characters 28-29 : Unexpected (
/Users/user/haxe/haxelib/webidl/1,0,0/webidl/Parser.hx:90: characters 3-9 : Unexpected ensure
make: *** [libpoint.cpp] Error 1
ncannasse commented 5 years ago

The errors you are getting with Haxe 4.x are unrelated to webidl : some of your macro are adding twice the AInline accessor to some generated code which makes Haxe compiler complain about it as if you would have declared inline inline function foo() {} . Please fix your macro generation, I was able to correctly generate C++ code using Haxe 4.0 and latest webidl git.

aliokan commented 5 years ago

Actually, it not my code, I try to compile the sample folder. ^^

ncannasse commented 5 years ago

I can't reproduce when compiling the sample. Which command are you using exactly? Are you using WebIDL git version?

aliokan commented 5 years ago

I use git version of WebIDL, nightly build of haxe, and emscripten 1.38.21

git clone https://github.com/ncannasse/webidl.git
cd webidl/sample/
# set EMSCRIPTEN path
source /Users/user/Documents/GIT-REPOS/emsdk/emsdk_env.sh
make js

I get that result

haxe -lib webidl --macro "SampleModule.buildLibCpp()"
haxe -lib webidl --macro "SampleModule.buildLibJS()"
> python /Users/user/Documents/GIT-REPOS/emsdk/emscripten/1.38.21/emcc.py -O2 -c point.cpp -o point.bc
> python /Users/user/Documents/GIT-REPOS/emsdk/emscripten/1.38.21/emcc.py -O2 -c libpoint.cpp -o libpoint.bc
> make -f Makefile.tmp
python "/Users/user/Documents/GIT-REPOS/emsdk/emscripten/1.38.21/emcc.py" point.bc libpoint.bc -O2 -s EXPORT_NAME="'libpoint'" --memory-init-file 0 -o libpoint.js
haxe -js sample.js -lib webidl -main Sample -dce full
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Duplicate access modifier inline
SampleModule.hx:2: characters 26-70 : Defined in this class
/Users/user/haxe/versions/80f42bd/std/haxe/macro/Expr.hx:826: characters 2-10 : Previously defined here
SampleModule.hx:2: characters 26-70 : Defined in this class
make: *** [js] Error 1
zicklag commented 5 years ago

I've been doing a lot of testing ( not organized, more like sporadic testing in different situations ) and I run into this issue in random different situations. Replacing the following line with if (f.access.indexOf(AInline) == -1) f.access.push(AInline); fixes it for me.

https://github.com/ncannasse/webidl/blob/master/webidl/Module.hx#L298

I'm on Ubuntu 16.04 so I don't think it has anything to do with being on a mac.

ncannasse commented 5 years ago

@zicklag could you make a PR?

zicklag commented 5 years ago

@ncannasse Sure thing.