Search code examples
c++boostpatch

How to install/apply C++ patch?


I'm trying to make an old, legacy project compile on my computer. I'm stuck on #error "Threading support unavailable: it has been explicitly disabled with BOOST_DISABLE_THREADS and stumbled on a patch for it. See this question. I downloaded the patch file.

What am I supposed to do with it? How can I install it? Putting it inside the specified folder (...\boost_1_48_0\boost\config\stdlib) didn't help.

I'm using boost 1.48; CodeBlocks IDE and cygwin on Windows 10.

The patch looks like this:

Index: boost/config/stdlib/libstdcpp3.hpp
===================================================================
--- boost/config/stdlib/libstdcpp3.hpp  (revision 75635)
+++ boost/config/stdlib/libstdcpp3.hpp  (working copy)
@@ -33,7 +33,8 @@
 
 #ifdef __GLIBCXX__ // gcc 3.4 and greater:
 #  if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
-        || defined(_GLIBCXX__PTHREADS)
+        || defined(_GLIBCXX__PTHREADS) \
+        || defined(_GLIBCXX_HAS_GTHREADS)
       //
       // If the std lib has thread support turned on, then turn it on in Boost
       // as well.  We do this because some gcc-3.4 std lib headers define _REENTANT

Solution

  • Assuming you put the patch under boost_1_48_0/threads.patch, you should be able to apply it with

    cd ...\boost_1_48_0
    patch -p0 < threads.patch
    

    You can remove the patch file afterwards.