Giter VIP home page Giter VIP logo

invokr / protobuf-emscripten Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 8.0 6.34 MB

Google's Protocol Buffers for emscripten

Protocol Buffer 6.84% Emacs Lisp 0.05% Java 18.33% Makefile 0.47% C++ 43.78% Python 5.96% CMake 0.17% Shell 0.29% Ruby 0.31% C 4.28% Vim Script 0.03% M4 0.18% Batchfile 0.02% Objective-C 9.76% C# 6.89% Go 0.03% JavaScript 1.48% Objective-C++ 0.01% Swift 0.07% PHP 1.05%

protobuf-emscripten's Introduction

About

Emscripten port of Google's Protobuf library.

Building

cd [2.6.1|3.1.0]
sh autogen.sh
emconfigure ./configure
emmake Make

This will generate a dynamic library in src/.libs/ called libprotobuf.$(VERSION).[so|dylib]. Though the suffix suggests that this is a regular dylib, it contains emscripten bytecode. Change the suffix to .bc and you'll be able to link it into your emscripten project.

The protoc compiler will not be build but any code generate by the standard protoc is compatible with emscripten.

License

Protobuf: Original license

Patches: Public Domain

protobuf-emscripten's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

protobuf-emscripten's Issues

Compile errors

Hi,
I've tried to compile 3.1.0 following the build instructions and I have the following compile errors:

./google/protobuf/stubs/once.h:135:30: error: cannot initialize a parameter of type 'const volatile google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with an lvalue of type 'google::protobuf::ProtobufOnceType *' (aka 'long *') if (internal::Acquire_Load(once) != ONCE_STATE_DONE) { ^~~~

Instructions to build on a Windows system?

Hi,

Current build instructions appears to be UNIX-only. Is it complicated to port to build on Windows?
I tried building it using Ubuntu and I got the following files which I've copied:

image

Can I use these files to build my WebAssembly project?

Can't compile with library

Hi,
I managed to build protobuf (version 3.5.1) with emscripten, but when I try to compile my program (which has the line #include "google/protobuf/util/time_util.h" in it), emcc throws fatal error: 'google/protobuf/util/time_util.h' file not found.

I'm linking the compiled libprotobuf.a (tried with libprotobuf.so too, tried renaming both to .bc too, neither option worked) by doing: emcc -s WASM=1 -o out.html program.cpp libprotobuf.bc.

Have you had any similar issues or is there something I'm doing wrong?

libprotobuf.so not generated

I ran the instructions in d515e61 (b/c I can't find any instructions on the readme of the latest branch), and it does not generate a .so anymore, rather it generates a collection of .a / .la / .dylib .

Could you please update the readme to specify how we can use this with the latest patch?

Thanks so much,
Tomas

build errors

libtool: compile: /tmp/emsdk/upstream/emscripten/em++ -DHAVE_CONFIG_H -I. -I.. -DHAVE_PTHREAD=1 -Wall -Wno-sign-compare -O2 -g -DNDEBUG -MT google/protobuf/stubs/common.lo -MD -MP -MF google/protobuf/stubs/.deps/common.Tpo -c google/protobuf/stubs/common.cc -o google/protobuf/stubs/.libs/common.o
In file included from google/protobuf/stubs/common.cc:34:
./google/protobuf/stubs/once.h:126:30: error: cannot initialize a parameter of type 'const volatile google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with an lvalue of type 'google::protobuf::ProtobufOnceType *' (aka 'long ')
if (internal::Acquire_Load(once) != ONCE_STATE_DONE) {
^~~~
./google/protobuf/stubs/atomicops_internals_emscripten.h:83:55: note: passing argument to parameter 'ptr' here
inline Atomic32 Acquire_Load(volatile const Atomic32
ptr) {
^
In file included from google/protobuf/stubs/common.cc:34:
./google/protobuf/stubs/once.h:135:30: error: cannot initialize a parameter of type 'const volatile google::protobuf::internal::Atomic32 *' (aka 'const volatile int *') with an lvalue of type 'google::protobuf::ProtobufOnceType *' (aka 'long ')
if (internal::Acquire_Load(once) != ONCE_STATE_DONE) {
^~~~
./google/protobuf/stubs/atomicops_internals_emscripten.h:83:55: note: passing argument to parameter 'ptr' here
inline Atomic32 Acquire_Load(volatile const Atomic32
ptr) {
^
2 errors generated.
shared:ERROR: '/tmp/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=1 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem/tmp/emsdk/upstream/emscripten/system/include/libcxx -Xclang -isystem/tmp/emsdk/upstream/emscripten/system/lib/libcxxabi/include -Xclang -isystem/tmp/emsdk/upstream/emscripten/system/include/compat -Xclang -isystem/tmp/emsdk/upstream/emscripten/system/include -Xclang -isystem/tmp/emsdk/upstream/emscripten/system/include/libc -Xclang -isystem/tmp/emsdk/upstream/emscripten/system/lib/libc/musl/arch/emscripten -Xclang -isystem/tmp/emsdk/upstream/emscripten/system/local/include -DHAVE_CONFIG_H -I. -I.. -DHAVE_PTHREAD=1 -Wall -Wno-sign-compare -O2 -DNDEBUG -MT google/protobuf/stubs/common.lo -MD -MP -MF google/protobuf/stubs/.deps/common.Tpo -c -std=c++03 -DEMSCRIPTEN -g google/protobuf/stubs/common.cc -Xclang -isystem/tmp/emsdk/upstream/emscripten/system/include/SDL -c -o google/protobuf/stubs/.libs/common.o -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (1)
Makefile:1264: recipe for target 'google/protobuf/stubs/common.lo' failed
make[2]: *** [google/protobuf/stubs/common.lo] Error 1
make[2]: Leaving directory '/tmp/protobuf-emscripten/3.1.0/src'
Makefile:1325: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/protobuf-emscripten/3.1.0'
Makefile:1232: recipe for target 'all' failed
make: *** [all] Error 2

autogen.sh fails: configure.ac:30: error: possibly undefined macro: AC_PROG_LIBTOOL

Hi, I'm in dire need to use protocol buffers for a WebAssembly project. Tried following your build instructions but invoking sh autogen.sh fails.

$ sh autogen.sh 
+ autoreconf -f -i -Wall,no-obsolete
configure.ac:30: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

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.