How to add desktop simulation support to a project created without it?

Hi all, I’ve been trying to simulate our team’s robot code on desktop. The simulation worked well if I create the project and specify “add desktop support” during creation, but unfortunately our main robot project was created without that option. I tried to set includeDesktopSupport = true in build.gradle, but when I tried to simulate robot code, this alwasy happens:

********** Robot program starting **********
java.lang.UnsatisfiedLinkError: /home/tyler/Arctos/frc-2019/build/tmp/jniExtractDir/ cannot open shared object file: No such file or directory
        at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
        at java.base/java.lang.ClassLoader$NativeLibrary.load(
        at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(
        at java.base/java.lang.ClassLoader.loadLibrary0(
        at java.base/java.lang.ClassLoader.loadLibrary(
        at java.base/java.lang.Runtime.loadLibrary0(
        at java.base/java.lang.System.loadLibrary(
        at com.ctre.phoenix.CTREJNIWrapper.<clinit>(
        at com.ctre.phoenix.motorcontrol.can.BaseMotorController.<init>(
        at com.ctre.phoenix.motorcontrol.can.VictorSPX.<init>(
        at com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX.<init>(
        at frc.robot.RobotMap.<clinit>(
        at frc.robot.Robot.robotInit(
        at edu.wpi.first.wpilibj.TimedRobot.startCompetition(
        at edu.wpi.first.wpilibj.RobotBase.startRobot(
        at frc.robot.Main.main(

(I am running it on Ubuntu 18.04.)

It seems like some kind of native library dependency was not correctly downloaded. However, the problem still persists even when I copy the build.gradle of a working simulation project exactly. What am I missing?

You need to have the newest version of CTRE’s libraries. Older versions don’t have native support for desktop. I know that 5.14.1 does have the correct support.

The other option is use the isSimulation calls in RobotBase to place all talon code behind an if, that way they don’t get instantiated at all. I know currently all their simulation support does is start, but you can’t control anything.

Updating CTRE Phoenix to 5.14.1 fixed the problem. Thank you so much!