buildSwiftOnARM icon indicating copy to clipboard operation
buildSwiftOnARM copied to clipboard

[arm32][5.0] swiftpm/Sources/SPMUtility/FSWatch.swift:444:19: error: cannot assign value of type '(Int, Int, Int , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)'

Open uraimo opened this issue 6 years ago • 1 comments

Compiling Swift Module 'Basic' (38 sources)
Linking PackageDescription4
Linking Basic
Compiling Swift Module 'SPMUtility' (20 sources)
/mnt/buildSwiftOnARM/swiftpm/Sources/SPMUtility/FSWatch.swift:444:19: error: cannot assign value of type '(Int, Int, Int
, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)' to type '(__fd_mask, __fd_mask, __fd_mask, __fd_mask
, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mas
k, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_ma
sk, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask, __fd_mask)' (aka '(Int, Int, Int, Int, Int, Int, Int, Int, In
t, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)')
        set.__fds_bits = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- bootstrap: error: build failed with exit status 1
./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

uraimo avatar Mar 31 '19 10:03 uraimo

Since we don't have glibc shims for some of the FD_ function declared in sys/select.h, those have been redeclared in FSWatch.swift. On Linux, this is the set of defines that create the fd_set structure:

typedef long int __fd_mask;

/* Some versions of <linux/posix_types.h> define this macros.  */
#undef  __NFDBITS
/* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
#define __NFDBITS       (8 * (int) sizeof (__fd_mask))
#define __FD_MASK(d)    ((__fd_mask) (1UL << ((d) % __NFDBITS)))

#define      __FD_SETSIZE            1024  //Defined elsewhere.

/* fd_set for select and pselect.  */
typedef struct
  {
    __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
  } fd_set;

I wouldn't be surprised if __FD_SETSIZE had another value on a different platform.

Edit: On arm32 the overall size of the struct is the same but the slot are only 32bits long now, increasing the number of slots to 32 as reported by the error. While the patch added here will include an ifdef for arm32, the easier solution to this would be to ad the required function to the glibc shim (probably the actual fix I will propose to swiftpm).

uraimo avatar Mar 31 '19 11:03 uraimo