https://bugs.gentoo.org/981665
https://github.com/nmap/nmap/pull/3434

From 9126a3bac1d508619ba1eb2d451d5f915710c3eb Mon Sep 17 00:00:00 2001
From: Ivan Pavlov <AuthorReflex@gmail.com>
Date: Wed, 12 Aug 2026 11:21:17 +0300
Subject: [PATCH] Fix compilation when NOLUA flag is defined

---
 nmap.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/nmap.cc b/nmap.cc
index b94c71223d..70206daed3 100644
--- a/nmap.cc
+++ b/nmap.cc
@@ -1858,7 +1858,9 @@ void nmap_free_mem() {
   AllProbes::service_scan_free();
   traceroute_hop_cache_clear();
   nsock_set_default_engine(NULL);
+#ifndef NOLUA
   close_nse();
+#endif
 }
 
 int nmap_main(int argc, char *argv[]) {
