[Galaxy Note 10.1 (2014 Edition) Original Android D] Cannonball_CO:
OK. I have built LineageOS 14.1 for n1awifi within Ubuntu 20.02 LTS under WSL2. That was a pain.

After following the basic setup for WSL2 in the XDA guide linked above, I was able to easily perform all the steps up to 'brunch n1awifi'. At that point there were a number of additional bugs to fix, which seem to be associated with the fact that the source is now at least 3-4 years older than the toolchain. These bugs, in the order I encountered them, are listed below with my fix(es). Note, I think many of these may be covered in the XDA guide (!!!), but here they all are in one post. I guess I was too lazy to read through all 30 pages.

1. Presence of 32-bit binary in the prebuilts that won't run in WSL.

FIX: copy the system bison (/usr/bin/bison) into the prebuilts directory; or set USE_HOST_BISON=true.

2. %define variable 'api.pure' outdated / unneeded (?) in system/tools/aidl/aidl_language_y.yy.

FIX: remove this define (%pure-parser) from the file.

3. The prebuilt tool build/tools/ijar/ijar needs a patch to run under WSL

FIX: apply the patch.

4. Defines in frameworks/compile/mclinker/lib/Script/ScriptParser.yy are outdated.

FIX: the three lines under %debug should now be

%define parse.error verbose
%define api.namespace {mcld}
%define api.parser.class {ScriptParser}

Sorry I can't provide a diff, I didn't keep the old stuff!

5. Jack server KEEPS CRASHING OMG ARRRRGHHHH

FIX (NOPE): at first I tried this but it just kept crashing. This info comes in handy if it does crash, though.

FIX (WORKS): the whole fix requires changing Java security options.

6. Presence of JAVA/Themod.EE.1 virus found in temporary output (??)

FIX: I'm honestly not sure if I took the right approach, but I restored the file using my anti-virus. This is troubling, although I can't find any info on this virus online (?). This kept happening in the latter part of the build, until I added the WSL build and temporary directories to the exception list.

7. out/target/product/n1awifi/obj/STATIC_LIBRARIES/libmcldScript_intermediates/ScriptParser.cpp has two _Noreturn functions that *might* return.

FIX: add abort(); call to end of each will silent the warning... and presumably this won't cause a problem given they're not supposed to return!

8. The core tool build/core/dex_preopt_libart.mk (and more!) must be patched for WSL for single-threaded operation.

FIX (WAIT NO!): apply the patch.

FIX (YES! WAIT STILL NO!): manually insert the -j1 option into the DEX2OAT command options (that is, don't rely on the ifeq statement above it). The first fix above didn't seem to work. Arg... but that may be because...

FIX (YES!): Apply the first patch as noted above to build/core/dex_preopt_libart.mk, then search for the $(DEX2OAT) call in build/core/dex_preopt_libart_boot.mk, and add the -j1 option there AS WELL <SIGH>.

This worked for me, it might for you? I'm an engineer, not a computer scientist, so I can't guarantee I didn't really screw something up (somebody please tell me if I did!!!); use at your own risk. That said, I've loaded the OS onto my Note 10.1 2014 Edition and it's working.

lineage-14.1-20210527-UNOFFICIAL-n1awifi.zip