diff --git a/community/loudmouth/APKBUILD b/community/loudmouth/APKBUILD
index ff2629ddde2e17dbeedd3d026b527b0f8b6e47f7..b70e8be0056485f4df185b033159f09099416ebc 100644
--- a/community/loudmouth/APKBUILD
+++ b/community/loudmouth/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
 pkgname=loudmouth
 pkgver=1.5.4
-pkgrel=0
+pkgrel=1
 pkgdesc="A lightweight Jabber client library"
 url="http://groups.google.com/group/loudmouth-dev"
 arch="all"
@@ -10,7 +10,9 @@ license="LGPL-2.0-or-later"
 depends_dev="pkgconfig gnutls-dev libidn-dev libasyncns-dev check-dev autoconf"
 makedepends="$depends_dev glib-dev"
 subpackages="$pkgname-dev"
-source="https://mcabber.com/files/loudmouth/loudmouth-$pkgver.tar.bz2"
+source="https://mcabber.com/files/loudmouth/loudmouth-$pkgver.tar.bz2
+	fix-freeaddrinfo.patch
+	"
 
 prepare() {
 	default_prepare
@@ -41,4 +43,5 @@ package() {
 
 sha512sums="
 49a08f0130b9ee56f07586d244504c81242723865a136b03e1049f32b1aa1e6c49e9b76b38f0cfb812ef4c66f73b7d83914a58e9a93e0496207e06c2b5efa9d8  loudmouth-1.5.4.tar.bz2
+935c2534c9b895df58da20919e7d50f56bedc83289141d82d1d31dba506eafd16282e9a18b30848701cbd94340f5c0e0f37af229657a2b3d5ea38d582352cbaa  fix-freeaddrinfo.patch
 "
diff --git a/community/loudmouth/fix-freeaddrinfo.patch b/community/loudmouth/fix-freeaddrinfo.patch
new file mode 100644
index 0000000000000000000000000000000000000000..bc8852f868058cc650ffa1b8cde43b2a4c16616f
--- /dev/null
+++ b/community/loudmouth/fix-freeaddrinfo.patch
@@ -0,0 +1,14 @@
+--- a/loudmouth/lm-asyncns-resolver.h
++++ b/loudmouth/lm-asyncns-resolver.h
+@@ -20,6 +20,11 @@
+ #define __LM_ASYNCNS_RESOLVER_H__
+ 
+ #include <glib-object.h>
++#include <config.h>
++
++#ifdef HAVE_ASYNCNS
++#define freeaddrinfo(x) asyncns_freeaddrinfo(x)
++#endif
+ 
+ #include "lm-resolver.h"
+