[MDEV-29955] MariaDB does not make full use of pkgconfig Created: 2022-11-06  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Compiling, Configuration
Affects Version/s: 10.9.3, 10.11.0
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Minor
Reporter: Dimitri Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: beginner-friendly, compilation, configuration, pkgconfig
Environment:

Ubuntu 22.04

Own package installations from source...


Attachments: Text File 1_CMakeCache.txt     File 1_CMakeError.log     File 1_CMakeOutput.log     Text File 2_CMakeCache.txt     File 2_CMakeError.log     File 2_CMakeOutput.log    

 Description   

Hi.

This problem i had also in previous releases.

I've installed openssl, pcre2, curl, zlib, ncurses ect. from source.
My installation structure is "/own/dep/..."

The .pc-files (PKG-Config) are in /usr/share/pkgconfig and if i test each of them with pkg-config (e.g "pkg-config zlib --libs / --cflags") all is fine.

For compiling mariadb i set the cmake-options:

  • -DWITH_ZLIB=system
  • -DWITH_LIBFMT=system
  • -DWITH_PCRE=system
  • ...

but zlib, libfmt, pcre2-8 and ncurses are not found:

Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
...
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
...
CMake Error at cmake/pcre.cmake:84 (MESSAGE):
  system pcre2-8 library is not found or unusable

Why mariadb doesn't find these packages while others like openssl and curl are found?

The output of pkg-config (libdir | includedir | libs | cflags):

zlib:
====================================

  • /own/dep/zlib/lib
  • /own/dep/zlib/include
  • -L/own/dep/zlib/lib -lz
  • -I/own/dep/zlib/include
    ====================================

fmt:
====================================

  • /own/dep/libfmt/lib
  • /own/dep/libfmt/include
  • -L/own/dep/libfmt/lib -lfmt
  • -I/own/dep/libfmt/include
    ====================================

ncurses:
====================================

  • /own/dep/libncurses/lib
  • /own/dep/libncurses/include/ncurses
  • -L/own/dep/pcre2/lib -lncurses -lpcre2-posix
  • -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -I/own/dep/libncurses/include/ncurses -I/own/dep/libncurses/include
    ====================================

libpcre2-8 / libpcre2-posix
====================================

  • /own/dep/pcre2/lib
  • /own/dep/pcre2/include
  • -L/own/dep/pcre2/lib -lpcre2-8 / -lpcre2-posix
  • -I/own/dep/pcre2/include
    ====================================

I know that i can use additional options like -DZLIB_... or -DCURSES_...

But why, as i said mariadb found openssl and curl with pkg-config but not the others?

Other programs like nginx and php found all of them!



 Comments   
Comment by Daniel Black [ 2022-11-07 ]

Can you attach CMakeFiles/CMake{Output,Error}.log?

Comment by Dimitri [ 2022-11-07 ]

Attached all Files.

Files with 1_* are after a fresh extracting and first cmake call.
Files with 2_* are after deleting CMakeCache ect. and second cmake call with additional options "-DCURSES_LIBRARY=/own/dep/libncurses/lib/libncurses.so -DCURSES_INCLUDE_PATH=/own/dep/libncurses/include/ncurses"

After first call it ends with:
=========================
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.22/Modules/FindCurses.cmake:268 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/readline.cmake:55 (FIND_PACKAGE)
cmake/readline.cmake:185 (FIND_CURSES)
CMakeLists.txt:388 (MYSQL_CHECK_READLINE)
=========================

After second call it ends with:
=========================
CMake Error at cmake/pcre.cmake:84 (MESSAGE):
system pcre2-8 library is not found or unusable
Call Stack (most recent call first):
CMakeLists.txt:392 (CHECK_PCRE)
=========================

I don't understand why after adding CURSES_INCLUDE_PATH in the second call the files "curses.h" and "term.h" still not found:
=========================
– Looking for include files curses.h, term.h
– Looking for include files curses.h, term.h - not found
=========================

These files are in /own/dep/libncurses/include/ncurses, as i set in CURSES_INCLUDE_PATH...

After set the following environment variables pcre2 is found:
=========================
export CXXFLAGS=-I/own/dep/pcre2/include
export LDFLAGS=-L/own/dep/pcre2/lib
...
– Looking for pcre2_match_8 in pcre2-8
– Looking for pcre2_match_8 in pcre2-8 - found
=========================

After next cmake call it ends with:
=========================
CMake Error at cmake/libfmt.cmake:45 (MESSAGE):
system libfmt library is not found or unusable
Call Stack (most recent call first):
CMakeLists.txt:393 (CHECK_LIBFMT)
=========================

After adding libfmt-paths to CXX/LDFLAGS the next call is successful done...

... but compilation ends with the following:
=========================
[ 40%] Building C object client/CMakeFiles/mariadb-import.dir/mysqlimport.c.o
/own/tmp/mariadb-10.9.3/client/mysql.cc:81:10: fatal error: curses.h: No such file or directory
81 | #include <curses.h>

compilation terminated.
=========================

Why? "curses.h" is in /own/dep/libncurses/include/ncurses. cmake knows this path.

Generated at Thu Feb 08 10:12:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.