diff --git a/srcpkgs/freecad/patches/020-namespace-missing-std.patch b/srcpkgs/freecad/patches/020-namespace-missing-std.patch
new file mode 100644
index 0000000000..82033cd5af
--- /dev/null
+++ b/srcpkgs/freecad/patches/020-namespace-missing-std.patch
@@ -0,0 +1,127 @@
+# reason: fix build with gcc9
+# upstream: yes
+
+diff --git src/3rdParty/salomesmesh/inc/Rn.h src/3rdParty/salomesmesh/inc/Rn.h
+index 6ec871d93..e92d2275a 100644
+--- src/3rdParty/salomesmesh/inc/Rn.h
++++ src/3rdParty/salomesmesh/inc/Rn.h
+@@ -180,12 +180,12 @@ class R4: public R3
+ {
+ friend std::ostream& operator <<(std::ostream& f, const R4 & P )
+ { f << P.x << ' ' << P.y << ' ' << P.z << ' ' << P.omega; return f; }
+- friend istream& operator >>(istream& f, R4 & P)
++ friend std::istream& operator >>(std::istream& f, R4 & P)
+ { f >> P.x >> P.y >> P.z >> P.omega ; return f; }
+
+ friend std::ostream& operator <<(std::ostream& f, const R4 * P )
+ { f << P->x << ' ' << P->y << ' ' << P->z << ' ' << P->omega; return f; }
+- friend istream& operator >>(istream& f, R4 * P)
++ friend std::istream& operator >>(std::istream& f, R4 * P)
+ { f >> P->x >> P->y >> P->z >> P->omega ; return f; }
+
+ public:
+
+
+diff --git src/Mod/Drawing/App/DrawingExport.cpp src/Mod/Drawing/App/DrawingExport.cpp
+index 0c3c23231..550b12c25 100644
+--- src/Mod/Drawing/App/DrawingExport.cpp
++++ src/Mod/Drawing/App/DrawingExport.cpp
+@@ -81,6 +81,7 @@
+ #include
+
+ using namespace Drawing;
++using namespace std;
+
+ TopoDS_Edge DrawingOutput::asCircle(const BRepAdaptor_Curve& c) const
+ {
+diff --git src/Mod/Part/App/Geometry2d.cpp src/Mod/Part/App/Geometry2d.cpp
+index fb1de909c..979465533 100644
+--- src/Mod/Part/App/Geometry2d.cpp
++++ src/Mod/Part/App/Geometry2d.cpp
+@@ -83,6 +83,7 @@
+ #include
+
+ using namespace Part;
++using namespace std;
+
+ extern const char* gce_ErrorStatusText(gce_ErrorType et);
+
+diff --git src/Mod/Raytracing/App/AppRaytracingPy.cpp src/Mod/Raytracing/App/AppRaytracingPy.cpp
+index d48c51c97..1bb2b1b01 100644
+--- src/Mod/Raytracing/App/AppRaytracingPy.cpp
++++ src/Mod/Raytracing/App/AppRaytracingPy.cpp
+@@ -40,6 +40,8 @@
+ #include
+ #include
+
++using namespace std;
++
+
+ namespace Raytracing {
+ class Module : public Py::ExtensionModule
+diff --git src/Mod/Raytracing/App/LuxFeature.cpp src/Mod/Raytracing/App/LuxFeature.cpp
+index 930fe12b7..d1e0a0089 100644
+--- src/Mod/Raytracing/App/LuxFeature.cpp
++++ src/Mod/Raytracing/App/LuxFeature.cpp
+@@ -38,6 +38,7 @@
+
+
+ using namespace Raytracing;
++using namespace std;
+
+ PROPERTY_SOURCE(Raytracing::LuxFeature, Raytracing::RaySegment)
+
+diff --git src/Mod/Raytracing/App/RayFeature.cpp src/Mod/Raytracing/App/RayFeature.cpp
+index cdd2cb6dc..235a98685 100644
+--- src/Mod/Raytracing/App/RayFeature.cpp
++++ src/Mod/Raytracing/App/RayFeature.cpp
+@@ -36,6 +36,7 @@
+
+
+ using namespace Raytracing;
++using namespace std;
+
+ PROPERTY_SOURCE(Raytracing::RayFeature, Raytracing::RaySegment)
+
+diff --git src/Mod/TechDraw/App/Geometry.cpp src/Mod/TechDraw/App/Geometry.cpp
+index c10b63177..d34eeb9bb 100644
+--- src/Mod/TechDraw/App/Geometry.cpp
++++ src/Mod/TechDraw/App/Geometry.cpp
+@@ -80,6 +80,7 @@
+ #include "Geometry.h"
+
+ using namespace TechDraw;
++using namespace std;
+
+ // Collection of Geometric Features
+ Wire::Wire()
+
+
+--- src/Mod/Part/App/PropertyTopoShape.cpp
++++ src/Mod/Part/App/PropertyTopoShape.cpp
+@@ -281,11 +281,11 @@
+ static Standard_Boolean BRepTools_Write(const TopoDS_Shape& Sh,
+ const Standard_CString File)
+ {
+- ofstream os;
++ std::ofstream os;
+ #if OCC_VERSION_HEX >= 0x060800
+- OSD_OpenStream(os, File, ios::out);
++ OSD_OpenStream(os, File, std::ios::out);
+ #else
+- os.open(File, ios::out);
++ os.open(File, std::ios::out);
+ #endif
+ if (!os.rdbuf()->is_open()) return Standard_False;
+
+
+--- src/Mod/Part/App/Geometry.cpp
++++ src/Mod/Part/App/Geometry.cpp
+@@ -141,6 +141,7 @@
+ #include "Geometry.h"
+
+ using namespace Part;
++using namespace std;
+
+
+ const char* gce_ErrorStatusText(gce_ErrorType et)
diff --git a/srcpkgs/freecad/template b/srcpkgs/freecad/template
index e641ed2a60..9e9375c444 100644
--- a/srcpkgs/freecad/template
+++ b/srcpkgs/freecad/template
@@ -1,7 +1,7 @@
# Template file for 'freecad'
pkgname=freecad
version=0.18.3
-revision=1
+revision=2
wrksrc="FreeCAD-${version}"
build_style=cmake