Currently, the Full Remote Mode of CLion only supports Linux as a remote host OS. Is it possible to have a FreeBSD remote host?
Yes, you can!
However, note that I'm recalling these steps retrospectively, so probably I have missed one step or two. Should you encounter any problem, please feel free to leave a comment below.
Rent a FreeBSD server, of course :)
Update your system to the latest release. Otherwise, you may get weird errors like "libdl.so.1" not found
when installing packages. The one I'm using is FreeBSD 12.0-RELEASE-p3.
Create a user account. Don't forget to make it a member of wheel
, and uncomment the %wheel ALL=(ALL) ALL
line in /usr/local/etc/sudoers
.
Set up SSH. This step is especially tricky, because we need to use both public-key and password authentication.
PasswordAuthentication yes
in /etc/ssh/sshd_config
, followed by a sudo /etc/rc.d/sshd restart
.rsync
and SSH. For some reasons I cannot explain, this process will hang forever if the host server doesn't support passphrase-less SSH key login. Follow this answer to create an SSH key as an additional way of authentication.CLion assumes the remote host OS to be Linux, so we must fix some incompatibilities between GNU/Linux and FreeBSD.
sudo pkg install coreutils
.stat
with sudo mv /usr/bin/stat /usr/bin/_stat
./usr/bin/stat
with the content in Snippet 1. This hack exploits the fact that CLion sets the environment variable JETBRAINS_REMOTE_RUN
to 1
before running commands on the remote server.sudo chmod a+x /usr/bin/stat
to make it executable.ls
with sudo mv /bin/ls /bin/_ls
./bin/ls
with the content in Snippet 2, like before.sudo chmod a+x /bin/ls
.Install the dependencies with sudo pkg install rsync cmake gcc gdb gmake
.
Snippet 1
#!/bin/sh
if [ -z "$JETBRAINS_REMOTE_RUN" ]
then
exec "/usr/bin/_stat" "$@"
else
exec "/usr/local/bin/gnustat" "$@"
fi
Snippet 2
#!/bin/sh
if [ -z "$JETBRAINS_REMOTE_RUN" ]
then
exec "/bin/_ls" "$@"
else
exec "/usr/local/bin/gls" "$@"
fi