I haven't had time to dig into this yet. Making the issue known right away so it can be discussed. This is the latest commit, but the same things occurs with 1.2.9 release. FreeBSD 14.2, clang 18.1.6.
# cat /tmp/megahit_test_vwcvu9nq/log
2025-05-23 08:03:19 - MEGAHIT v1.2.9
2025-05-23 08:03:19 - Using megahit_core with POPCNT support
2025-05-23 08:03:19 - Convert reads to binary library
2025-05-23 08:03:19 - command /usr/local/bin/megahit_core_popcnt buildlib /tmp/megahit_test_vwcvu9nq/tmp/reads.lib /tmp/megahit_test_vwcvu9nq/tmp/reads.lib
2025-05-23 08:03:19 - b'INFO sequence/io/sequence_lib.cpp : 77 - Lib 0 (/usr/local/share/megahit/test_data/r1.il.fa.gz): interleaved, 200 reads, 100 max length'
2025-05-23 08:03:19 - b'INFO sequence/io/sequence_lib.cpp : 77 - Lib 1 (/usr/local/share/megahit/test_data/r2.il.fa.bz2): interleaved, 200 reads, 100 max length'
2025-05-23 08:03:19 - b'INFO sequence/io/sequence_lib.cpp : 77 - Lib 2 (/usr/local/share/megahit/test_data/r3_1.fa,/usr/local/share/megahit/test_data/r3_2.fa): pe, 200 reads, 100 max length'
2025-05-23 08:03:19 - b'INFO sequence/io/sequence_lib.cpp : 77 - Lib 3 (/usr/local/share/megahit/test_data/r4.fa): se, 2 reads, 100 max length'
2025-05-23 08:03:19 - b'INFO sequence/io/sequence_lib.cpp : 77 - Lib 4 (/usr/local/share/megahit/test_data/loop.fa): se, 2 reads, 547 max length'
2025-05-23 08:03:19 - b'INFO utils/utils.h : 152 - Real: 0.0105\tuser: 0.0128\tsys: 0.0000\tmaxrss: 5716'
2025-05-23 08:03:19 - k-max reset to: 141
2025-05-23 08:03:19 - Start assembly. Number of CPU threads 4
2025-05-23 08:03:19 - k list: 21,29,39,59,79,99,119,141
2025-05-23 08:03:19 - Memory used: 7526511820
2025-05-23 08:03:19 - Extract solid (k+1)-mers for k = 21
2025-05-23 08:03:19 - command /usr/local/bin/megahit_core_popcnt count -k 21 -m 2 --host_mem 7526511820 --mem_flag 1 --output_prefix /tmp/megahit_test_vwcvu9nq/tmp/k21/21 --num_cpu_threads 4 --read_lib_file /tmp/megahit_test_vwcvu9nq/tmp/reads.lib
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 148 - Preparing data...'
2025-05-23 08:03:19 - b'INFO sequence/io/sequence_lib.cpp : 115 - Before reading, sizeof seq_package: 20140'
2025-05-23 08:03:19 - b'INFO sequence/io/sequence_lib.cpp : 117 - After reading, sizeof seq_package: 20140'
2025-05-23 08:03:19 - b'INFO sorting/kmer_counter.cpp : 76 - 604 reads, 547 max read length'
2025-05-23 08:03:19 - b'INFO sorting/kmer_counter.cpp : 83 - 2 words per substring, 2 words per edge'
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 153 - Preparing data... Done. Time elapsed: 0.0049'
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 156 - Preparing partitions and calculating bucket sizes...'
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 80 - Minimum memory required: 2125956 bytes'
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 138 - Lv1 items: 6470, Lv2 items: 113'
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 140 - Memory of derived class: 2122628, Memory for Lv1+Lv2: 27688'
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 168 - Preparing partitions and calculating bucket sizes... Done. Time elapsed: 0.0256'
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 172 - Start main loop...'
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 186 - Lv1 scanning from bucket 0 to 78'
2025-05-23 08:03:19 - b'INFO sorting/base_engine.cpp : 193 - Lv1 scanning done. Large diff: 0. Time elapsed: 0.0010'
2025-05-23 08:03:19 - b'Assertion failed: (snapshot->bucket_id == -1), function Write, file /usr/ports/wip/megahit/work/megahit-1.2.9-20-g3821b10/src/sequence/io/edge/edge_writer.h, line 72.'
2025-05-23 08:03:19 - b'Assertion failed: (snapshot->bucket_id == -1), function Write, file /usr/ports/wip/megahit/work/megahit-1.2.9-20-g3821b10/src/sequence/io/edge/edge_writer.h, line 72.'
2025-05-23 08:03:19 - Error occurs, please refer to /tmp/megahit_test_vwcvu9nq/log for detail
2025-05-23 08:03:19 - Command: /usr/local/bin/megahit_core_popcnt count -k 21 -m 2 --host_mem 7526511820 --mem_flag 1 --output_prefix /tmp/megahit_test_vwcvu9nq/tmp/k21/21 --num_cpu_threads 4 --read_lib_file /tmp/megahit_test_vwcvu9nq/tmp/reads.lib; Exit code -6
# lldb -c megahit_core_popcnt.core megahit_core_popcnt
(lldb) target create "megahit_core_popcnt" --core "megahit_core_popcnt.core"
Core file '/home/bacon/megahit_core_popcnt.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'megahit_core_popcnt', stop reason = signal SIGABRT
* frame #0: 0x00000008264281ba libc.so.7`__sys_thr_kill + 10
frame #1: 0x00000008263a15d4 libc.so.7`__raise + 52
frame #2: 0x0000000826454b59 libc.so.7`abort + 73
frame #3: 0x00000008263847c1 libc.so.7`__assert + 81
frame #4: 0x00000000002e6034 megahit_core_popcnt`EdgeWriter::Write(this=0x0000000820ec07e8, edge_ptr=0x0000000830accac0, bucket=<unavailable>, tid=2, snapshot=0x0000000830acca40) const at edge_writer.h:72:7
frame #5: 0x00000000002e4332 megahit_core_popcnt`KmerCounter::Lv2Postprocess(this=0x0000000820dc04f0, start_index=<unavailable>, end_index=67, thread_id=2, substr_ptr=0x00002f40dc6c7604) at kmer_counter.cpp:374:20
frame #6: 0x00000000002e17d5 megahit_core_popcnt`BaseSequenceSortingEngine::Lv2Sort(this=0x0000000820dc04f0, thread_status=0x0000000820dc0320, b=18, tid=2) at base_engine.cpp:350:3
frame #7: 0x00000000002e18f0 megahit_core_popcnt`::_ZN25BaseSequenceSortingEngine23Lv1FetchAndSortLaunchMtEv.omp_outlined() [inlined] _ZN25BaseSequenceSortingEngine23Lv1FetchAndSortLaunchMtEv.omp_outlined_debug__(.global_tid.=<unavailable>, .bound_tid.=<unavailable>, this=0x0000000820dc04f0, thread_status=<unavailable>) at base_engine.cpp:325:5
frame #8: 0x00000000002e181c megahit_core_popcnt`::_ZN25BaseSequenceSortingEngine23Lv1FetchAndSortLaunchMtEv.omp_outlined(.global_tid.=<unavailable>, .bound_tid.=<unavailable>, this=0x0000000820dc04f0, thread_status=0x0000000820dc0320) at base_engine.cpp:323:1
frame #9: 0x0000000821e57363 libomp.so`__kmp_invoke_microtask + 147
frame #10: 0x0000000821e28c7b libomp.so`___lldb_unnamed_symbol2055 + 379
frame #11: 0x0000000821e2793e libomp.so`___lldb_unnamed_symbol2040 + 494
frame #12: 0x0000000821e57f92 libomp.so`___lldb_unnamed_symbol2385 + 418
frame #13: 0x000000082603ab05 libthr.so.3`___lldb_unnamed_symbol565 + 309
I haven't had time to dig into this yet. Making the issue known right away so it can be discussed. This is the latest commit, but the same things occurs with 1.2.9 release. FreeBSD 14.2, clang 18.1.6.