Skip to content

Instantly share code, notes, and snippets.

@djungelorm
Last active February 20, 2018 21:04
Show Gist options
  • Save djungelorm/3c8f9d1749cd168c04125af05693c618 to your computer and use it in GitHub Desktop.
Save djungelorm/3c8f9d1749cd168c04125af05693c618 to your computer and use it in GitHub Desktop.
1. Install CodeBlocks (without MinGW if possible, as we will need to use a separate installation of MinGW anyway)
2. Download mingw-get-setup.exe from https://sourceforge.net/projects/mingw/files/Installer
Run mingw-get-setup.exe and install MinGW to C:\MinGW
(Note: It is essential that this path does not contain any spaces.)
When the installation manager window appears, mark the following for installation:
mingw32-base
mingw32-gcc-g++
msys-base
msys-autoconf (class bin)
msys-libtool (class bin)
Apply the changes by clicking Installation -> Apply Changes, then Apply
Wait for the update manager to download and install updates, then close it
Download these three glib, pkg-config, pkg-config-dev archives and extract contents to C:\MinGW
4. Download protobuf-cpp-3.4.1.zip from https://github.com/google/protobuf/releases
Extract it into C:\MinGW\msys\1.0\src\protobuf (create the src directory if it doesn't exist)
(Make sure there aren't extra sub-folders, C:\MinGW\msys\1.0\src\protobuf should contain a file called configure - and many others)
5. Download asio-1.10.6.zip from https://sourceforge.net/projects/asio/files/asio/1.10.6%20%28Stable%29/
Extract it into C:\MinGW\msys\1.0\src\asio
(Make sure there aren't extra sub-folders, C:\MinGW\msys\1.0\src\asio should contain a file called configure - and many others)
6. Download krpc-0.4.4-cpp.zip and extract it to C:\MinGW\msys\1.0\src\krpc
(Again, make sure there aren't extra sub-folders, C:\MinGW\msys\1.0\src\krpc should contain a file called configure - and many others)
7. Run C:\MinGW\msys\1.0\msys.bat to open the msys shell
8. Build and install protobuf by running the following commands:
cd /src/protobuf
./autogen.sh
./configure CXXFLAGS="-std=gnu++11"
make install
(Note: the protobuf installation instructions claim you don't need to run autogen.sh, but you actually do as msys has
an older version of autotools than they expect)
9. Change directory to asio and install its header files by running the following commands:
cd /src/asio
./configure --without-boost
make -C include install
10. Edit the file C:\MinGW\msys\1.0\src\krpc\configure.ac and remove the line reading "PKG_CHECK_MODULES([protobuf], [protobuf >= 3.3])"
This disables the use of pkg-config which is not available in msys
Change directory to krpc and build and install it by running the following commands:
cd /src/krpc
autoreconf --force --install
./configure CXXFLAGS="-I/usr/local/include"
make install
12. You can now close the msys shell window
13. The protobuf and krpc DLLs should now be available in C:\MinGW\msys\1.0\usr\local\lib
The header files for all three libraries should be in C:\MinGW\msys\1.0\usr\local\include
You should be able to add these paths to your include and linker path settings in CodeBlocks when compiling your krpc program.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment