Windows用户= = = = = = = = = = = = = # #从源代码构建protobuf RProtoBufLib包维护者(只有)# # # #构建与MSYS2附带rtools4.0 1。Rtools (4.0) 2。MSYS2 MINGW32壳发射器(即开放。c: \ rtools40 \ mingw32.exe)以便所有nix工具可用来构建脚本3。mkdir 32 32 & & & & cd . ./ protobuf_src_folder /配置——prefix =。/ 32 /安装& & make install 4。打开MSYS2 MINGW64壳发射器(即。c: \ rtools40 \ mingw64.exe) 5。构建64位自由类似3)# # # #构建MYSYS1.0 + mingw 1。Rtools (3. x) 2。 install MSYS-1.0.11 3. point it to the mingw_32(by mounting mingw_32 to /mingw in fstab file) installed by Rtools 4. open MYSYS terminal (so that all the nix tools are available for building script) 5. mkdir 32 && cd 32 && ../protobuf_src_folder/configure --prefix=./32/install && make install 6. mounting mingw_64 to /mingw in fstab file 7. build 64 bit lib similar to 5) ## cross-compiling protobuf It is now not working due to the incompatible exception model used by mingw on linux (sjlj) vs Rtools (dwarf). Unless manually build mingw from src with --disable-sjlj and --enable-dwarf 1. install cross-compiling tool chain on linux (and With mingw there are two different threading models: posix and win32. need to use posix e.g. update-alternatives --config x86_64-w64-mingw32-g++) 2. download the source 2. first install protobuf on local linux (so that 'protoc' command is available for cross compiling later on 3. the run configure script for win64: configure --host=x86_64-w64-mingw32 --prefix=/your_path/protobuf/x64 --enable-shared=no --with-protoc=protoc LDFLAGS='-static-libgcc' CXXFLAGS=-DHAVE_PTHREAD=1 4. then run make and make install 5. for win32: (need manually cp the .a file due to the error of target libprotoc configure --host=i686-w64-mingw32 --prefix=/your_path/protobuf/i386 --enable-shared=no --with-protoc=protoc LDFLAGS='-static-libgcc' CXXFLAGS=-DHAVE_PTHREAD=1