AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / ubuntu / Perguntas / 1374329
Accepted
Leigh K
Leigh K
Asked: 2021-11-09 09:05:13 +0800 CST2021-11-09 09:05:13 +0800 CST 2021-11-09 09:05:13 +0800 CST

Como compilar um aplicativo GTK4 no Ubuntu 21.10?

  • 772

Estou tentando compilar um aplicativo C GUI usando GTK4. Foi-me dito anteriormente aqui que o Ubuntu 21.04 e o 21.10 teriam GTK3 e GTK4. No entanto, quando instalei o Ubuntu 21.04, apenas o GTK3 estava presente. Em seguida, fiz uma atualização dist para 21.10 e descobri que ambas as versões do GTK são nativas:

user@user: dpkg -l libgtk* | grep -e '^i' | grep -e 'libgtk-*[0-9]'
ii  libgtk-3-0:amd64           3.24.30-1ubuntu1 amd64        GTK graphical user interface library
ii  libgtk-3-bin               3.24.30-1ubuntu1 amd64        programs for the GTK graphical user interface library
ii  libgtk-3-common            3.24.30-1ubuntu1 all          common files for the GTK graphical user interface library
ii  libgtk-3-dev:amd64         3.24.30-1ubuntu1 amd64        development files for the GTK library
ii  libgtk-3-doc               3.24.30-1ubuntu1 all          documentation for the GTK graphical user interface library
ii  libgtk-4-1:amd64           4.4.0+ds1-5      amd64        GTK graphical user interface library
ii  libgtk-4-bin               4.4.0+ds1-5      amd64        programs for the GTK graphical user interface library
ii  libgtk-4-common            4.4.0+ds1-5      all          common files for the GTK graphical user interface library
ii  libgtk2.0-0:amd64          2.24.33-2ubuntu1 amd64        GTK graphical user interface library - old version
ii  libgtk2.0-bin              2.24.33-2ubuntu1 amd64        programs for the GTK graphical user interface library
ii  libgtk2.0-common           2.24.33-2ubuntu1 all          common files for the GTK graphical user interface library
ii  libgtk3-perl               0.038-1          all          Perl bindings for the GTK+ graphical user interface library

Apenas verificando a versão do Ubuntu rende:

user@user: lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 21.10
Release:    21.10
Codename:   impish

A página GTK diz para usar o seguinte para compilar um aplicativo GTK4 usando pkg-config:

gcc $( pkg-config --cflags gtk4 ) -o example-0 example-0.c $( pkg-config --libs gtk4 )

Isso é muito semelhante às versões anteriores do GTK. Para GTK3 foi:

gcc $( pkg-config --cflags gtk+-3.0 ) -o example-0 example-0.c $( pkg-config --libs gtk+-3.0 )

No entanto, tentar compilar o programa usando GTK4 resulta em:

user@user: make
Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk4' found

Então, com base aqui eu corri:

user@user: pkg-config --variable pc_path pkg-config
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig

Pesquisando todos esses caminhos, só encontro arquivos .pc relacionados ao GTK /usr/lib/x86_64-linux-gnu/pkgconfige não encontro nada para o GTK4. Eu encontro gtk+-3.0.pclá embora. Então, minha pergunta é, se o GTK4 é nativo do Ubuntu 21.10, por que os arquivos pkg-config estariam ausentes? Onde posso obtê-los para que eu possa compilar usando o pkg-config?

ALÉM: Não tenho reputação suficiente para criar a gtk4tag. Alguém com reputação suficiente poderia fazê-lo?

gtk
  • 1 1 respostas
  • 1782 Views

1 respostas

  • Voted
  1. Best Answer
    Archisman Panigrahi
    2021-11-09T09:14:11+08:002021-11-09T09:14:11+08:00

    Você precisará instalar libgtk-4-devo , com o comando

    sudo apt install libgtk-4-dev
    
    • 8

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Existe um comando para listar todos os usuários? Também para adicionar, excluir, modificar usuários, no terminal?

    • 9 respostas
  • Marko Smith

    Como excluir um diretório não vazio no Terminal?

    • 4 respostas
  • Marko Smith

    Como descompactar um arquivo zip do Terminal?

    • 9 respostas
  • Marko Smith

    Como instalo um arquivo .deb por meio da linha de comando?

    • 11 respostas
  • Marko Smith

    Como instalo um arquivo .tar.gz (ou .tar.bz2)?

    • 14 respostas
  • Marko Smith

    Como listar todos os pacotes instalados

    • 24 respostas
  • Martin Hope
    Flimm Como posso usar o docker sem sudo? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    led-Zepp Como faço para salvar a saída do terminal em um arquivo? 2014-02-15 11:49:07 +0800 CST
  • Martin Hope
    ubuntu-nerd Como descompactar um arquivo zip do Terminal? 2011-12-11 20:37:54 +0800 CST
  • Martin Hope
    TheXed Como instalo um arquivo .deb por meio da linha de comando? 2011-05-07 09:40:28 +0800 CST
  • Martin Hope
    Ivan Como listar todos os pacotes instalados 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    David Barry Como determino o tamanho total de um diretório (pasta) na linha de comando? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher "Os seguintes pacotes foram retidos:" Por que e como resolvo isso? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford Como os PPAs podem ser removidos? 2010-07-30 01:09:42 +0800 CST

Hot tag

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve