Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-1178

Unable to install 'couchbase' module due to '-Werror' flag

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.2.7
    • library
    • None
    • 1

    Description

      What's the issue?
      I'm currently unable to install the 'couchbase' Python module on my local machine, looking at the output, it appears to be failing due to a warning (which is being treated as an error due to the use of the '-Werror' flag in 'cbuild_config.py').

      GCC non-zero exit status

      [pipenv.exceptions.InstallError]:     src/iops.c: In function ‘update_event’:
      [pipenv.exceptions.InstallError]:     src/iops.c:412:17: error: array subscript ‘lcb_uint32_t {aka unsigned int}[0]’ is partly outside array bounds of ‘short int[1]’ [-Werror=array-bounds]
      [pipenv.exceptions.InstallError]:       412 |         usecs = *(lcb_uint32_t*)arg;
      [pipenv.exceptions.InstallError]:           |                 ^~~~~~~~~~~~~~~~~~~
      [pipenv.exceptions.InstallError]:     src/iops.c:516:69: note: while referencing ‘flags’
      [pipenv.exceptions.InstallError]:       516 | update_event(lcb_io_opt_t io, lcb_socket_t sock, void *event, short flags,
      [pipenv.exceptions.InstallError]:           |                                                               ~~~~~~^~~~~
      [pipenv.exceptions.InstallError]:     src/iops.c: In function ‘delete_event’:
      [pipenv.exceptions.InstallError]:     src/iops.c:412:17: error: array subscript ‘lcb_uint32_t {aka unsigned int}[0]’ is partly outside array bounds of ‘short int[1]’ [-Werror=array-bounds]
      [pipenv.exceptions.InstallError]:       412 |         usecs = *(lcb_uint32_t*)arg;
      [pipenv.exceptions.InstallError]:           |                 ^~~~~~~~~~~~~~~~~~~
      [pipenv.exceptions.InstallError]:     src/iops.c:548:11: note: while referencing ‘tmp’
      [pipenv.exceptions.InstallError]:       548 |     short tmp = 0;
      [pipenv.exceptions.InstallError]:           |           ^~~
      [pipenv.exceptions.InstallError]:     cc1: all warnings being treated as errors
      [pipenv.exceptions.InstallError]:     error: command '/usr/bin/gcc' failed with exit code 1
      

      I've confirmed that I can build the SDK using 'pip3 install --user .' in the SDK repository if I remove this compiler flag.

      I imagine this may be something to do with newer versions of GCC having improved/new warnings which weren't picked up by older releases (I've included the GCC version below)?

      GCC Version

      gcc (GCC) 11.1.0
      Copyright (C) 2021 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions.  There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      

      Attachments

        1. Dockerfile.arch
          0.2 kB
        2. logs.txt
          641 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          jared.casey Jared Casey added a comment -

          Hi James Lee - I have tried to repeat this issue (fire up a Ubuntu Docker container, install gcc-11 build the client) and I am not able to repeat the issue. Is there anyway you can repeat this via a container so that I can see what might be happening?

          I do not think removing the -Werror flag is going to be the path we follow, but instead correct the compilation error.

          jared.casey Jared Casey added a comment - Hi James Lee - I have tried to repeat this issue (fire up a Ubuntu Docker container, install gcc-11 build the client) and I am not able to repeat the issue. Is there anyway you can repeat this via a container so that I can see what might be happening? I do not think removing the -Werror flag is going to be the path we follow, but instead correct the compilation error.
          james.lee James Lee added a comment -

          Hi Jared Casey,

          This may be reproducible using an Arch Linux docker container, but I haven't tried. I've attached the full log for the 'pip3 install --user .' on my local machine.

          Thanks,
          James

          james.lee James Lee added a comment - Hi Jared Casey , This may be reproducible using an Arch Linux docker container, but I haven't tried. I've attached the full log for the ' pip3 install --user . ' on my local machine. Thanks, James
          marks.polakovs Marks Polakovs (Inactive) added a comment - - edited

          Hi Jared Casey, I was able to reproduce this inside an Arch container as James Lee suggested - I've attached the Dockerfile I used, and also pushed an image with all but the last step to GHCR, so you should be able to do:

          $ docker run --rm -it ghcr.io/markspolakovs/pycbc-1178-repro
          # python3 -m pip install couchbase
          

          It fails with:

            gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wf
          ormat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -ffat-lto-objects -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORT
          IFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIF
          Y_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -fPIC -Ibuild/temp.linux-x86_64-3.10/install/include -I/usr/include/python3.
          10 -Ibuild/temp.linux-x86_64-3.10/install/include -c src/iops.c -o build/temp.linux-x86_64-3.10/src/iops.o -Wno-strict-prototypes -fPIC -std=c11 -Wuninitialized -Wswit
          ch -Werror -Wno-missing-braces -DPYCBC_LCB_API=0x02FF04 -DPYCBC_LCB_API=0x02FF04                                                                                        
            src/iops.c: In function ‘delete_event’:                                                                                                                               
            src/iops.c:412:17: error: array subscript ‘lcb_uint32_t[0]’ is partly outside array bounds of ‘short int[1]’ [-Werror=array-bounds]                                   
              412 |         usecs = *(lcb_uint32_t*)arg;                                                                                                                          
                  |                 ^~~~~~~~~~~~~~~~~~~                                                                                                                           
            src/iops.c:533:11: note: while referencing ‘tmp’                                                                                                                      
              533 |     short tmp = 0;                                                                                                                                            
                  |           ^~~                                                                                                                                                 
            src/iops.c: In function ‘update_event’:                                                                                                                               
            src/iops.c:412:17: error: array subscript ‘lcb_uint32_t[0]’ is partly outside array bounds of ‘short int[1]’ [-Werror=array-bounds]                                   
              412 |         usecs = *(lcb_uint32_t*)arg;                                                                                                                          
                  |                 ^~~~~~~~~~~~~~~~~~~                                                                                                                           
            src/iops.c:501:69: note: while referencing ‘flags’                                                                                                                    
              501 | update_event(lcb_io_opt_t io, lcb_socket_t sock, void *event, short flags,                                                                                    
                  |                                                               ~~~~~~^~~~~                                                                                     
            cc1: all warnings being treated as errors                                                                                                                             
            error: command '/usr/sbin/gcc' failed with exit code 1                                                                                                                
            ----------------------------------------                                                                                                                              
            ERROR: Failed building wheel for couchbase
          

          marks.polakovs Marks Polakovs (Inactive) added a comment - - edited Hi Jared Casey , I was able to reproduce this inside an Arch container as James Lee suggested - I've attached the Dockerfile I used, and also pushed an image with all but the last step to GHCR, so you should be able to do: $ docker run --rm -it ghcr.io/markspolakovs/pycbc-1178-repro # python3 -m pip install couchbase It fails with:  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wf ormat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -ffat-lto-objects -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORT IFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIF Y_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -fPIC -Ibuild/temp.linux-x86_64-3.10/install/include -I/usr/include/python3. 10 -Ibuild/temp.linux-x86_64-3.10/install/include -c src/iops.c -o build/temp.linux-x86_64-3.10/src/iops.o -Wno-strict-prototypes -fPIC -std=c11 -Wuninitialized -Wswit ch -Werror -Wno-missing-braces -DPYCBC_LCB_API=0x02FF04 -DPYCBC_LCB_API=0x02FF04                                                                                          src/iops.c: In function ‘delete_event’:                                                                                                                                 src/iops.c:412:17: error: array subscript ‘lcb_uint32_t[0]’ is partly outside array bounds of ‘short int[1]’ [-Werror=array-bounds]                                       412 |         usecs = *(lcb_uint32_t*)arg;                                                                                                                                  |                 ^~~~~~~~~~~~~~~~~~~                                                                                                                             src/iops.c:533:11: note: while referencing ‘tmp’                                                                                                                          533 |     short tmp = 0;                                                                                                                                                    |           ^~~                                                                                                                                                   src/iops.c: In function ‘update_event’:                                                                                                                                 src/iops.c:412:17: error: array subscript ‘lcb_uint32_t[0]’ is partly outside array bounds of ‘short int[1]’ [-Werror=array-bounds]                                       412 |         usecs = *(lcb_uint32_t*)arg;                                                                                                                                  |                 ^~~~~~~~~~~~~~~~~~~                                                                                                                             src/iops.c:501:69: note: while referencing ‘flags’                                                                                                                        501 | update_event(lcb_io_opt_t io, lcb_socket_t sock, void *event, short flags,                                                                                            |                                                               ~~~~~~^~~~~                                                                                       cc1: all warnings being treated as errors                                                                                                                               error: command '/usr/sbin/gcc' failed with exit code 1                                                                                                                  ----------------------------------------                                                                                                                                ERROR: Failed building wheel for couchbase
          jared.casey Jared Casey added a comment -

          Hi Marks Polakovs  - Thanks for the Docker hints! 

           

          I was able to reproduce and should have a fix in for the 3.2.7 release.

          jared.casey Jared Casey added a comment - Hi Marks Polakovs   - Thanks for the Docker hints!    I was able to reproduce and should have a fix in for the 3.2.7 release.
          jared.casey Jared Casey added a comment -

          Updated iops modify_event method to more clear method signature. Also helps remove potential compiler error.

          jared.casey Jared Casey added a comment - Updated iops modify_event method to more clear method signature. Also helps remove potential compiler error.

          People

            jared.casey Jared Casey
            james.lee James Lee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty