It is better to have a special folds to save "binder.h" and "binderfs.h" with the matched version current AOSP binder
Now, the build is depend on the "/usr/include/linux/android*", but the files here on the system may be not matched the binder codes.
For example: I build your aosp 12 binder (checkout to the previous commit) on Ubuntu 24.04 whose linux-libc-dev's version 6.4, it failed:
/root/repos/nixwic/binder-linux/android/native/libs/binder/binder_module.h:48:8: error: redefinition of 'binder_freeze_info' 48 | struct binder_freeze_info { | ^ /usr/include/linux/android/binder.h:220:8: note: previous definition is here 220 | struct binder_freeze_info {
It seems that the 6.4 kernel headfile has already contained many definitions in binder_module.h of AOSP12...
So I have to copy binder.h and binderfs.h from 5.4 kernel headfiles into the project.