tphysm:
For the encryption to work, you need some free space at the end of the userdata partition right behind the userdata filesystem (the “crypto footer” from the adb error message, see this technical blog post for more information about it in general). However, when flashing another ROM, the userdata partition gets wiped, reformatted and equipped with a new filesystem. It seems that in this process no crypto footer is left and the filesystem fills the whole partition (i.e. it “overlaps crypto footer” as described in the adb error message).
Interesting, thanks for your research! Do you want to add something to the compilation guide ? Is there something that could be added to the build scripts somewhere?