rpm-software-management / librepo

A library providing C and Python (libcURL like) API for downloading packages and linux repository metadata in rpm-md format
http://rpm-software-management.github.io/librepo/
GNU Lesser General Public License v2.1
74 stars 90 forks source link

cmake searches libselinux but SELINUX is disabled #304

Closed mshurutov closed 4 months ago

mshurutov commented 4 months ago

Hi,

I don't use SELINUX, it is disabled in the kernel and no selinux packages arw installed. But cmake looks for it during configure:

mshurutov@nbook06 git $ git clone https://github.com/rpm-software-management/lib
repo.git                                                                        
Cloning into 'librepo'...                                                       
remote: Enumerating objects: 7120, done.                                        
remote: Counting objects: 100% (466/466), done.                                 
remote: Compressing objects: 100% (221/221), done.                              
remote: Total 7120 (delta 281), reused 386 (delta 235), pack-reused 6654        
Receiving objects: 100% (7120/7120), 3.80 MiB | 7.49 MiB/s, done.               
Resolving deltas: 100% (4651/4651), done.                                       
mshurutov@nbook06 git $ cp -a librepo{,.orig}                                   
mshurutov@nbook06 git $ mkdir librepo/build                                     
mshurutov@nbook06 git $ cd librepo/build                                        
mshurutov@nbook06 build $ zgrep SELINUX /proc/config.gz                         
# CONFIG_SECURITY_SELINUX is not set                                            
mshurutov@nbook06 build $ cmake --version                                       
cmake version 3.27.9                                                            

CMake suite maintained and supported by Kitware (kitware.com/cmake).            
mshurutov@nbook06 build $ cmake ..                                              
-- The C compiler identification is GNU 13.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.1.1") 
-- Checking for modules 'glib-2.0>=2.66;gio-2.0'
--   Found glib-2.0, version 2.78.3
--   Found gio-2.0, version 2.78.3
-- Checking for one of the modules 'libcrypto;openssl'
-- Checking for module 'libxml-2.0'
--   Found libxml-2.0, version 2.12.5
-- Found CURL: /usr/lib64/libcurl.so (found suitable version "8.6.0", minimum required is "7.52.0")   
-- Found gpgme-config at /usr/bin/gpgme-config
-- Found gpgme v1.23.2, checking for flavours...
--  Found flavour 'vanilla', checking whether it's usable...yes
--  Found flavour 'pthread', checking whether it's usable...yes
-- Usable gpgme flavours found:  vanilla pthread
-- Checking for module 'libselinux'
--   Package 'libselinux', required by 'virtual:world', not found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:607 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal)
  CMakeLists.txt:42 (PKG_CHECK_MODULES)

-- Configuring incomplete, errors occurred!
mshurutov@nbook06 build $

How can I disable selinux library search?

mshurutov commented 4 months ago

I tried disabling libselinux library search but cmake was still searching for this library:

mshurutov@nbook06 git $ cp -a librepo{.orig,}                                   
mshurutov@nbook06 git $ mkdir librepo/build                                     
mshurutov@nbook06 git $ cd librepo/build                                        
mshurutov@nbook06 build $ cmake -DCMAKE_DISABLE_FIND_PACKAGE_libselinux=ON ..   
-- The C compiler identification is GNU 13.2.1                                  
-- Detecting C compiler ABI info                                                
-- Detecting C compiler ABI info - done                                         
-- Check for working C compiler: /usr/bin/cc - skipped                          
-- Detecting C compile features                                                 
-- Detecting C compile features - done                                          
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.1.1")                 
-- Checking for modules 'glib-2.0>=2.66;gio-2.0'
--   Found glib-2.0, version 2.78.3
--   Found gio-2.0, version 2.78.3
-- Checking for one of the modules 'libcrypto;openssl'
-- Checking for module 'libxml-2.0'
--   Found libxml-2.0, version 2.12.5
-- Found CURL: /usr/lib64/libcurl.so (found suitable version "8.6.0", minimum required is "7.52.0")   
-- Found gpgme-config at /usr/bin/gpgme-config
-- Found gpgme v1.23.2, checking for flavours...
--  Found flavour 'vanilla', checking whether it's usable...yes
--  Found flavour 'pthread', checking whether it's usable...yes
-- Usable gpgme flavours found:  vanilla pthread
-- Checking for module 'libselinux'
--   Package 'libselinux', required by 'virtual:world', not found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:607 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal)
  CMakeLists.txt:42 (PKG_CHECK_MODULES)

-- Configuring incomplete, errors occurred!
mshurutov@nbook06 build $
jan-kolarik commented 4 months ago

Hi, there was an ENABLE_SELINUX option with default = true added recently to librepo: https://github.com/rpm-software-management/librepo/blob/1.17.0/CMakeLists.txt#L10. I think you just need to disable this one.

mshurutov commented 4 months ago

@jan-kolarik, Thank you very much for your answer!