diff --git a/testing/hdf4/APKBUILD b/testing/hdf4/APKBUILD
index 0fd1d69e08ae4d9bc356a06278844fa8104f4c68..4fe64fde8aca2dac638e443458afcb1847ea5a30 100644
--- a/testing/hdf4/APKBUILD
+++ b/testing/hdf4/APKBUILD
@@ -2,13 +2,13 @@
 # Maintainer: Edd Salkield <edd@salkield.uk>
 pkgname=hdf4
 pkgver=4.2.15
-pkgrel=1
+pkgrel=2
 pkgdesc="Data model, library, and file format for storing and managing data"
 url="https://www.hdfgroup.org/solutions/hdf4/"
 arch="all !riscv64" # ftbfs
 license="custom"
 options="!check" # Upstream tests appear broken
-depends_dev="zlib-dev jpeg-dev portablexdr-dev"
+depends_dev="zlib-dev jpeg-dev libtirpc-dev"
 makedepends="$depends_dev bison flex libaec-dev chrpath"
 checkdepends="diffutils" # Flags not supported by busybox diff are used
 subpackages="$pkgname-dev $pkgname-doc $pkgname-tools"
@@ -21,7 +21,8 @@ source="https://support.hdfgroup.org/ftp/HDF/releases/HDF$pkgver/src/hdf-$pkgver
 	40-hdf-arm.patch
 	50-hdf-aarch64.patch
 	60-hdf-ppc64le.patch
-	70-hdf-loongarch64.patch"
+	70-hdf-loongarch64.patch
+	gcc14.patch"
 builddir="$srcdir"/hdf-"$pkgver"
 
 prepare() {
@@ -38,7 +39,9 @@ build() {
 	# > export FFLAGS="$FFLAGS -fallow-argument-mismatch"
 	# However, --enable-shared currently requires that fortran is disabled, so
 	# it doesn't matter anyway
-	export LIBS="$LIBS -lportablexdr"
+	export CFLAGS="$CFLAGS -Wno-implicit-function-declaration -Wno-implicit-int -Wno-incompatible-pointer-types"
+	export CPPFLAGS="$CPPFLAGS -I/usr/include/tirpc"
+	export LIBS="$LIBS -ltirpc"
 
 	# We disable netcdf since it's provided by the netcdf-* packages
 	./configure \
@@ -116,4 +119,5 @@ b9ea7c626fcf1bfbf75e05459794fc577a28602749464f2eea029fc4d729ceeb96f93273cc9ea898
 fac62b5ab9ceaf9ddd9cc4831994cdf5cc4e0b2f85ee9f943f7311b0acc2b78d18f49e194a31b7ddd0c17dc87a14ec55d6af73258fbc2f0f2e2b86b7f9048f25  50-hdf-aarch64.patch
 824be68ce54c43ea8e556cd9836b8d18162e3a214d532ce40ca7de600693da89dcbc364aae5995c2cd455126550d88606889c5e1c956c4cb9f1928566c705121  60-hdf-ppc64le.patch
 9e3c9f726c2ee9bd29a70211c91a5b6afa6bcc26708cfa2fe844ba2f3a2e69587cff028cca73febe83dd8fea62ad9abee52c301de301e2d9f4d77dbfdee8f293  70-hdf-loongarch64.patch
+8c07bb9c0a185720879d24037f252686686133ebd4fed1e36caddc36e4be40f894b2a56c41fc4ffb09dae14f013a66bf1bbbae1980ab2c9aef86e7a53ec5f0e3  gcc14.patch
 "
diff --git a/testing/hdf4/gcc14.patch b/testing/hdf4/gcc14.patch
new file mode 100644
index 0000000000000000000000000000000000000000..924aa4462d1abaf62fb8b75ed9c7baec8370ad25
--- /dev/null
+++ b/testing/hdf4/gcc14.patch
@@ -0,0 +1,72 @@
+--- hdf-4.2.15.orig/hdf/test/buffer.c
++++ hdf-4.2.15/hdf/test/buffer.c
+@@ -46,6 +46,7 @@
+ 
+ #define TESTMASTER
+ 
++#include <time.h>
+ #include "hdf.h"
+ #ifdef H4_HAVE_SYS_TIME_H
+ #include <sys/time.h>
+--- hdf-4.2.15.orig/hdf/util/he_file.c
++++ hdf-4.2.15/hdf/util/he_file.c
+@@ -17,9 +17,7 @@
+ #include "he.h"
+ 
+ /* get the prototype for the wait() func. */
+-#if defined SUN | defined HP9000 | defined IRIX | defined UNIX386
+ #include <sys/wait.h>
+-#endif /* SUN | HP9000 */
+ #ifdef H4_HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+@@ -125,7 +123,7 @@
+     if (fork() == 0)
+       {
+           /* this is the child */
+-          if (execl(editor, editor, file, 0) == -1)
++          if (execl(editor, editor, file, NULL) == -1)
+               fprintf(stderr, "Error while editing label.\n");
+ 
+           /* return control to the parent if exec fails
+@@ -134,7 +132,7 @@
+       }
+ 
+     /* the parent waits for the child to die */
+-    wait(0);
++    wait(NULL);
+ #elif defined(H4_HAVE_SYSTEM)
+     {   char    cmd[256];
+         if (HDstrlen(editor) > 100) {
+--- hdf-4.2.15.orig/mfhdf/libsrc/file.c
++++ hdf-4.2.15/mfhdf/libsrc/file.c
+@@ -20,6 +20,7 @@
+ #include <assert.h>
+ #endif /* DEBUG */
+ 
++#include <unistd.h>
+ #include    <string.h>
+ #include    <errno.h>
+ #include    "local_nc.h"
+--- hdf-4.2.15.orig/mfhdf/test/hdftest.c
++++ hdf-4.2.15/mfhdf/test/hdftest.c
+@@ -59,7 +59,7 @@
+ extern int test_coordvar();
+ extern int test_chunk();
+ extern int test_compression();
+-extern int test_dimension();
++extern int test_dimensions();
+ extern int test_attributes();
+ extern int test_datasizes();
+ extern int test_datainfo();
+--- hdf-4.2.15.orig/mfhdf/test/tncvargetfill.c
++++ hdf-4.2.15/mfhdf/test/tncvargetfill.c
+@@ -33,6 +33,8 @@
+ #include "mfhdf.h"
+ #include "hdftest.h"
+ 
++extern int verify_info_data(int32 sds_id, int32 expected_dimsize, int16 *result);
++
+ #define DIM0 20	/* this value is used to declare larger buffer for when
+ 		   reading past the maximum number of records in the file */
+