Перейти к содержимому

Что значит в qt creator permission denied

  • автор:

Qt creator throws permission error on project (files owned by me) within directory of root

Whenever I open the project with qt creator, it gives me permission error and says that it cannot write any file.

As you see, all the files are owned my me and I open qt creator from my account. I can edit every file from this project with other text-editors but not with qt creator.

My guess at first was that I was running qt creator not as khvah but I am logged in with that accout and I start the application from that account

./configure Permission denied — Compiling Qt

I’m new to Linux/Rasperry Pi and I was following this tutorial to create a native build of Qt. I got up to the ./configure step. But this gives me the error:

bash: ./configure Permission denied

I think it has something to do that I want to run the configuration from a USB drive (as instructed in the tutorial). How can I get this to work?

1 Answer 1

You need to understand how unix modes and permissions, used on POSIX operating systems such as GNU/Linux and OSX work, otherwise your life is going to be full of awkward problems like this. There are already lots and lots of introductions online, I will not bother regurgitating them.

However, I’ll give an example of applying the concepts in this case. First, you need to know some id numbers for your current user:

Will give you your uid , gid , and a list of groups whose permissions you can use.

./configure is a file. To get the modes and permissions set on it:

It’s in the first line labelled «Access:» (there are two), and will be something like 0755/drwxr-xr-x . All of those links from above explain how to decipher that. See also man stat .

You need to change the ownership on the whole directory tree, since you are going to be building software in it. For that you can use the -R (recursive) switch to chown (see also man chown ), but you need privileges to do so, via sudo . Presuming you are in the same directory as the configure file, and you are user pi :

You could of course just do sudo ./configure and proceed that way, but this way you are playing safe. On the other hand, if you are intending to do a system wide install, you will need to do so at some point ( sudo make install ).

Troubleshooting Qt Creator project issues

This page contains information on how to resolve common problems with Qt Creator projects. Consider searching this page using Ctrl+F (Command+F on Mac) to jump quickly to the text matching the error message or issue you are having. You may also want to check the [Guide to Common Build/Run/Debug problems][commonissues] if for issues compiling or running your program.

How to «re-initialize» a Qt Creator project

A large number of Qt Creator ills can be resolved by following these steps to re-initialize your project. (Please note that this requires deleting some files from your project. Be careful not to delete your assignment solution code. Make frequent backups of your files.)

  • Quit Qt Creator.
  • Navigate to the folder where your project is stored. Delete the file with the extension . pro . user , such as Life . pro . user Take care: Delete only the file with exactly the pro . user extension , not the other files such as the Life . pro (screenshot)
  • Also delete the «build» folder for your project. This is located in the parent directory of your project’s directory, and has a long name like build — Life — Desktop_Qt_5_x_x_kit_xxbit — Debug . Delete the entire build directory. (screenshot)
  • Re-start Qt Creator. Choose menu item «File» -> «Open File or Project…», navigate to your project folder and open its . pro file. Qt should ask you to «Configure Project», just as if you were opening for the first time.
  • Now try to build and run to see if things work any better.

Installation woes

Opening a project

Permission problems

Alerts on MacOS. Qt requesting «access to Desktop or Downloads folder». Should I allow it? Yes. Recent releases of MacOS have have tightened restrictions for programs to access to certain folders. If your project folder is stored in Desktop or Downloads folder, you must explicitly grant file privileges to the Qt Creator IDE and the debugger. Click agree when you get an alert such as this one: screenshotYou can also go to «System Preferences» -> «Security & Privacy» -> «Privacy» tab -> «Files and Folders» to review and change what access has been granted to individual applications. Build failed on Windows. Error: cannot open output file . \ MyProgram . exe : Permission denied .

This error means that your executable is still running from the last time you ran/tested the program a moment ago. Shut down any running instances of your program. You might need to open your operating system’s Task Manager to stop them all.screenshot

Cannot delete, rename, or modify my program .exe file or build folder. Error: You ‘ ll need to provide administrator permission to delete this folder .

screenshotA Windows feature called «System Protection» can lock your .exe programs so that they cannot be modified. You can disable this feature in your system settings. Go to Control Panel, and choose System. Now click the System Protection tab/link, which is either on the left or top side of the window. Depending on your version of Windows, either click the «Disable system protection» radio button, or if you instead see a list of disk drives, double-click on the drive where your project is stored (likely drive C:), and change the setting to Off. screenshot screenshotscreenshot

Another thing that can cause the «permission denied» problem is anti-virus software. In particular, McAfee Anti-Virus places strong locks on all . exe files that prevents you from modifying or deleting them. You may need to disable or uninstall McAfee to make this behavior go away.

What else?

Help! It still doesn’t work!

If you had read through the list of known fixes and were not able to resolve your issue, we will try our best to help you figure it out. Drop into helper hours and show us the problem over Zoom. Or you can contact us via forum/email to get help. In your email/post, be sure to include the following information:

  • Your operating system and version number (Windows 10, Mac OS X 10.15, Fedora Linux 17, etc.)
  • The Qt version information from «About Qt Creator»
  • Which step in the process has failed (be specific)
  • Specific error message
    • Please include the exact text via copy/paste and/or a screenshot.
    • For a build error, be sure to grab the detailed information from the Compile Output tab.

    Thanks, and good luck! You can do it!

    © Stanford 2020 · Website by Julie Zelenski · Page updated 2021-Jun-21

    Отладка Qt-приложения на ubuntu с правами root с использованием qt-создателя

    Можно запустить мое приложение с помощью root priviliges с помощью sudo, например:

    Можно ли отладить мое приложение Qt с помощью root priviliges с помощью QtCreator? Как я могу сделать это в системе Ubuntu?

    3 ответа

    Помните: опция sudo должна быть там

    Изменить /etc/sudoers с помощью sudo visudo

    В следующий раз, когда вы запустите программу, она будет вызываться в новый xterm или gnome-terminal с правами суперпользователя и запросит пароль root.

    Выполнение этого как root — ужасная идея. Вместо этого используйте источник и сделайте qtcreator для использования sudo для запуска gdb. Требуется, чтобы вы запускали qtcreator из tty и auth sudo перед запуском qtcreator или настраивали пользователя для sudo без пароля (не рекомендуется). Я буду кодировать более полное решение позже.

    Мне понадобилось 1-2 часа кода / отладки без предварительного знания QT. Больше всего времени было потрачено на то, чтобы компиляция завершилась

    — qtcreator-3.0.1.orig/src/plugins/debugger/gdb/gdbprocess.cpp +++ qtcreator-3.0.1/src/plugins/debugger/gdb/gdbprocess.cpp @@ -59,7 +59,11 @@ QByteArray GdbProcess::readAllStandardEr

    Я запустил программу с терминала с сервером GDB (с правами root), а затем подключился к серверу с помощью gdb из QtCreator. Вы бы начали gdbserver с чего-то вроде этого:

    Здесь вы размещаете сервер с портом 2345. Вы также можете проверить, действительно ли ваше приложение работает с UID 0.

    Теперь в Qt Creator перейдите в Debug -> Start Debugging -> Attach to Running Debug Server. Заполните форму . самым важным является адрес порта и сервера. Я выбрал 127.0.0.1 и 2345. Вы можете выбрать break на main, чтобы сломаться в начале программы. Сервер GDB не запускает программу, пока вы не подключитесь.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *