universal-ctags / ctags

A maintained ctags implementation
https://ctags.io
GNU General Public License v2.0
6.51k stars 622 forks source link

Build failed with no "pkg-config" error (ubuntu 22) #3863

Closed unrealslayer closed 10 months ago

unrealslayer commented 10 months ago

I am trying build ctags from sources, but get following error:

Build output ```bash ################################################################## # The paths and versions for tools # ################################################################## autoreconf is /usr/local/bin/autoreconf ------------------------------------------------------------------ autoreconf (GNU Autoconf) 2.72c Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+/Autoconf: GNU GPL version 3 or later , This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David J. MacKenzie and Akim Demaille. ################################################################## aclocal is /usr/local/bin/aclocal ------------------------------------------------------------------ aclocal (GNU automake) 1.16.5 Copyright (C) 2021 Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Tom Tromey and Alexandre Duret-Lutz . ################################################################## pkg-config is /usr/bin/pkg-config ------------------------------------------------------------------ 0.29.2 ################################################################## autoconf is /usr/local/bin/autoconf ------------------------------------------------------------------ autoconf (GNU Autoconf) 2.72c Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+/Autoconf: GNU GPL version 3 or later , This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David J. MacKenzie and Akim Demaille. ################################################################## automake is /usr/local/bin/automake ------------------------------------------------------------------ automake (GNU automake) 1.16.5 Copyright (C) 2021 Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Tom Tromey and Alexandre Duret-Lutz . ################################################################## # Generating files # ################################################################## autoreconf: export WARNINGS= autoreconf: Entering directory '.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --force -I m4 configure.ac:34: error: must install pkg-config 0.18 or later before running ./autogen.sh configure.ac:34: the top level autom4te: error: /usr/bin/m4 failed with exit status: 1 aclocal: error: /usr/local/bin/autom4te failed with exit status: 1 autoreconf: error: aclocal failed with exit status: 1 ```
Build command ```bash cd ${SRC_DIR} ./autogen.sh CC="${C_COMPILER}" CFLAGS="${CFLAGS}" \ ./configure --prefix=${INSTALL_DIR} make -j $NUM_THREADS all sudo make install all cd - ```

Build output in start, says what i have pkg-config with 0.29.2, but error says pkg-config not installed or version less then 0.18... I am not understand what going wrong. Trying check configure.ac file for more information, but without result...

How i can fix this?

leleliu008 commented 10 months ago

where is your pkg.m4 file located?

unrealslayer commented 10 months ago

where is your pkg.m4 file located?

/usr/share/aclocal/pkg.m4 (root:root) (-rw-r--r--)

leleliu008 commented 10 months ago

It seems that the pkg-config command is found, but pkg.m4 is not found, you could fix this via:

export ACLOCAL_PATH=/usr/share/aclocal
unrealslayer commented 10 months ago

It seems that the pkg-config command is found, but pkg.m4 is not found, you could fix this via:

export ACLOCAL_PATH=/usr/share/aclocal

Thank you! Build fixed! Do you know why i must explicit set ACLOCAL_PATH var?

leleliu008 commented 10 months ago

I'm not sure the exact reason, but https://www.gnu.org/software/automake/manual/html_node/Macro-Search-Path.html may help you to understand.

leleliu008 commented 10 months ago

Oh, I see, I found your aclocal path is /usr/local/bin/aclocal, so the default macro search path sould be /usr/local/share/aclocal, but actually your pkg.m4 is located in /usr/share/aclocal which in turn is not the default macro search path. that's why you should explicitly set ACLOCAL_PATH

your pkg-config command path is /usr/bin/pkg-config, it shouldn't be /usr/local/bin/pkg-config?

leleliu008 commented 10 months ago

The most obvious reason is that you installed pkg-config via apt, but other packages were installed via other package manager or manully built and --prefix=/usr/local option was used.

unrealslayer commented 10 months ago

The most obvious reason is that you install pkg-config via apt, but other packages is installed via other package manager or manully built and --prefix=/usr/local option is used.

Its true, automake, autoconf was builded from sources, but pkg-config is not... I am did not know what it can give me so strange errors, thank you again! I will try build pkg-config from sources too and hope what aclocal variable no longer needed explicit set!