Compiling protobuf for cross-compiling environment

2,551 views
Skip to first unread message

Makulik

unread,
Sep 1, 2009, 10:28:28 AM9/1/09
to Protocol Buffers
Hi,

I need to use protobuf in a cross-compiling environment.
The .proto files should be compiled with an x86 version
of protoc, but the outputs should be compiled with a
powerpc gcc and of course linked with an appropriate
version of the protobuf runtime libs.
What's the best approach just to configure, compile
and install the runtime libs for the powerpc target
(I have a shelltool [ltib] that spoofs all the standard dirs like
/usr/local/... and allows to build for the cross-target)?

WBR
Günther

Kenton Varda

unread,
Sep 1, 2009, 12:25:31 PM9/1/09
to Makulik, Protocol Buffers
Use the --with-protoc option to configure to tell it to use a particular protoc binary when building (rather than attempt to execute the one it just built).

Other than that, cross-compiling works the same as with any automake/autoconf package.  E.g. I have cross-compiled Windows binaries on a Mac machine using:

   ./configure --with-protoc=/usr/bin/protoc --host=i386-mingw32 --prefix=/usr/i386-mingw32

Depending on your setup, you may need to specify more stuff.  See INSTALL.txt for detailed instructions.

Note that protoc's output is identical on all platforms.

Makulik

unread,
Sep 2, 2009, 3:53:56 AM9/2/09
to Protocol Buffers
Hi Kenton,

Thanks for your hints. But there's still one thing not clear for me:
I don't need the protoc compiler as powerpc executable, just the
runtime libs. Is there a way to give an option (build-target) to
configure
or make, to build just theese? I didn't see one after having a quick
look
on configure and the generated Makefile. Or will the --with-protoc
option
have this effect?

WBR
Günther

On 1 Sep., 18:25, Kenton Varda <ken...@google.com> wrote:
> Use the --with-protoc option to configure to tell it to use a particular
> protoc binary when building (rather than attempt to execute the one it just
> built).
> Other than that, cross-compiling works the same as with any
> automake/autoconf package.  E.g. I have cross-compiled Windows binaries on a
> Mac machine using:
>
>    ./configure --with-protoc=/usr/bin/protoc --host=i386-mingw32
> --prefix=/usr/i386-mingw32
>
> Depending on your setup, you may need to specify more stuff.  See
> INSTALL.txt for detailed instructions.
>
> Note that protoc's output is identical on all platforms.
>

Kenton Varda

unread,
Sep 2, 2009, 1:07:38 PM9/2/09
to Makulik, Protocol Buffers
Sorry, automake does not make it easy to install only part of the package, and I think it is non-trivial to get working libraries without running the "install" step.  Is there any harm in building protoc?

Guenther Makulik

unread,
Sep 3, 2009, 4:05:52 AM9/3/09
to Kenton Varda, Protocol Buffers

Hi,


Kenton Varda <ken...@google.com> schrieb am 02.09.2009 19:07:38:

> Sorry, automake does not make it easy to install only part of the package,
> and I think it is non-trivial to get working libraries without running the
> "install" step.  Is there any harm in building protoc?
No, not really except build performance ;-) ...

WBR
Günther


--
Registergericht / Register court: Amtsgericht Traunstein, HRA 460 / local court Traunstein, certificate of registration no. 460
Geschäftsführender persönlich haftender Gesellschafter / Personally liable managing partner: Prof. Dr. Dr. h.c. Anton Kathrein, Dipl.-Betriebswirt (MBA-equivalent)
Erfüllungsort und Gerichtsstand / Place of performance and place of jurisdiction: Rosenheim

This e-mail is confidential and may contain privileged information. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking.
Reply all
Reply to author
Forward
0 new messages