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/libCTRE_PhoenixCCI.so: libCTRE_PhoenixCanutils.so: 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(ClassLoader.java:2430)
        at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
        at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2649)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
        at java.base/java.lang.System.loadLibrary(System.java:1867)
        at com.ctre.phoenix.CTREJNIWrapper.<clinit>(CTREJNIWrapper.java:9)
        at com.ctre.phoenix.motorcontrol.can.BaseMotorController.<init>(BaseMotorController.java:57)
        at com.ctre.phoenix.motorcontrol.can.VictorSPX.<init>(VictorSPX.java:27)
        at com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX.<init>(WPI_VictorSPX.java:52)
        at frc.robot.RobotMap.<clinit>(RobotMap.java:72)
        at frc.robot.Robot.robotInit(Robot.java:190)
        at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:63)
        at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:263)
        at frc.robot.Main.main(Main.java:27)

(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!