CLion on mac "process finished with exit code 4" error?

Answered

Hello, I'm working with Clion 2019.2 and trying to run a very simple c program using Gstreamer. This program works correctly when run using Clion in a linux environment.

CMakeLists.txt I believe is properly configured to include the libraries I need. After doing a build this is the only output I get:

Process finished with exit code 4

What would cause this? 

10 comments
Comment actions Permalink

Bump.. anyone? I could use some help! thank you

0
Comment actions Permalink

Hi!

Can you build any other project in CLion on macOS? A default "Hello, World!" project (File > New Project > C++ Executable), for example?

0
Comment actions Permalink

I think this might be related to video capture permissions. I've been having a similar problem in CLion trying to run an OpenCV example: it compiles and it can be run from the macOS terminal, but if I attempt to either run or debug it from CLion the program exits at the section of the code that opens the camera (running it from CLion's terminal fails in the same way). In my case I am getting "exit code 6".

I'm also having another issue that I suspect is related. On a different app, which also uses video capture, I am able to compile and run, but opening the camera fails. If I try to run the app from Finder, it opens, requests permission to use the camera, and then continues running. What isn't happening in CLion is the permission request.

By the way, this started showing up in an EAP, I believe it was 2019.2, and now it is an issue in the regular release as well. Previous versions (2019.1 and earlier) do not have this issue.

https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos

BTW, adding the correct entry in the plist does not solve the issue when trying to run from within CLion. Again, the programs run just fine when launched via macOS Terminal or Finder.

 

0
Comment actions Permalink

Some extra info:

I modified the CLion Info.plist (the one inside the CLion.app App Bundle) and added

<dict>
<key>NSCameraUsageDescription</key>
<string>uses camera to see vision targets</string>
</dict>

Now my programs get a little further in the execution (OpenCV says there is permission, but then it says it was denied), but they still crash, and CLion still does not request camera use permission.

0
Comment actions Permalink

Thanks for the details! Looks related to https://youtrack.jetbrains.com/issue/IDEA-219288. Feel free to read the comments and comment/upvote.

0
Comment actions Permalink

This issue is NOT solved in the IDEA-219288 link above. It needs to be fixed on the Clion side by Jetbrains.

Answering the above Q about running any other programs, yes, just not the one described above.

@Crmendoz if you can post how you edited the .plist I would appreciate it - how did you modify the Clion info.plist? Via xcode? Thank you! 

0
Comment actions Permalink

@EP999 the workaround is on that link. The solution is to run the Clion binary directly (the binary inside the Clion.app bundle), no need to modify Info.plist.

Go to your Clion.app, right click -> Show Package Contents, then Contents/MacOS and double-click on the clion binary. When you first run a program that requires the camera MacOS will ask for permission and it should work from then on. It may not even ask you for permission if you've already allowed Terminal.app to access the camera. 

Unfortunately you have to do launch Clion like this until JetBrains fixes the issue, but it works 100%. I recommend you make an alias on your Desktop.

0
Comment actions Permalink

>This issue is NOT solved in the IDEA-219288 link above. It needs to be fixed on the Clion side by Jetbrains.

@EP999, could you please elaborate on this?

0
Comment actions Permalink

Just to chime in, same error over here using Clion 2019.2.5 has same issue. I've tried to run it from finder, and through terminal, and from toolbox, in all cases, when attempting to open webcam the MacOS does not prompt for permissions request. However, runniting `tccutils reset Camera` and then running the compiled program from terminal prompts a permission request for Terminal - not replicated for Clion.

This suggests to me that Clion is not able to request these permissions...

0
Comment actions Permalink

Hello everyone!

The related issue (https://youtrack.jetbrains.com/issue/IDEA-219288) is still open, please upvote it. 

For now a workaround is to run IDE form an already allowed application like terminal. 

0

Please sign in to leave a comment.