Index: log4cpp/src/PatternLayout.cpp
===================================================================
--- log4cpp.orig/src/PatternLayout.cpp
+++ log4cpp/src/PatternLayout.cpp
@@ -373,7 +373,9 @@ namespace log4cpp {
                         literal = "";
                     }
                     if ((minWidth != 0) || (maxWidth != 0)) {
-                        component = new FormatModifierComponent(component, std::abs(minWidth), maxWidth, minWidth < 0);
+                        if (minWidth < 0)
+                          minWidth *= -1;
+                        component = new FormatModifierComponent(component, minWidth, maxWidth, minWidth < 0);
                         minWidth = maxWidth = 0;
                     }
                     _components.push_back(component);
Index: log4cpp/src/BasicLayout.cpp
===================================================================
--- log4cpp.orig/src/BasicLayout.cpp
+++ log4cpp/src/BasicLayout.cpp
@@ -16,6 +16,7 @@
 #ifdef LOG4CPP_HAVE_SSTREAM
 #include <sstream>
 #endif
+#include <memory>
 
 namespace log4cpp {
 
