alexeyxo / protobuf-swift

Google ProtocolBuffers for Apple Swift
http://protobuf.io/#swift
Apache License 2.0
940 stars 138 forks source link

Errors while trying to build protobuf-swift 2.2 #85

Closed vyshane closed 9 years ago

vyshane commented 9 years ago

I'm trying to install the Protobuf compiler but I am getting build errors.

First I tried to install via Homebrew:

shane@rmbp > protoc --version
libprotoc 3.0.0
shane@rmbp > brew install protobuf-swift
==> Downloading https://github.com/alexeyxo/protobuf-swift/archive/2.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/protobuf-swift-2.2.tar.gz
==> ./autogen.sh
==> ./configure --prefix=/usr/local/Cellar/protobuf-swift/2.2
==> make
 ^
3 errors generated.
make[2]: *** [swift_message_field.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Next I checked out tag 2.2 from the repository and tried to build it:

shane@rmbp > git checkout tags/2.2
HEAD is now at 4cfef1b... WatchOS deployment target
shane@rmbp > git status
HEAD detached at 2.2
nothing to commit, working directory clean
shane@rmbp > ./scripts/build.sh &> ~/Desktop/build.log

Here are the contents of build.log:

+ ./autogen.sh
+ mkdir -p m4
+ autoreconf -f -i -Wall
glibtoolize: putting auxiliary files in '.'.
glibtoolize: copying file './ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: copying file 'm4/libtool.m4'
glibtoolize: copying file 'm4/ltoptions.m4'
glibtoolize: copying file 'm4/ltsugar.m4'
glibtoolize: copying file 'm4/ltversion.m4'
glibtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:13: installing './compile'
configure.ac:10: installing './missing'
src/compiler/Makefile.am: installing './depcomp'
+ rm -rf autom4te.cache configure.ac~ config.h.in~
+ ./configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
checking build system type... x86_64-apple-darwin15.0.0
checking host system type... x86_64-apple-darwin15.0.0
checking target system type... x86_64-apple-darwin15.0.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking C++ compiler flags...... use user-supplied: -I/usr/local/include
configure: WARNING: Libtool does not cope well with whitespace in `pwd`
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin15.0.0 file names to x86_64-apple-darwin15.0.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin15.0.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin15.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common -DPIC
checking if g++ PIC flag -fno-common -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin15.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for inttypes.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for working memcmp... yes
checking for working strtod... yes
checking for ftruncate... yes
checking for memset... yes
checking for mkdir... yes
checking for strchr... yes
checking for strerror... yes
checking for strtol... yes
checking google/protobuf/stubs/common.h usability... yes
checking google/protobuf/stubs/common.h presence... no
configure: WARNING: google/protobuf/stubs/common.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: google/protobuf/stubs/common.h: proceeding with the compiler's result
checking for google/protobuf/stubs/common.h... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/compiler/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
+ make clean
Making clean in src/compiler
 rm -f protoc-gen-swift
rm -rf .libs _libs
rm -f *.o
rm -f google/protobuf/*.o
rm -f *.lo
rm -rf .libs _libs
rm -f *.lo
+ make -j8
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src/compiler
depbase=`echo main.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT main.o -MD -MP -MF $depbase.Tpo -c -o main.o main.cc &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo swift_enum_field.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT swift_enum_field.o -MD -MP -MF $depbase.Tpo -c -o swift_enum_field.o swift_enum_field.cc &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo swift_map_field.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT swift_map_field.o -MD -MP -MF $depbase.Tpo -c -o swift_map_field.o swift_map_field.cc &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo swift_file.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT swift_file.o -MD -MP -MF $depbase.Tpo -c -o swift_file.o swift_file.cc &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo swift_message_field.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT swift_message_field.o -MD -MP -MF $depbase.Tpo -c -o swift_message_field.o swift_message_field.cc &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo swift_oneof.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT swift_oneof.o -MD -MP -MF $depbase.Tpo -c -o swift_oneof.o swift_oneof.cc &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo swift_enum.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT swift_enum.o -MD -MP -MF $depbase.Tpo -c -o swift_enum.o swift_enum.cc &&\
    mv -f $depbase.Tpo $depbase.Po
depbase=`echo swift_generator.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT swift_generator.o -MD -MP -MF $depbase.Tpo -c -o swift_generator.o swift_generator.cc &&\
    mv -f $depbase.Tpo $depbase.Po
In file included from swift_generator.cc:22:
./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers.  Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
In file included from swift_file.cc:23:
./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers.  Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
In file included from swift_map_field.cc:25:
In file included from /usr/local/include/google/protobuf/wire_format.h:44:
./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers.  Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
In file included from swift_oneof.cc:24:
./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers.  Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
In file included from swift_enum.cc:24:
./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers.  Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
In file included from swift_message_field.cc:24:
In file included from /usr/local/include/google/protobuf/wire_format.h:44:
./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers.  Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
In file included from swift_enum_field.cc:25:
In file included from /usr/local/include/google/protobuf/wire_format.h:44:
./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers.  Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
depbase=`echo swift_primitive_field.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    g++ -DHAVE_CONFIG_H -I. -I../..     -I/usr/local/include -MT swift_primitive_field.o -MD -MP -MF $depbase.Tpo -c -o swift_primitive_field.o swift_primitive_field.cc &&\
    mv -f $depbase.Tpo $depbase.Po
3 errors generated.
make[2]: *** [swift_oneof.o] Error 1
make[2]: *** Waiting for unfinished jobs....
3 errors generated.
make[2]: *** [swift_enum.o] Error 1
3 errors generated.
make[2]: *** [swift_generator.o] Error 1
3 errors generated.
3 errors generated.
make[2]: *** [swift_enum_field.o] Error 1
make[2]: *** [swift_message_field.o] Error 1
3 errors generated.
make[2]: *** [swift_map_field.o] Error 1
In file included from swift_primitive_field.cc:25:
In file included from /usr/local/include/google/protobuf/wire_format.h:44:
./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers.  Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
3 errors generated.
make[2]: *** [swift_file.o] Error 1
3 errors generated.
make[2]: *** [swift_primitive_field.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Anveena commented 9 years ago

try "$ brew prune" before u start

alexeyxo commented 9 years ago

Hi. "Homebrew" stores version for a stable protocol buffers 2.6. You should use git branch named as Protobuf3.0-Swift2.0.

vyshane commented 9 years ago

@alexeyxo Thanks, that worked :+1:

alexeyxo commented 9 years ago

N.P.;)

hangpuyan commented 8 years ago

In file included from objc_enum_field.cc:25: In file included from /usr/local/include/google/protobuf/wire_format.h:44: ./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is

error This file was generated by an older version of protoc which is

^ ./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers. Please

error incompatible with your Protocol Buffer headers. Please

^ ./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.

error regenerate this file with a newer version of protoc.

^ 3 errors generated. make[2]: *\ [objc_enum_field.o] Error 1

hangpuyan commented 8 years ago

help me,please

hangpuyan commented 8 years ago

i user google protobuf obj-c, ./google/protobuf/descriptor.pb.h:17:2: error: This file was generated by an older version of protoc which is

error This file was generated by an older version of protoc which is

^ ./google/protobuf/descriptor.pb.h:18:2: error: incompatible with your Protocol Buffer headers. Please

error incompatible with your Protocol Buffer headers. Please

^ ./google/protobuf/descriptor.pb.h:19:2: error: regenerate this file with a newer version of protoc.

hangpuyan commented 8 years ago

i do not know how to do