Menu

#318 0.10.1 compilation error - invalid conversion

0.10.1
closed
nobody
None
notabug
2018-02-06
2018-02-06
Darek
No

Description:
lirc 0.10.1 - compilation error on Arch Linux
Same error also with lirc-git r3242.b057b11e-1

https://www.archlinux.org/packages/extra/x86_64/lirc/

Additional info:

  • package version(s)
    gcc 7.3.0-1
    libtool 2.4.6+40+g6ca5e224-4
    glibc 2.26-11
Making all in daemons
lircd.cpp: In function ‘void drop_privileges()’:
lircd.cpp:709:55: error: invalid conversion from ‘int*’ to ‘__gid_t* {aka unsigned int*} [-fpermissive]
  r = getgrouplist(user, pw->pw_gid, groups, &group_cnt);
                                                       ^
In file included from lircd.cpp:33:0:
/usr/include/grp.h:186:12: note:   initializing argument 3 of ‘int getgrouplist(const char*, __gid_t, __gid_t*, int*) extern int getgrouplist (const char *__user, __gid_t __group,
            ^~~~~~~~~~~~
make[2]: *** [Makefile:533: lircd.o] Error 1
make[2]: *** Waiting for unfinished jobs....
libtool: link: g++ -march=native -O2 -pipe -fstack-protector-strong -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -o .libs/lircmd lircmd-lircmd.o  -lpthread -lsystemd ../lib/.libs/liblirc.so -ldl -ludev
make[1]: *** [Makefile:1098: all-recursive] Error 1
make: *** [Makefile:581: all] Error 2
==> ERROR: A failure occurred in build().

Related

Tickets: #322

Discussion

  • Alec Leamas

    Alec Leamas - 2018-02-06

    Oops... Could you please

    • grep for getgroup in the output from ./configure and post that line?
    • Try to patch config.h after running ./configure but before make, changung GETGROUPS_T to either int or gid_t and then run make. Does the build fly?
    • Check the signature for getgroups on your system using man getgroups and post it?
     

    Last edit: Alec Leamas 2018-02-06
    • Darek

      Darek - 2018-02-06
      • grep for getgroup in the output from ./configure and post that line?
      • Try to patch config.h after running ./configure but before make, changung GETGROUPS_T to either int or gid_t and then run make. Does the build fly?

      compilation using 'makepkg -sr' [1]:
      [1] https://wiki.archlinux.org/index.php/Makepkg
      configure:

      checking Figure out if getgrouplist() needs gid_t or int... int
      

      config.h (not modified by me):

      /* type of argument 3 in getgrouplist() */
      #define GETGROUPS_T int
      

      Error log above (full log -> lirc-1:0.10.1-1-x86_64-build.log)

      traditional way:

      cd lirc-0.10.1
      ./configure --prefix=/usr --sbindir=/usr/bin --sysconfdir=/etc --localstatedir=/var
      make
      

      configure:

      checking Figure out if getgrouplist() needs gid_t or int... gid_t
      

      config.h (not modified by me):

      /* type of argument 3 in getgrouplist() */
      #define GETGROUPS_T gid_t
      

      error log:

      Making all in systemd
      Traceback (most recent call last):
        File "setup.py", line 15, in <module>
          from setuptools import setup, Extension
      ModuleNotFoundError: No module named 'setuptools'
      make[2]: *** [Makefile:1623: python-pkg/dist/lirc-0.10.1.tar.gz] Error 1
      make[1]: *** [Makefile:1092: all-recursive] Error 1
      make: *** [Makefile:572: all] Error 2
      

      full log -> errlog-traditional_way

      • Check the signature for getgroups on your system using man getgroups and post it?

      I was not sure what to paste, so please see mangr

       
      • Darek

        Darek - 2018-02-06

        lirc-1:0.10.1-1-x86_64-build.log

         
      • Darek

        Darek - 2018-02-06

        mangr

         
      • Alec Leamas

        Alec Leamas - 2018-02-06

        This is diifferent, and simpler: You are missing python3-setuptools.

         
        • Darek

          Darek - 2018-02-06

          Ops.. it works now.

           
  • Alec Leamas

    Alec Leamas - 2018-02-06

    All in all: when building the "traditional" way configure identifies GETGROUPS_T as gid_t and compilation is fine. Later, build fails on a missing python3-setuptools package, but this is unrelated.

    OTOH, when doing makepkg -sr configure identifies GETGROUPS_T as int, and build fails.

    Right?

    Now, first we really need that line from man getgroups, the one that for me reads

     int getgroups(int size, gid_t list[]);
    

    What does the manpage for your system say?

     
    • Alec Leamas

      Alec Leamas - 2018-02-06

      Also, we need an excerpt from the config.log file created by makepkg. In that file, look for this piece and post it (it's pobably similar but different for you):

      configure:16714: checking Figure out if getgrouplist() needs gid_t or int
      configure:16735: gcc -c -Werror  conftest.c >&5
      configure:16735: $? = 0
      
       

      Last edit: Alec Leamas 2018-02-06
      • Darek

        Darek - 2018-02-06

        config.log :

        configure:17341: checking Figure out if getgrouplist() needs gid_t or int
        configure:17362: gcc -c -Werror -D_FORTIFY_SOURCE=2 conftest.c >&5
        In file included from /usr/include/unistd.h:25:0,
                         from conftest.c:38:
        /usr/include/features.h:376:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
         #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
            ^~~~~~~
        cc1: all warnings being treated as errors
        configure:17362: $? = 1
        configure: failed program was:
        | /* confdefs.h */
        | #define PACKAGE_NAME "lirc"
        | #define PACKAGE_TARNAME "lirc"
        | #define PACKAGE_VERSION "0.10.1"
        | #define PACKAGE_STRING "lirc 0.10.1"
        | #define PACKAGE_BUGREPORT ""
        | #define PACKAGE_URL ""
        | #define PACKAGE "lirc"
        | #define VERSION "0.10.1"
        | #define STDC_HEADERS 1
        | #define HAVE_SYS_TYPES_H 1
        | #define HAVE_SYS_STAT_H 1
        | #define HAVE_STDLIB_H 1
        | #define HAVE_STRING_H 1
        | #define HAVE_MEMORY_H 1
        | #define HAVE_STRINGS_H 1
        | #define HAVE_INTTYPES_H 1
        | #define HAVE_STDINT_H 1
        | #define HAVE_UNISTD_H 1
        | #define HAVE_DLFCN_H 1
        | #define LT_OBJDIR ".libs/"
        | #define STDC_HEADERS 1
        | #define TIME_WITH_SYS_TIME 1
        | #define GWINSZ_IN_SYS_IOCTL 1
        | #define HAVE_FCNTL_H 1
        | #define HAVE_LIMITS_H 1
        | #define HAVE_LINUX_IOCTL_H 1
        | #define HAVE_LINUX_SCHED_H 1
        | #define HAVE_POLL_H 1
        | #define HAVE_SYS_IOCTL_H 1
        | #define HAVE_SYS_POLL_H 1
        | #define HAVE_SYS_TIME_H 1
        | #define HAVE_SYSLOG_H 1
        | #define HAVE_UNISTD_H 1
        | #define HAVE_PTY_H 1
        | /* end confdefs.h.  */
        | 
        | #include <unistd.h>
        | #include <grp.h>
        | 
        | int
        | main ()
        | {
        | 
        | gid_t groups[32]; int ngroups; const char* user = "root";
        | getgrouplist(user, 1, groups, &ngroups);
        | 
        |   ;
        |   return 0;
        | }
        configure:17371: result: int
        
         
    • Darek

      Darek - 2018-02-06

      OTOH, when doing makepkg -sr configure identifies GETGROUPS_T as int, and build fails.
      Right?

      Yes

      Now, first we really need that line from man getgroups, the one that for me reads
      int getgroups(int size, gid_t list[]);

      int getgroups(int gidsetsize, gid_t grouplist[]);
      

      That's what you asked for?

       

      Last edit: Darek 2018-02-06
      • Alec Leamas

        Alec Leamas - 2018-02-06

        That's what you asked for?

        Yes. The conclusion is clear: the failed build is caused by having a inconsustent combination of CFLAGS when running configure. What's happnening is that configure tries to compile a very small test program using gid_t. If this is OK, gid_t is OK; if not, it uses int instead.

        Now, the compilation issues a warning because -DFORTIFY_SOURCE is without any optimazation. Normally, we could skip this warning, but the test concludes that using gid_t is wrong and falls back to int.

        The solution is to use a consistent set of CFLAGS while running configure - either remove -DFORITIFY_SOURCE or add -O2. From what I can see, lirc doesn't do anything wrong here.

        I'm leaning to close this at not-a-bug

         
        • Darek

          Darek - 2018-02-06

          Thank you very much for your help. Of course, the ticket can be closed

           
          • Alec Leamas

            Alec Leamas - 2018-02-06

            You are welcome, NP

             
  • Alec Leamas

    Alec Leamas - 2018-02-06
    • status: open --> closed
    • Resolution: na --> notabug
     

Log in to post a comment.

MongoDB Logo MongoDB