diff --git a/c2hs/c/CParserMonad.hs b/c2hs/c/CParserMonad.hs
--- a/c2hs/c/CParserMonad.hs
+++ b/c2hs/c/CParserMonad.hs
@@ -37,6 +37,7 @@
 --- TODO ----------------------------------------------------------------------
 --
 --
+{-# LANGUAGE CPP #-}
 
 module CParserMonad ( 
   P, 
@@ -97,7 +98,10 @@
 instance Monad P where
   return = returnP
   (>>=) = thenP
+
+#if !MIN_VERSION_base(4,13,0)
   fail m = getPos >>= \pos -> failP pos [m]
+#endif
 
 execParser :: P a -> String -> Position -> [Ident] -> [Name]
            -> Either a ([String], Position)
diff --git a/gtk2hs-buildtools.cabal b/gtk2hs-buildtools.cabal
--- a/gtk2hs-buildtools.cabal
+++ b/gtk2hs-buildtools.cabal
@@ -1,5 +1,5 @@
 Name:   gtk2hs-buildtools
-Version:        0.13.5.0
+Version:        0.13.5.1
 License:        GPL-2
 License-file:   COPYING
 Copyright:      (c) 2001-2010 The Gtk2Hs Team
@@ -115,6 +115,7 @@
         default-language:   Haskell98
         default-extensions: ForeignFunctionInterface
                             BangPatterns
+                            NoMonadFailDesugaring
 
         if flag(ClosureSignals)
           cpp-options:   -DUSE_GCLOSURE_SIGNALS_IMPL
diff --git a/src/Gtk2HsSetup.hs b/src/Gtk2HsSetup.hs
--- a/src/Gtk2HsSetup.hs
+++ b/src/Gtk2HsSetup.hs
@@ -65,6 +65,7 @@
 import Data.Char (isAlpha, isNumber)
 import qualified Data.Map as M
 import qualified Data.Set as S
+import qualified Distribution.PackageDescription as PD
 import qualified Distribution.Simple.LocalBuildInfo as LBI
 import qualified Distribution.InstalledPackageInfo as IPI
        (installedUnitId)
@@ -84,7 +85,11 @@
 #endif
 
 onDefaultSearchPath f a b = f a b defaultProgramSearchPath
+#if MIN_VERSION_Cabal(2,5,0)
+libraryConfig lbi = case [clbi | (LBI.CLibName _, clbi, _) <- LBI.componentsConfigs lbi] of
+#else
 libraryConfig lbi = case [clbi | (LBI.CLibName, clbi, _) <- LBI.componentsConfigs lbi] of
+#endif
   [clbi] -> Just clbi
   _ -> Nothing
 
@@ -176,7 +181,12 @@
          -> IO ()
 register pkg@PackageDescription { library       = Just lib  } lbi regFlags
   = do
-    let clbi = LBI.getComponentLocalBuildInfo lbi LBI.CLibName
+    let clbi = LBI.getComponentLocalBuildInfo lbi
+#if MIN_VERSION_Cabal(2,5,0)
+                   (LBI.CLibName $ PD.libName lib)
+#else
+                    LBI.CLibName
+#endif
 
     absPackageDBs       <- absolutePackageDBPaths packageDbs
     installedPkgInfoRaw <- generateRegistrationInfo
