0

I am using cmake (3.22.1) to compile tigervnc (1.13.0) from source on Ubuntu (22.04LTS). I have met all dependencies but one.

My build fails with the error: "Could not find PAM development files". I installed the package libpam0g-dev, and I know for a fact that the PAM development files in question are located here: /usr/include/security/pam_appl.h.

How can I get CMake to find the files? Any help will be greatly appreciated. Thanks!

Determining if files security/pam_appl.h exist failed with the following output:
Change Dir: /usr/local/src/tigervnc/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_da0c0/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_da0c0.dir/build.make CMakeFiles/cmTC_da0c0.dir/build
gmake[1]: Entering directory '/usr/local/src/tigervnc/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_da0c0.dir/HAVE_PAM_H.c.o
/usr/bin/cc   -std=gnu99 -Wall -Wextra -Wformat=2 -Wvla  -o CMakeFiles/cmTC_da0c0.dir/HAVE_PAM_H.c.o -c /usr/local/src/tigervnc/CMakeFiles/CheckIncludeFiles/HAVE_PAM_H.c
/usr/local/src/tigervnc/CMakeFiles/CheckIncludeFiles/HAVE_PAM_H.c:2:10: fatal error: security/pam_appl.h: No such file or directory
    2 | #include <security/pam_appl.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[1]: *** [CMakeFiles/cmTC_da0c0.dir/build.make:78: CMakeFiles/cmTC_da0c0.dir/HAVE_PAM_H.c.o] Error 1
gmake[1]: Leaving directory '/usr/local/src/tigervnc/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_da0c0/fast] Error 2


Source:
/* */
#include <security/pam_appl.h>


int main(void){return 0;}

Determining if the function pam_start exists failed with the following output:
Change Dir: /usr/local/src/tigervnc/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_4a751/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_4a751.dir/build.make CMakeFiles/cmTC_4a751.dir/build
gmake[1]: Entering directory '/usr/local/src/tigervnc/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_4a751.dir/CheckFunctionExists.c.o
/usr/bin/cc   -std=gnu99 -Wall -Wextra -Wformat=2 -Wvla -DCHECK_FUNCTION_EXISTS=pam_start -o CMakeFiles/cmTC_4a751.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
Linking C executable cmTC_4a751
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4a751.dir/link.txt --verbose=1
/usr/bin/cc  -std=gnu99 -Wall -Wextra -Wformat=2 -Wvla -DCHECK_FUNCTION_EXISTS=pam_start CMakeFiles/cmTC_4a751.dir/CheckFunctionExists.c.o -o cmTC_4a751  -lpam
/usr/bin/ld: cannot find -lpam: No such file or directory
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_4a751.dir/build.make:99: cmTC_4a751] Error 1
gmake[1]: Leaving directory '/usr/local/src/tigervnc/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_4a751/fast] Error 2
starball
  • 20,030
  • 7
  • 43
  • 238
  • Hint the location in your configuration command with `-DPAM_DIR=<...>`? See #3 of https://cmake.org/cmake/help/latest/command/find_package.html#id9 – starball Mar 05 '23 at 06:18
  • 1
    @user: The error is not from `find_package`, but from `check_include_files` call (https://github.com/TigerVNC/tigervnc/blob/master/CMakeLists.txt#L280). (The formatted log is not the output from CMake but a content of `CMakeLog.txt`). Variables, which tunes the behavior of `find_package`, doesn't affect on `check_include_files`. – Tsyvarev Mar 05 '23 at 09:19
  • 1
    @Johnny: Do you **actually** have the file `/usr/include/security/pam_appl.h`? You may check that e.g. with `ls /usr/include/security/pam_appl.h`. If you have this file but the error persists, then it means that your compiler doesn't look into `/usr/include` by default. But in that directory there are standard headers (like `signal.h`) which should be accessibly without additional options to compiler... What compiler do you use? (`/usr/bin/cc --version`). – Tsyvarev Mar 05 '23 at 09:29
  • @Tsyvarev I do actually have the file. My compiler is cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0. You say that this means my compiler isn't looking in `/usr/include` by default. Is there a way for me to change that configuration? – Johnny B Mar 06 '23 at 05:48
  • Run `cc -xc -E -v -` and check the list of directories after `#include <...> search starts here:` (the command is taken from [here](https://stackoverflow.com/questions/4980819/what-are-the-gcc-default-include-directories), after running it press Ctrl+C for return to shell). Is `/usr/include` listed? – Tsyvarev Mar 06 '23 at 07:40
  • @Tsyvarev I receive the following output `#include <...> search starts here: /usr/lib/gcc/x86_64-linux-gnu/11/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/include End of search list.` – Johnny B Mar 07 '23 at 16:02
  • The output clearly tells that `/usr/include` is actually searched by the compiler by default. So, either there is no file `/usr/include/security/pam_appl.h` on your machine, or content of `CMakeOutput.txt` which you posted is stale: E.g. you got this content **before** installing package `libpam0g-dev`. – Tsyvarev Mar 07 '23 at 16:17
  • @Tsyvarev I am inside the file now. This is the beginning of it: `* * * This header file collects definitions for the PAM API --- that is, * public interface between the PAM library and an application program * that wishes to use it. * * Note, the copyright information is at end of file. */ #ifndef _SECURITY_PAM_APPL_H #define _SECURITY_PAM_APPL_H #ifdef __cplusplus extern "C" { #endif #include /* Linux-PAM common defined types */` – Johnny B Mar 07 '23 at 16:23
  • @Tsyvarev Inside of my build directory I run the command `cmake -G "Unix Makefiles" /usr/local/src/tigervnc` and receive the error log: `Performing C SOURCE FILE Test ICONV_SECOND_ARGUMENT_IS_CONST failed with the following output: Change Dir: /usr/local/src/tigervnc/CMakeFiles/CMakeTmp` and `Determining if files security/pam_appl.h exist failed with the following output: Change Dir: /usr/local/src/tigervnc/CMakeFiles/CMakeTmp` there's more, of course, but I can't paste the entire error log. This was just generated. – Johnny B Mar 07 '23 at 16:27
  • @Tsyvarev I started the project from scratch, only this time I used the updated version of cmake (3.25.2). It did not detect the SELinux development files, but it did find the PAM files. I was able to compile. Thank you for your assistance with this. – Johnny B Mar 07 '23 at 23:21

0 Answers0