diff -Nru netbeans-7.0.1+dfsg1/debian/changelog netbeans-7.0.1+dfsg1/debian/changelog
--- netbeans-7.0.1+dfsg1/debian/changelog	2011-12-02 00:05:26.000000000 +0000
+++ netbeans-7.0.1+dfsg1/debian/changelog	2011-12-04 21:36:57.000000000 +0000
@@ -1,3 +1,9 @@
+netbeans (7.0.1+dfsg1-4ubuntu1) precise; urgency=low
+
+  * Filter out -Wl,-z,relro from LDFLAGS, not known by mingw.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun, 04 Dec 2011 22:34:24 +0100
+
 netbeans (7.0.1+dfsg1-4) unstable; urgency=low
 
   * Patch core.osgi to use osgi-core 4.3. (Closes: #649750)
diff -Nru netbeans-7.0.1+dfsg1/debian/rules netbeans-7.0.1+dfsg1/debian/rules
--- netbeans-7.0.1+dfsg1/debian/rules	2011-12-02 00:05:26.000000000 +0000
+++ netbeans-7.0.1+dfsg1/debian/rules	2011-12-04 21:36:38.000000000 +0000
@@ -47,6 +47,14 @@
 			       grep -e '^Version' | \
                                perl -pi -e 's/^Version:\s+(.*)\+dfsg\d+-\d+$$/$$1/')
 
+# Ubuntu sets LDFLAGS in the environment, including -Wl,-z,relro,
+# which is not recognized by mingw
+COMMA=,
+LDFLAGS := $(filter-out -Wl$(COMMA)-z$(COMMA)relro,$(LDFLAGS))
+ifneq (,$(LDFLAGS))
+  export LDFLAGS
+endif
+
 # Defined function to be used to create symlinks
 define symlink
 	mkdir -p $(dir $(2))
