Reputation: 91
Goal: Compile and run flutter examples emulating Linux Desktop on CentOS 7 docker container
(Note: Can't use snapd - not supported within Docker) Installed manually
Managed to get everything else cleared up but this one:
GTK 3.0 development libraries are required for Linux development.
They are likely available from your distribution (e.g.: apt install
libgtk-3-dev)
The others show OK:
Γú[Γ£ù] Linux toolchain - develop for Linux desktop
ΓÇó clang version 3.4.2 (tags/RELEASE_34/dot2-final)
ΓÇó cmake3 version 3.17.5
ΓÇó ninja version 1.10.2
ΓÇó pkg-config version 0.29.2
Γú[Γ£ô] Connected device (1 available)
ΓÇó Linux (desktop) ΓÇó linux ΓÇó linux-x64 ΓÇó CentOS Linux 7 (Core)
4.19.76-linuxkit
Another thread had asked for specific versions when diagnosing this. Here they are:
pkg-config --modversion gtk+-3.0 3.22.30
pkg-config --modversion glib-2.0 2.56.1
pkg-config --modversion gio-2.0 2.56.1
pkg-config --modversion blkid 2.23.0
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkg config:
Would LOVE some help getting this resolved!!!!
Upvotes: 5
Views: 4149
Reputation: 93
I had the following error when building:
Building Linux application...
CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:825 (_pkg_check_modules_internal)
flutter/CMakeLists.txt:25 (pkg_check_modules)
Unable to generate build files
In my case it did not find the gtk+-3.0.pc file anymore. The solution was:
export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig"
/usr/share/pkgconfig was the normal place for these pc files:
$ ls -l /usr/share/pkgconfig
total 164
-rw-r--r-- 1 root root 131 Oct 21 2021 adwaita-icon-theme.pc
...omitted....
-rw-r--r-- 1 root root 239 Feb 26 2020 xtrans.pc
and in /usr/lib/x86_64-linux-gnu/pkgconfig were the gtk*.pc files.
$ ls -l /usr/lib/x86_64-linux-gnu/pkgconfig | grep gtk
-rw-r--r-- 1 root root 606 Jul 15 2024 gtk+-3.0.pc
-rw-r--r-- 1 root root 606 Jul 15 2024 gtk+-broadway-3.0.pc
-rw-r--r-- 1 root root 405 Jul 15 2024 gtk+-unix-print-3.0.pc
-rw-r--r-- 1 root root 606 Jul 15 2024 gtk+-wayland-3.0.pc
-rw-r--r-- 1 root root 606 Jul 15 2024 gtk+-x11-3.0.pc
so for example:
export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig"
flutter build linux
worked
Upvotes: 0
Reputation: 1
on popos-24 libgtk-3-dev is installed, but flutter doesn't detect it
first check with
pkg-config --exists --print-errors 'gtk+-3.0'
in my case libei-1 error Just by installing libei-dev the problem is solved
sudo apt install libei-dev
Upvotes: 0
Reputation: 21
I've got the similar problem here, but found a way to solve it.
All library has been installed, but flutter doctor
says something else.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✗] Linux toolchain - develop for Linux desktop
• clang version 15.0.7
• cmake version 3.17.0
• ninja version 1.10.0
• pkg-config version 0.29.2
✗ GTK 3.0 development libraries are required for Linux development.
They are likely available from your distribution (e.g.: apt install libgtk-3-dev)
[✓] Android Studio (version 2022.2)
When I check with pkg-config --list-all |grep gtk
it shows `gtk+-3.0' was there.
gtk+-3.0 GTK+ - GTK+ Graphical UI Library
gtk+-unix-print-3.0 GTK+ - GTK+ Unix print support
gtk+-wayland-3.0 GTK+ - GTK+ Graphical UI Library
gtk+-broadway-3.0 GTK+ - GTK+ Graphical UI Library
gtk+-x11-3.0 GTK+ - GTK+ Graphical UI Library
But when I do pkg-config --exists 'gtk+-3.0'; echo $?
it always return 1.
It took me a while to figured out pkg-config has additional option --print-errors
to show what was happen behind the hut when we use --exists
.
Doing pkg-config --exists --print-errors 'gtk+-3.0'
in my case it gave me
Package wayland-client was not found in the pkg-config search path.
Perhaps you should add the directory containing `wayland-client.pc'
to the PKG_CONFIG_PATH environment variable
Package 'wayland-client', required by 'gdk-3.0', not found
That's how stingy that flutter doctor
not telling you what was happen behind.
Digging a bit, it turns out that wayland-client
is part of wayland-devel
in rpm based distro, I use openSUSE btw. After installing wayland-devel
, flutter doctor
says everything's OK.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 15.0.7
• cmake version 3.17.0
• ninja version 1.10.0
• pkg-config version 0.29.2
[✓] Android Studio (version 2022.2)
Well, you can hunt down your errors now.
Hope that help.
Upvotes: 2
Reputation: 31
I recently reinstalled the OS on my machine, I decided to install and use flutter through FVM. I had many other problems.
[✓] Flutter (Channel stable, 3.0.5, on Ubuntu 20.04.3 LTS 5.15.0-41-generic, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Chrome - develop for the web
[✗] Linux toolchain - develop for Linux desktop
✗ clang++ is required for Linux development.
It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
✗ CMake is required for Linux development.
It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
✗ ninja is required for Linux development.
It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
✗ GTK 3.0 development libraries are required for Linux development.
They are likely available from your distribution (e.g.: apt install libgtk-3-dev)
[✓] Android Studio (version 2021.2)
[✓] VS Code
[✓] Connected device (2 available)
[✓] HTTP Host Availability
Solutions: clang++
sudo apt-get -y install clang
CMake
I was trying sudo snap install cmake
, But it returned an error, this is because the snap review "cmake" was published using classic confinement and therefore can make arbitrary system changes outside the security sandbox that snaps are usually confined to, which can put the system at risk.
It was suggested to me: "If you understand and want to continue, repeat the command including --classic? To solve it, I just understood and continued
sudo snap install cmake --classic
GTK 3.0 development libraries
sudo apt install libgtk-3-dev
This solved everything here, it doesn't have an execution order, each dependency is added independently.
I hope I contributed!
Upvotes: 3
Reputation: 391
I updated my Ubuntu to version 22.04 LTS, and when I needed to install Flutter and Android Studio I ran into a similar error in flutter doctor
output:
GTK 3.0 development libraries are required for Linux development.
They are likely available from your distribution (e.g.: apt install libgtk-3-dev)
Command apt install libgtk-3-dev
returned various errors, at first something like:
libgtk-3-dev is already the newest version
And then i tried to update all packages:
sudo apt-get update
sudo apt-get autoremove
dpkg --get-selections | grep hold
None of these commands didn't do anything...
So, i try to remove libgtk-3-dev
, and after that repeat autoremove and try to install libgtk-3-dev
again. But now it showed me that it has some unmet dependency (it looks like it depended on some version of libpcre3
and\or libpcre3-dev
) and for some reason apt
refused to install it.
I tried so many ways to remove this damn package, but I could not do it. As far as I understand, initially the problem is that the version of this shitty package (libpcre3
) that I have has been stretching since Ubuntu 18, and there is both a 32-bit version and x64, and dependencies are crooked in some of them ... Well, or some other problem - maybe something was not deleted during the next update, although it should have been.
In the end, I managed to solve the problem using a graphical shell over apt - synaptic
(its great stuff, I recommend it to everyone). It's very easy to set up:
sudo apt install synaptic
After that, I found the amd64 version libpcre3
in list, marked it for installation and installed it. After that, just install through the console
sudo apt install libgtk-3-dev
It worked fine, updating all dependencies.
P.S. First thing I want to note is that Flutter is incredibly crooked shit (only my opinion). If you haven’t started developing on it yet, don’t start, choose something more stable. If it will be possible to use this garbage, then only in five years at best...
And secondly, I spent a lot of time searching and solving the problem with the library, which is essentially perl dependencies. Despite the fact that I myself do not use perl at all. Looks like the notorious "Dependency Hell" is already here.
Upvotes: 2
Reputation: 91
It appears most of this has to do with pathing, some of the libs have slightly different names (gtk3-devel, libblkid-devel, xz-devel). Some irritations around cmake3, and getting more current versions of pkg-config, xproto, kbproto, xextproto, and the configuration of said packages. At least now I have a clean flutter doctor.
Now, on to trying to run it...
Upvotes: 2