Compiling libprotobuf

From AlliedModders Wiki
Revision as of 07:20, 23 January 2013 by Psychonic (talk | contribs) (Created page with "Examples for compiling a 32-bit libprotobuf and other protobuf libraries using the protobuf-2.3.0 source. ==Windows== The following was tested on Windows 7 with Visual Studi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Examples for compiling a 32-bit libprotobuf and other protobuf libraries using the protobuf-2.3.0 source.


Windows

The following was tested on Windows 7 with Visual Studio 2010. Not all projects built after conversion, but only libprotobuf and dependencies were necessary.

  • Download protobuf-2.3.0.zip from https://code.google.com/p/protobuf/downloads/list
  • Extract and navigate to protobuf-2.3.0/vsprojects/
  • Open protobuf.sln in the version of Visual Studio corresponding with the VC abi version that you wish to compile for.
  • Walk through project conversion steps if necessary.
  • Right-click the libprotobuf project and choose properties.
  • In Configuration Properties > C/C++ -> Code Generation, set Runtime Library to /MT for Release or /MTd for Debug.
  • Right-click the libprotobuf project and choose Build.

libprotobuf.lib will be in Release/ or Debug/, depending on build configuration.


Linux (32-bit host)

The following was tested on Debian 6 (Lenny) 32-bit.

wget https://protobuf.googlecode.com/files/protobuf-2.3.0.tar.gz
tar -xvzf protobuf-2.3.0.tar.gz
cd protobuf-2.3.0
./configure
make

The library will be in src/.libs/


Linux (64-bit host)

This hasn't been tested, but should work on most or all 64-bit distributions.

wget https://protobuf.googlecode.com/files/protobuf-2.3.0.tar.gz
tar -xvzf protobuf-2.3.0.tar.gz
cd protobuf-2.3.0
./configure --build=i686-pc-linux-gnu CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32
make

The library will be in src/.libs/


Mac

The following was tested on OS X 10.7 (Lion) and ensures that the outputted binaries are 32-bit.

wget https://protobuf.googlecode.com/files/protobuf-2.3.0.tar.gz
tar -xvzf protobuf-2.3.0.tar.gz
cd protobuf-2.3.0
./configure --build=x86-apple-darwin ABI=standard CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32
make

The library will be in src/.libs/