None of the 3 languages is perfectly safe. All of them have vulnerabilities that if an application is not developed following good programming practices, they can allow an attacker to exploit different weak points and gain access to the application and its data.
You can use any language you want, but you have to consider checking your application to see if ...
In case you want to build (compile) and install Tor from source code, you can follow these steps:
Install pre-requisites, in this example I used a Debian based GNU Linux distribution:
sudo apt install -y git build-essential automake libevent-dev libssl-dev zlib1g-dev
Clone Tor from git.torproject.org:
git clone https://git.torproject.org/tor....
As per changelog, Tor, starting with 0.4.6, no longer publishes any DirPort:
Removed features (relay):
Because DirPorts are only used on authorities, relays no longer advertise them. Similarly, self-testing for DirPorts has been
disabled, since an unreachable DirPort is no reason for a relay not to
advertise itself. (Configuring a DirPort will still work, ...