Description: Fix FTBFS on non-x86: ksw_extz2_sse41/ksw_extz2_sse2 are x86-only symbols
 The ksw2 SSE sources only emit the entry points ksw_extz2_sse41() and
 ksw_extz2_sse2() when they are compiled for x86, where the SSE sources are
 built twice (once with -msse4.1, once with -msse2).  The portable SIMDe
 build used on arm64 and other architectures emits a single entry point
 named ksw_extz2_sse(), so referencing the two x86-only names made the link
 of the rapmap binary fail with:
 .
   undefined reference to `ksw_extz2_sse2'
   undefined reference to `ksw_extz2_sse41'
 .
 Limit the SSE dispatch to x86; the x86 code path is unchanged.  On other
 architectures the CPUID based run-time detection in this file already
 always reports no SSE support, so the portable scalar ksw_extz() routine
 is used exactly as before.
Author: openKylinBot <openKylinBot@openkylin.top>
Forwarded: not-needed
Last-Update: 2026-10-20

--- rapmap-0.15.0+dfsg.orig/src/ksw2pp/KSW2Aligner.cpp
+++ rapmap-0.15.0+dfsg/src/ksw2pp/KSW2Aligner.cpp
@@ -219,6 +219,14 @@ int KSW2Aligner::operator()(const char*
   int8_t e = config_.gape;
   int w = config_.bandwidth;
   int z = config_.dropoff;
+  // ksw_extz2_sse41() / ksw_extz2_sse2() only exist when the ksw2 sources
+  // are built for x86 (where the two entry points are produced by compiling
+  // the SSE sources twice, once with -msse4.1 and once with -msse2).  On
+  // other architectures the portable SIMDe build of those sources emits the
+  // single entry point ksw_extz2_sse(), and the x86 CPUID based detection
+  // below always selects the scalar ksw_extz() routine, so only reference
+  // the SSE entry points on x86.
+#if defined(__x86_64__) || defined(__i386__)
   if (haveSSE41) {
     ksw_extz2_sse41(kalloc_allocator_.get(), qlen, query_.data(), tlen,
                 target_.data(), config_.alphabetSize, mat_.data(), q, e, w, z,
@@ -227,7 +235,9 @@ int KSW2Aligner::operator()(const char*
     ksw_extz2_sse2(kalloc_allocator_.get(), qlen, query_.data(), tlen,
                   target_.data(), config_.alphabetSize, mat_.data(), q, e, w, z,
                   config_.end_bonus, config_.flag, ez);
-  } else {
+  } else
+#endif
+  {
     ksw_extz(kalloc_allocator_.get(), qlen, query_.data(), tlen,
              target_.data(), config_.alphabetSize, mat_.data(), q, e, w, z,
              config_.flag, ez);
@@ -354,6 +364,9 @@ int KSW2Aligner::operator()(const uint8_
   int8_t e = config_.gape;
   int w = config_.bandwidth;
   int z = config_.dropoff;
+  // See the comment in the char* variant of this operator above: the
+  // ksw_extz2_sse41() / ksw_extz2_sse2() entry points are x86-only.
+#if defined(__x86_64__) || defined(__i386__)
   if (haveSSE41) {
     ksw_extz2_sse41(kalloc_allocator_.get(), qlen, query_, tlen, target_,
                 config_.alphabetSize, mat_.data(), q, e, w, z, config_.end_bonus, config_.flag,
@@ -362,7 +375,9 @@ int KSW2Aligner::operator()(const uint8_
     ksw_extz2_sse2(kalloc_allocator_.get(), qlen, query_, tlen, target_,
                   config_.alphabetSize, mat_.data(), q, e, w, z, config_.end_bonus, config_.flag,
                   ez);
-  } else {
+  } else
+#endif
+  {
     ksw_extz(kalloc_allocator_.get(), qlen, query_, tlen, target_,
                    config_.alphabetSize, mat_.data(), q, e, w, z, config_.flag,
                    ez);
