Menu

#1392 compilling error (gentoo gcc): 'uintptr_t' was not declared in this scope

fixed_in_SVN
closed
None
1
2019-11-11
2018-01-14
ilian
No
slirp/cksum.cc: In function 'int cksum(mbuf*, int)':
slirp/cksum.cc:83:12: error: 'uintptr_t' was not declared in this scope
  if ((1 & (uintptr_t)w) && (mlen > 0)) {
            ^~~~~~~~~
slirp/cksum.cc:83:12: note: suggested alternative: 'intptr_t'
  if ((1 & (uintptr_t)w) && (mlen > 0)) {
            ^~~~~~~~~
            intptr_t
slirp/cksum.cc:83:22: error: expected ')' before 'w'
  if ((1 & (uintptr_t)w) && (mlen > 0)) {
                      ^
slirp/cksum.cc:95:2: error: expected ')' before 'while'
  while ((mlen -= 32) >= 0) {
  ^~~~~
make[1]: *** [Makefile:116: slirp/cksum.lo] Error 1

https://paste.pound-python.org/show/SjlkYypzKhpKvKRY3T2W/

Discussion

  • tyler

    tyler - 2018-01-30

    I can confirm this.

    I use GCC 7.1.0.

    This fix worked for me:
    sed -i iodev/network/slirp/cksum.cc -e 's@uintptr_t@int)(uint8_t *@'

    but I don't know if it results in the correct runtime behavior.

     
    • Scott Duensing

      Scott Duensing - 2018-02-26

      Same issue on Ubuntu 17.10. Above fix results in compiler error about truncating a value.

       
  • noa body

    noa body - 2018-05-19

    Happens on Ubuntu Bionic 18.04LTS.

    iodev/network/slirp/slirp.h line 48 needs to add || (__linux__) :
    #if defined(__OpenBSD__) || (__linux__)

    It's lust looking for that line:
    #include <stdint.h>

     

    Last edit: noa body 2018-07-30
    • J Beggs

      J Beggs - 2019-06-09

      The patch works for me on Mint 19. Didn't compile otherwise. Is there a way to get this into the repository?

       
  • CK

    CK - 2019-08-29

    Same here with gcc-9.1.1 on a Fedora 30 system:

    g++ -c  -I.. -I../.. -I./.. -I./../.. -I../../instrument/stubs -I./../../instrument/stubs -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -pthread    slirp/cksum.cc -o slirp/cksum.o
    slirp/cksum.cc: In function int cksum(mbuf*, int):
    slirp/cksum.cc:84:12: error: uintptr_t was not declared in this scope; did you mean intptr_t?
       84 |  if ((1 & (uintptr_t)w) && (mlen > 0)) {
          |            ^~~~~~~~~
          |            intptr_t
    slirp/cksum.cc:84:22: error: expected ) before w
       84 |  if ((1 & (uintptr_t)w) && (mlen > 0)) {
          |      ~               ^
          |                      )
    slirp/cksum.cc:91:3: error: expected ) before while
       91 |  }
          |   ^
          |   )
    ......
       96 |  while ((mlen -= 32) >= 0) {
          |  ~~~~~
    slirp/cksum.cc:84:5: note: to match this (
       84 |  if ((1 & (uintptr_t)w) && (mlen > 0)) {
          |     ^
    

    The fix mentioned above indeed works:

    $ svn diff
    Index: iodev/network/slirp/cksum.cc
    ===================================================================
    --- iodev/network/slirp/cksum.cc        (revision 13569)
    +++ iodev/network/slirp/cksum.cc        (working copy)
    @@ -34,6 +34,7 @@
      */
    
     #include "slirp.h"
    +#include <stdint.h>
    
     #if BX_NETWORKING && BX_NETMOD_SLIRP
    
     
  • Volker Ruppert

    Volker Ruppert - 2019-11-11
    • status: open --> closed
    • assigned_to: Volker Ruppert
    • Group: can't_reproduce --> fixed_in_SVN
     
  • Volker Ruppert

    Volker Ruppert - 2019-11-11

    Fixed in SVN now.

     
    👍
    1

Log in to post a comment.

MongoDB Logo MongoDB