How to obtain the file libprotobuf.a?

144 views
Skip to first unread message

Claus Volko

unread,
Mar 27, 2024, 3:33:03 AMMar 27
to Protocol Buffers
I tried building the files from the source code using cmake but it did not produce the file libprotobuf.a. I need this file for a project I downloaded from GitHub. Also, it seems that the latest version of protobuf is not supported by this project but I guess it should work with v25.3.

Could anybody please give me instructions how to build libprotobuf.a or directly send me the file? Thank you very much in advance.

Claus Volko

unread,
Mar 28, 2024, 2:53:32 AMMar 28
to Protocol Buffers

My problem is that when I compile a project using Visual C++, no archive file (file with extension .a) is created. But I would need one.

I tried building the files from the source code of Google's protobuf, version 25.3, using cmake but it did not produce the file libprotobuf.a. I need this file for a project I downloaded from GitHub, namely https://github.com/retroplasma/earth-reverse-engineering. It contains a build script that looks like this:

#!/bin/sh

if [ "$1" == "emscripten" ]; then
source config_emscripten.sh
echo build: emscripten
pwd="$(pwd)" && cd .. && $EMSCRIPTEN_PROTOBUF_EXE --cpp_out=client proto/rocktree.proto && cd "$pwd"
cd crn && emcc -std=c++14 -c crn.cc -w && cd ..

emcc -Iinclude main.cpp -O2 -std=c++14 -I. -I./eigen/ \
-I$EMSCRIPTEN_PROTOBUF_SRC $EMSCRIPTEN_PROTOBUF_LIB crn/crn.o \
-s USE_SDL=2 -s FETCH=1 -s TOTAL_MEMORY=1073741824 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 \
-o main.html
else
echo build: native
pwd="$(pwd)" && cd .. && protoc --cpp_out=client proto/rocktree.proto && cd "$pwd"
cd crn && g++ -std=c++14 -c crn.cc -w && cd ..

CFLAGS="--std=c++14 -g -I. `pkg-config --cflags sdl2 protobuf` -I./eigen/"
LDFLAGS="`pkg-config --libs sdl2 protobuf` crn/crn.o"
if [ `uname` = "Darwin" ]; then
CFLAGS="$CFLAGS `pkg-config --cflags glew`"
LDFLAGS="$LDFLAGS `pkg-config --static --libs glew` -framework OpenGL"
echo "$CFLAGS"
echo "$LDFLAGS"
else
CFLAGS="$CFLAGS -Igl2/include"
LDFLAGS="$LDFLAGS -lGL -lm -ldl"
fi
c++ $CFLAGS main.cpp $LDFLAGS -o main
fi

where config_emscripten.sh reads as follows:

#!/bin/bash

EMSCRIPTEN_PROTOBUF_SRC="$(echo ~)/Downloads/protobuf/src"
EMSCRIPTEN_PROTOBUF_LIB="$(echo ~)/Downloads/protobuf/src/.libs/libprotobuf.a"
EMSCRIPTEN_PROTOBUF_EXE="$(echo ~)/Downloads/protoc-3.9.2-osx-x86_64/bin/protoc"

So I need libprotobuf.a to build the emscripten version of the project.

Could anybody please give me instructions how to build libprotobuf.a? What C++ compiler/linker creates files of this type?

Adam Cozzette

unread,
Mar 29, 2024, 6:46:59 PMMar 29
to Claus Volko, Protocol Buffers
How are you invoking CMake? I ran cmake . && make -j12 just now and confirmed that it produced libprotobuf.a.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/71cfd831-69fc-42e4-b1a9-e727e872815fn%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages