Giter VIP home page Giter VIP logo

Comments (6)

invokr avatar invokr commented on June 26, 2024

First of all, like it says in the readme, you should rename the .so so .bc and link that one. The .a is irrelevant in the whole process.

As for your issue: I've not come across it and so far the only supported 3x version in the repo is 3.1.0. The newer protobuf versions have a javascript target out of the box.

Did you properly specify the include directory with -I? A correct example for invoking emscripten would be: em++ -Iprotobuf-emscripten/3.1/src program.cpp libprotobuf.bc.

from protobuf-emscripten.

janhartman avatar janhartman commented on June 26, 2024

I have renamed the .so to .bc, but the output is still the same. (Specified the include directory too).
Thanks for helping, sorry to have wasted your time.

from protobuf-emscripten.

invokr avatar invokr commented on June 26, 2024

The .so to .bc will only solve the linking issue which would occur if the the file had the .so ending. You are not getting to the linking step which is why there is no difference. A missing include already aborts everything way before linking happens.

I don't mind helping you get it working if you tell me your rough use-case and how you build the 3.5.1 protobuf with emscripten in the first place. Not sure if applying the 3.1 patches is enough. Posting the CFLAGS and LDFLAGS would help, too.

from protobuf-emscripten.

janhartman avatar janhartman commented on June 26, 2024

I'm actually trying to compile grpc to WebAssembly to get a C++-based grpc client working in the browser (it seems like a long shot...).

I managed to build protobuf 3.5.1 with emconfigure ./configure --with-protoc=protoc && emmake make, this produces the library files under src/.libs/.

I realize now that the issue I talked about is not in the linking, but in the preprocessing. Sorry for the trouble, I do not have a lot of experience with compiling C/C++. It seems to find the headers now, but then I still get an error, described here. Do you have any ideas on how to fix this?

from protobuf-emscripten.

invokr avatar invokr commented on June 26, 2024

You can't compile the standard protobuf with emscripten. The sole purpose of this repository is to provide a patched version of protobuf (right now 2.6 and 3.1) that compiles with emscripten. The original google version will not compile with emscripten.

As for GRPC: Sorry to tell you that won't work either. At least not without knowing a substantial amount of C++. From what I can tell at first glance, it uses low level networking (e.g. http/2 protocl implementation on top of unix sockets) and threading. None of those are supported in emscripten. You could write your own transport layer but the threading issue would require a huge amount of changes to the code.

from protobuf-emscripten.

janhartman avatar janhartman commented on June 26, 2024

That's too bad - well now it makes sense why there are no proper implementations of gRPC for browsers. I think I'll have to stick with REST/JSON and use a reverse REST - GRPC proxy. Thanks for all the help!

from protobuf-emscripten.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.