1

I am trying to recreate an environment for a C++ program that uses google's protobuf 3.5.1.1. I have built protobuf using MinGW, and all seems well. When I run the make check command, I get 5 passes and 1 fail (protobuf-test.exe fails).

The commands that I run in MSYS2 are:

./autogen.sh

./configure

make

make check

When I try to build the program that uses protobuf, I get a massive wall of linker errors.

Any suggestions on how to fix this issue is appreciated.

Thank you!

----- Edit -----

To solve this issue, I needed to update make protobuf in the MSYS2 MinGW 32-bit terminal.

I also needed to update MSYS2 by following these directions

emesel
  • 23
  • 6

1 Answers1

0

Try cross compiling in a linux environment then running your make install through msys2 on windows platform.

./configure --help will display a list of flags you can include. Specifically --target="your desired target"

Noble
  • 104
  • 10
  • Will try. What flags do you recommend adding to the `./configure` @Noble? – emesel Jun 05 '18 at 15:51
  • from https://stackoverflow.com/questions/26436386/program-with-protocol-buffers-dont-compile-with-mingw-w64-undefined-reference . you can add ./configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32 --with-protoc=protoc LDFLAGS='-static' – Noble Jun 05 '18 at 15:52
  • You can also check the protobuf github to check the current build status for each platform. It looks like windows is having troubles with building. – Noble Jun 05 '18 at 15:57
  • I tried using that flag, and it didn't work. I read online to use the flags `--host=i686-w64-mingw32.static LDFLAGS='-static'`, so I will try that now – emesel Jun 05 '18 at 16:17
  • You might also try compiling in cygwin instead https://stackoverflow.com/questions/27991975/protobuf-3-0-0-alpha-1-not-compiling-on-windows?rq=1 – Noble Jun 05 '18 at 16:37
  • After successfully compiling protobuf in linux using the flags `--host=i686-w64-mingw32.static LDFLAGS='-static'` I linked a program to the libprotobuf.a and I get an even bigger wall of errors. – emesel Jun 05 '18 at 16:57
  • https://groups.google.com/forum/#!topic/protobuf/V7gjNPccERw . Try cmake with cygwin. Do you know specific errors you are getting? – Noble Jun 05 '18 at 17:10
  • Trying now to build in Cygwin with cmake. As for the errors, they seem to be linker errors for the libprotobuf.a. I'll report back on how the Cygwin build went. – emesel Jun 05 '18 at 18:15
  • No luck with cmake on Cygwin or cross compiling. I was trying to fix an issue where Cygwin didn't recognize the '\r' character in the `./autogen.sh`. I was able to cross compile with the configure flags `--target=i686-w64-mingw32 --prefix=/usr`, but I was unable to install – emesel Jun 06 '18 at 13:18
  • I found out my issue. the problem was that I needed to update pacman (as specified [here](https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&-MSYS2)) and I needed to build protobuf in the `MSYS2 MinGW 32-bit` terminal. Thank you for your help!!! – emesel Jun 08 '18 at 19:22