Re: cross compile errors

2008-10-21 Thread Kenton Varda
For the first case, the problem is that the build is trying to run protoc as
part of the build process, and it's trying to use the cross-compiled protoc.
 I think you can fix this by editing src/Makefile.am at line 201 to change
this:
unittest_proto_middleman: protoc$(EXEEXT) $(protoc_inputs)
  ./$^ -I$(srcdir) --cpp_out=.

to this:

unittest_proto_middleman: $(protoc_inputs)
  protoc $^ -I$(srcdir) --cpp_out=.

In other words, this will use the protoc that you have already installed on
your system rather than the one you just built.

I guess we should figure out how to make this automatic.

On Tue, Oct 21, 2008 at 8:42 AM, <[EMAIL PROTECTED]> wrote:

>
> I'm trying to cross compile for a ppc platform from x86 Linux.
> I've used the same procedure as I used to successfully cross
> compile other tools (not to say that the procedure is actually right)
> but I get some errors.  Here's what I tried:
>
> setenv CC /opt/cross_compiler/ppc/gcc-4.1.0-glibc-2.3.6/powerpc-603-
> linux-gnu/bin/powerpc-603-linux-gnu-gcc
> setenv CXX /opt/cross_compiler/ppc/gcc-4.1.0-glibc-2.3.6/powerpc-603-
> linux-gnu/bin/powerpc-603-linux-gnu-g++
> setenv PATH "$PATH":/opt/cross_compiler/ppc/gcc-4.1.0-glibc-2.3.6/
> powerpc-603-linux-gnu/bin
> cd /tmp/pbmpc5200/protobuf-2.0.2rc1/
> ./configure --target=ppc-603-linux-gnu --host=ppc-603-linux-gnu --
> build=i686
> make
>
> Here are the errors:
> make[2]: Entering directory `/tmp/pbmpc5200/protobuf-2.0.2rc1/src'
> ./protoc google/protobuf/unittest.proto google/protobuf/
> unittest_import.proto google/protobuf/unittest_mset.proto google/
> protobuf/unittest_optimize_for.proto google/protobuf/
> unittest_embed_optimize_for.proto google/protobuf/
> unittest_custom_options.proto google/protobuf/compiler/cpp/
> cpp_test_bad_identifiers.proto -I. --cpp_out=.
> ./protoc: line 105: /tmp/pbmpc5200/protobuf-2.0.2rc1/src/.libs/lt-
> protoc: cannot execute binary file
> ./protoc: line 105: /tmp/pbmpc5200/protobuf-2.0.2rc1/src/.libs/lt-
> protoc: Success
> make[2]: *** [unittest_proto_middleman] Error 1
> make[2]: Leaving directory `/tmp/pbmpc5200/protobuf-2.0.2rc1/src'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/tmp/pbmpc5200/protobuf-2.0.2rc1'
> make: *** [all] Error 2
>
> The libprotobuf.so that I wanted actually was actually created and
> works, but there were
> errors reported.  Did I configure incorrectly or are these errors just
> expected when cross
> compiling?  I looks like it might be trying to run a cross compiled
> binary?
>
> Similarly, when cross compiling to win32 using mingw, I get an error:
>
> make[2]: Entering directory `/tmp/pbmingw/protobuf-2.0.2rc1/src'
> /bin/sh ../libtool --tag=CXX --mode=link /opt/cross-tools/bin/i386-
> mingw32msvc-g++  -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-
> compare -g -O2   -o protoc.exe  main.o  libprotobuf.la libprotoc.la
> /opt/cross-tools/bin/i386-mingw32msvc-g++ -Wall -Wwrite-strings -
> Woverloaded-virtual -Wno-sign-compare -g -O2 -o protoc.exe
> main.o  ./.libs/libprotobuf.a -L/tmp/mingwtmp/gcc-i386-mingw32msvc/
> i386-mingw32msvc/libstdc++-v3/src -L/tmp/mingwtmp/gcc-i386-mingw32msvc/
> i386-mingw32msvc/libstdc++-v3/src/.libs -L/tmp/mingwtmp/gcc-i386-
> mingw32msvc/gcc -L/opt/cross-tools/i386-mingw32msvc/bin -L/opt/cross-
> tools/i386-mingw32msvc/lib -L/opt/cross-tools/lib/../i386-mingw32msvc/
> lib ./.libs/libprotoc.a /tmp/pbmingw/protobuf-2.0.2rc1/src/.libs/
> libprotobuf.a /opt/cross-tools/i386-mingw32msvc/lib/libstdc++.a -lm
> ./.libs/libprotobuf.a: could not read symbols: Archive has no index;
> run ranlib to add one
> collect2: ld returned 1 exit status
> make[2]: *** [protoc.exe] Error 1
> make[2]: Leaving directory `/tmp/pbmingw/protobuf-2.0.2rc1/src'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/tmp/pbmingw/protobuf-2.0.2rc1'
> make: *** [all] Error 2
>
> Manually running ranlib on the library seems to work.  So in both
> cases,
> the builds gave errors but I was able to get the libraries I needed.
>
>
> Thanks,
>
>   David
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



