在远程Linux机器上从Visual Studio 2019启动具有管理权限的cmake生成的应用程序 [英] Starting a cmake-built application with administrative priviliges from Visual Studio 2019 on a remote Linux machine

查看:104
本文介绍了在远程Linux机器上从Visual Studio 2019启动具有管理权限的cmake生成的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行带有Visual Studio 2019的IDE-Machine Windows 10.用于调试的目标系统是Ubuntu 18.04.使用Visual Stdio插件中提供的CMake.测试软件是soem库,具有simple_test程序,这已经导致了问题( https://github.com/OpenEtherCATsociety/SOEM ).将eth-interface传递到内置程序后,它会因无法获得root权限而停止.已经尝试在launch.vs.json中传递sudo,并且还通过管道将sudo传递给程序.试图更改对eth-device的安全权限的访问.

Running IDE-Machine Windows 10 with Visual Studio 2019. Target-System for debugging is a Ubuntu 18.04. Using CMake available in Visual Stdio addons. Test software is the soem lib, with the simple_test programm, wich already leads to the issue (https://github.com/OpenEtherCATsociety/SOEM). After passing the eth-interface to the built programm, it stops with cause it can't get root. Already tried to pass sudo in the launch.vs.json and also pipe sudo the programm. Tried to change the access to the security permission for the eth-device.

"configurations": [
  {
    "type": "cppdbg",
    "name": "simple_test (test\\linux\\simple_test\\simple_test)",
    "project": "CMakeLists.txt",
    "projectTarget": "simple_test (test\\linux\\simple_test\\simple_test)",

    ... // standard setup

    "args": [
      "enp3s0"               //the eth dev I want to use
    ],

... // standard setup
  ]
  }

不带root的程序的结果是:

The result of the programm without root is:

>SOEM (Simple Open EtherCAT Master)
>Simple test
>Starting simple test
>No socket connection on enp3s0
>Excecute as root

期望如下:

>>sudo ~/SOEM/test/linux/simple_test/simple_test enp3s0
>SOEM (Simple Open EtherCAT Master)
>Simple test
>Starting simple test
>ec_init on enp3s0 succeeded.
>2 slaves found and configured.
>Slaves mapped, state to SAFE_OP.
>segments : 1 : 2 0 0 0
>Request operational state for all slaves
>Calculated workcounter 3
>Operational state reached for all slaves.
>^Cocessdata cycle  320, WKC 3 , O: 00 I: 00 T:0

有关此建议将是有帮助的.

Suggestions about this would be helpfull.

谢谢

推荐答案

好的,解决了我的问题.您必须通过向"debuggerPath":"/usr/bin/gdb" 中添加 sudo 来将sudo传递给调试器:

Okay solved my problem. You have to pass sudo to the debugger by adding sudo to "debuggerPath": "/usr/bin/gdb" like this:

"debuggerPath": "sudo /usr/bin/gdb"

为我解决.

这篇关于在远程Linux机器上从Visual Studio 2019启动具有管理权限的cmake生成的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