Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ray Burgemeestre
    @rayburgemeestre
    (I see in chrome it was working without that switch)
    Thank you
    Alessandro Pignotti
    @alexp-sssup
    @laoo You may be interested in knowing that the bug you reported a few weeks ago is fixed in git master. You can now define global variables in the client namespace.
    Waldemar Pawlaszek
    @laoo
    @alexp-sssup Thanks for the fix! I'm developing my toy project for the web in C++ and I have impression that client::String class could have been something more elaborate. For example lack of simple string comparison is problematic (at least in my scenario). Another thing: the exceptions is the thing for near of rather far future?
    Alessandro Pignotti
    @alexp-sssup
    Exceptions require complex performance trade offs on the Web platform, so do not expect support soon. About client::String, it is exactly the same String that you have in JS. What features would you need?
    Waldemar Pawlaszek
    @laoo
    @alexp-sssup Maybe I don't know about something. How to compare client::String againts literal string or another client::String the right way? I can always cast to std::string and use comparison operator, but it does not feel right for JS string to do so.
    Alessandro Pignotti
    @alexp-sssup
    You can compare the "pointers", they are JS references
    You still need to convert C++ literals to JS string for the comparison to work
    client::String == const char would not do the right thing, as they are both pointers
    client::String* == const char*
    client::String* jsString = new client::String("test"); ... jsString == new client::String("test");
    the compiler will then be able to convert the C++ literal to a JS literal
    to summarize, to compare 2 client::String to can compare the pointers. To compare to a C++ literal you need to create a new client::String which will be optimized away
    Waldemar Pawlaszek
    @laoo
    OK. I've just checked it and it indeed works that way. Thanks again!
    btw. I've wrote myself a user-defined literal operator client::String * operator"" _cs( char const* aString, size_t aLength ); and the comparison is as simple as if ( str == "test"_cs ) { ... }.
    Alessandro Pignotti
    @alexp-sssup
    Cool solution
    Ray Burgemeestre
    @rayburgemeestre
    On Ubuntu 15.10 I had a runtime problem with all the server examples, they compiled okay, but whenever I hit the webserver that is running pion it would hit 100% cpu and output nothing. So I figured I compile libpion myself in order to debug, but I can't find the sourcecode for version 4 anywhere online (looks like the author (splunk) didn't include it in the new github repo). So I updated all the pion stuff with version 5, and stuff seems to work great, except the async_chat example.
    It seems to have something to do with the Promise code, so it's probably my lack of understanding how it should work, I'm stuck on it for a few hours now so I was hoping if someone can point me into some direction where the problem could be?
    I can understand this doesn't have highest priority, but I'll share my code changes and stacktrace of the segfault: https://github.com/leaningtech/cheerp-utils/compare/fb0f3e67ab0f83d8a2a7f31684b84b6ea4ff7ead...rayburgemeestre:pion5?expand=1 gist containing the bt: https://gist.github.com/rayburgemeestre/ddd88253efd46f8dd925
    Ray Burgemeestre
    @rayburgemeestre
    (So, the trigger for the segfault is: sendMessageRemote("Test message"); in async_chat.cpp)
    Alessandro Pignotti
    @alexp-sssup
    @rayburgemeestre I'm taking a look at the issue but I will need a few more days
    Ray Burgemeestre
    @rayburgemeestre
    no problem, I'm also still improving the changes, I noticed I used a slightly newer version of pion 5 (5.0.6) then is available by default in the Ubuntu 15 packges (probably the same as Ubuntu 14), so I'm adjusting the code a bit so eventually it will work out of the box hopefully. (I can only work on it every now and then)
    Ray Burgemeestre
    @rayburgemeestre
    I added another commit to my branch, at least I have some extra clarity. Still the async_chat doesn't work, but the stacktrace is no longer the same.
    Some stuff I discovered: with the ubuntu provided pion5 (libpion-dev iirc) package(s) I get that the cpu would hang at 100% cpu. It seems really "racy", every now and then you get a response from the webserver, only occasionally.
    So I build pion (tag 5.0.6) myself with g++: works, but still random crashes. Also I had to remove the BOOST_ASIO_DISABLE_MOVE define or it would segfault immediately all the time.
    So I build it with clang++ this time, had to patch it slightly (rayburgemeestre/pion@4013811) and build it with CXX=/opt/cheerp/bin/cheerp++ ./configure etc. --> This works, so far no random crashes (only consistent crashes :smile: )
    Just for completeness I will add the stacktrace I get now whenever I open async_chat.html in the browser: https://gist.github.com/rayburgemeestre/cee5b6daf8b97754137c I hope to spent some time debugging this specifically in a few days
    Alessandro Pignotti
    @alexp-sssup
    @rayburgemeestre I committed in the cheerp-utils repository a fix that should let the old pion4 version work with new distros. I also plan to update to pion5 (I may base the work on your patches) later on
    Ray Burgemeestre
    @rayburgemeestre
    Awesome, I can confirm in master the server examples work for me with pion4 now in Ubuntu 15.10.
    lukes3315
    @lukes3315
    Hey! Hope all is well ! I have a question, I have c++ platform specific code (android) to get accelerometer/gyro data, using the ASensorManager, is there a way to have cheerp's clang use the android sysroot (e.g. /opt/cheerp/clang++ --sysroot /path/to/android/root/ --arch armv7 --arch armv7-a) ? Since this c++ code is only executable on the Android platform and not any other browser, would cheerp still be able to "convert" it to JS, and have it executed on the specific platform ? I didn't see any documentation on cross compilation using cheerp
    @alexp-sssup
    Alexey Starfall
    @acterhd
    Hello, cheerp support webassembly?
    Alessandro Pignotti
    @alexp-sssup
    @acterhd hello, at the current stage webassembly does not provide the features that cheerp requires, namely support for objects. That's in the webassembly roadmap though, so we plan to support webassembly as an additional target beside JS when the wasm technology matures
    Gaurav
    @imgauravdewan_twitter
    Hello, I want to quickly compile a large C++ codebase that contains exception-handling to JS using cheerp. Emscripten ignores try catch block in optimized build. But cheerp gives compilation error - cannot use try throw with exceptions disabled.
    I tried -fexception but still got llvm.eh intrinsic error - Cheerp does not support exceptions. And it does not ignore them if they are there in AST/code
    Gaurav
    @imgauravdewan_twitter
    Is there any quick way or C++ trick to remove the exceptions from the code ? I can #define try to nothing. But what to do with (1)catch(int& x) catch(...) (2)throw; void f() throw() ?? Is there any non-intrusive (and non-destructive) way (other than removing throw catch from the code)?
    Alessandro Pignotti
    @alexp-sssup
    Hello @imgauravdewan_twitter , indeed Cheerp does not support exceptions currently, mainly due to the high overhead that JS engines introduce when using JS try{}catch constructs. There is also no way to automatically drop exception blocks. My suggestion would be to go over the codebase and use #ifndef CHEERP syntax to ifdef out the catch blocks and the try keyword.
    gitter has eaten my keywords, #ifndef __CHEERP__
    Gaurav
    @imgauravdewan_twitter
    I found a way
    1) try – #define try / nothing /
    2) catch(…) catch(int& x) etc – Use variadic macro #define catch(…) if(true)
    a. alternative: grep the source code and replace it with if(false) or while(false) and ignore compiler warning
    3) throw obj; - #define throw /nothing /
    4) void f() throw(int) – Although #define throw(…) /nothing/ works but it conflicts with clause 3 above – so manually changing the code for this construct under macro #if EXCEPTION_ENABLED recommended.
    Alessandro Pignotti
    @alexp-sssup
    I think catch should be defined to if (false) if you want to ignore exceptions
    Gaurav
    @imgauravdewan_twitter
    yea corrected
    Alessandro Pignotti
    @alexp-sssup
    to keep the codebase compatible with regular compiler I would suggest adding all the defines under an #ifdef __CHEERP__
    Gaurav
    @imgauravdewan_twitter
    yes sure
    I will start porting next week - now i am clear on most concepts of cheerp
    I tested STL, variadic templates etc and sample programs - seem to be working fine
    Is there any gotcha I need to be careful of (not documented in wiki) ?
    Thanks
    Alessandro Pignotti
    @alexp-sssup
    Keep in mind that type unsafe casting of pointers is not supported, most type safe C++ code works like a charm though.
    What is the project about?
    If you can share this information
    Gaurav
    @imgauravdewan_twitter
    This is company internal project at the moment and we are investigating optimum C++ to JS conversion workflow. We have been able to test asm.js and wasm and now want to evaluate this different approach.
    Karl zwinnen
    @karl_zwinnen_twitter
    Nice work! I'm definitely going to expiriment with this!
    One thing puzzles me though.. it states that 64 bit integers are supported natively (http://blog.leaningtech.com/2016/02/cheerp-12-c-to-javascript-with-faster.html), but Javascript doesn't natively support 64 bit integers (like mentions here: https://github.com/leaningtech/cheerp-meta/wiki/64-bit-integer-support)?