cross compile errors

2008-10-21 Thread idht4n

I'm trying to cross compile for a ppc platform from x86 Linux.
I've used the same procedure as I used to successfully cross
compile other tools (not to say that the procedure is actually right)
but I get some errors.  Here's what I tried:

setenv CC /opt/cross_compiler/ppc/gcc-4.1.0-glibc-2.3.6/powerpc-603-
linux-gnu/bin/powerpc-603-linux-gnu-gcc
setenv CXX /opt/cross_compiler/ppc/gcc-4.1.0-glibc-2.3.6/powerpc-603-
linux-gnu/bin/powerpc-603-linux-gnu-g++
setenv PATH "$PATH":/opt/cross_compiler/ppc/gcc-4.1.0-glibc-2.3.6/
powerpc-603-linux-gnu/bin
cd /tmp/pbmpc5200/protobuf-2.0.2rc1/
./configure --target=ppc-603-linux-gnu --host=ppc-603-linux-gnu --
build=i686
make

Here are the errors:
make[2]: Entering directory `/tmp/pbmpc5200/protobuf-2.0.2rc1/src'
./protoc google/protobuf/unittest.proto google/protobuf/
unittest_import.proto google/protobuf/unittest_mset.proto google/
protobuf/unittest_optimize_for.proto google/protobuf/
unittest_embed_optimize_for.proto google/protobuf/
unittest_custom_options.proto google/protobuf/compiler/cpp/
cpp_test_bad_identifiers.proto -I. --cpp_out=.
./protoc: line 105: /tmp/pbmpc5200/protobuf-2.0.2rc1/src/.libs/lt-
protoc: cannot execute binary file
./protoc: line 105: /tmp/pbmpc5200/protobuf-2.0.2rc1/src/.libs/lt-
protoc: Success
make[2]: *** [unittest_proto_middleman] Error 1
make[2]: Leaving directory `/tmp/pbmpc5200/protobuf-2.0.2rc1/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/pbmpc5200/protobuf-2.0.2rc1'
make: *** [all] Error 2

The libprotobuf.so that I wanted actually was actually created and
works, but there were
errors reported.  Did I configure incorrectly or are these errors just
expected when cross
compiling?  I looks like it might be trying to run a cross compiled
binary?

Similarly, when cross compiling to win32 using mingw, I get an error:

make[2]: Entering directory `/tmp/pbmingw/protobuf-2.0.2rc1/src'
/bin/sh ../libtool --tag=CXX --mode=link /opt/cross-tools/bin/i386-
mingw32msvc-g++  -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-
compare -g -O2   -o protoc.exe  main.o  libprotobuf.la libprotoc.la
/opt/cross-tools/bin/i386-mingw32msvc-g++ -Wall -Wwrite-strings -
Woverloaded-virtual -Wno-sign-compare -g -O2 -o protoc.exe
main.o  ./.libs/libprotobuf.a -L/tmp/mingwtmp/gcc-i386-mingw32msvc/
i386-mingw32msvc/libstdc++-v3/src -L/tmp/mingwtmp/gcc-i386-mingw32msvc/
i386-mingw32msvc/libstdc++-v3/src/.libs -L/tmp/mingwtmp/gcc-i386-
mingw32msvc/gcc -L/opt/cross-tools/i386-mingw32msvc/bin -L/opt/cross-
tools/i386-mingw32msvc/lib -L/opt/cross-tools/lib/../i386-mingw32msvc/
lib ./.libs/libprotoc.a /tmp/pbmingw/protobuf-2.0.2rc1/src/.libs/
libprotobuf.a /opt/cross-tools/i386-mingw32msvc/lib/libstdc++.a -lm
./.libs/libprotobuf.a: could not read symbols: Archive has no index;
run ranlib to add one
collect2: ld returned 1 exit status
make[2]: *** [protoc.exe] Error 1
make[2]: Leaving directory `/tmp/pbmingw/protobuf-2.0.2rc1/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/pbmingw/protobuf-2.0.2rc1'
make: *** [all] Error 2

Manually running ranlib on the library seems to work.  So in both
cases,
the builds gave errors but I was able to get the libraries I needed.


Thanks,

   David


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---