Let me save you all an hour+ of your life.
Grab the latest version of Ghidra: https: https://ghidra-sre.org/
Use the Ghidra GUI to install the GnuDisassembler and the SleighDevTools.
Install the following dependencies to Kali:
flex
bison
texinfo
zlib1g-dev
grade
Download the latest binutils source into your ~/.ghidra/ghidra_<version>/ directory. Link for the right version can be found in the build.gradle file in that directory.
Set your GHIDRA_INSTALL_DIR to the location of your ghidra install (mine was /opt/ghidra/ghidra_<version>.
Check your version of gradle:
gradle –version
Compare the version of gradle Kali installed, to the required version listed in the /Ghidra/application.properties file from the source for the version of ghidra you installed.
If there is a version difference, download the binary for the right version of gradle and use that to run your build command..
Sad to say, I spent over an hour trying to debug completely ambiguous errors from gradle (e.g. Could not find method get() for arguments [] on platform ‘linux64’ of type org.gradle.platform.internal.DefaultNativePlatform).
gradle build
Enjoy!