Scenario:
I want to install Qt using conan install.
I simply list qt/6.3.0
in [requires]
section in my conanfile.txt
.
Since Qt isn't a pre-built lib, so I use this command after a few failed attempts.
sudo conan install .. --build=missing
I use sudo
because it's necessary to build those dependencies, or it will fail because some permissions are denied during the installation.
Problem:
Using sudo
causes dependencies being installed in /root/.conan
folder. Then all built procedures will also need sudo
because you need to access those dependencies. It's very inconvenient.
Question:
So, either run the command in user mode, or set the dependency install folder to <user>/.conan
under super-user mode and open the files' permission for <user>
. But I don't know how.
Thanks in advance!
CodePudding user response:
You should never use sudo
to call conan
command.
The sudo
operation seems necessary for the system package manager. Checking the available configurations with conan config list
we see:
$ conan config list
...
tools.system.package_manager:mode: Mode for package_manager tools: 'check' or 'install'
tools.system.package_manager:sudo: Use 'sudo' when invoking the package manager tools in Linux (False by default)
tools.system.package_manager:sudo_askpass: Use the '-A' argument if using sudo in Linux to invoke the system package manager (False by default)
tools.system.package_manager:tool: Default package manager tool:
You can control and request usage of sudo
just for the system package manager with tools.system.package_manager:sudo
CodePudding user response:
Ok, solved.
Just for record:
First, set conanfile.txt
.
Then,
run
mkdir build
cd build
conan install .. --build=missing
this command will build & install Qt. But after installation, the procedure fails because of Permission Error.
conanfile.txt: ERROR: Generator txt(file:conanbuildinfo.txt) failed.
[ERROR 13] Permission denied: '<my_project_path>/build/conanbuildinfo.txt'
Then delete whole build
folder and re-build with
conan install ..
Because qt has been installed, so you don't need to build it. Then everything is Ok.
I think there may be some weird bugs in conan resulting above behavior. Maybe when build Qt lib, some file's permission mode has been changed. I don't know.