vapor-community / sockets

🔌 Non-blocking TCP socket layer, with event-driven server and client.
MIT License
575 stars 54 forks source link

swift build error on armv7l debian #61

Closed mackhowell closed 8 years ago

mackhowell commented 8 years ago

in trying to add your library as a swift package, i cannot successfully $ swift build. i'm not sure if this is an issue due to the architecture i'm using, or if i'm doing something else completely innane. in any case, just wanted to report it. thanks in advance for any assistance!

-- mack

here is the output: `root@chip:~/macks-projects/blink/blink-package/Sources# swift build Compile Swift Module 'SocksCore' (14 sources) /root/macks-projects/blink/blink-package/Packages/Socks-0.7.0/Sources/SocksCore/FDSet.swift:34:20: 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_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_mask, fd_mask, fd_mask, __fd_mask)' (aka '(Int, Int, Int, Int, Int, Int, Int, Int, Int, 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) ^~~~~~~~~~~~

:0: error: build had 1 command failures error: exit(1): /root/macks-projects/pre-built-swift/swift-3.0/usr/bin/swift-build-tool -f /root/macks-projects/blink/blink-package/.build/debug.yaml`
MatthiasKreileder commented 8 years ago

Hi @mackhowell Thanks for bringing this to our attention!

We have so far not looked into running our library on an armv7l debian machine. Can you help us getting started tackling this problem by providing the following information: (1) How did you get swift to run on your architecture and (2) What's the best way to create an environment (virtual machine https://wiki.debian.org/QEMU !?) for us to try things out.

Thanks!

czechboy0 commented 8 years ago

+1, @mackhowell please help us reproduce this locally first. But I see what the issue most likely is - there seems to be a difference between Ubuntu (which we're testing on) and Debian on armv7l. Ubuntu seems to have a differently sized fdset than Debian, so we'll need to investigate 1. what the right size is on Debian is and 2. how to properly if-def that in our code, so that both Linux distro's can be supported.

Feel free to dig in yourself, or help us get it running locally so that we can take a look. Either way, thanks for reporting! 👍

dgsmith commented 8 years ago

I am getting this same error on a BeagleBone Black running Debian and by just commenting out the #if os(Linux) section around line 32 in FDSet.swift and replacing it with set.__fds_bits = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) the error went away. Not sure if there's a way to specify between Debian and Ubuntu, but hopefully this helps!

Additionally, all tests did pass.

czechboy0 commented 8 years ago

Hi @dgsmith, thanks yeah that's useful. We need to look more into separating Linux flavors, at the moment I'm not sure how to do it in code 😊

loganwright commented 8 years ago

I'm closing this for now unless someone comes out that this is still a problem 👍

tthbalazs commented 8 years ago

I just got this error on ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i

$ swift build

Compile Swift Module 'SocksCore' (14 sources)
/Packages/Socks-0.12.2/Sources/SocksCore/FDSet.swift:34:20: 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_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_mask, __fd_mask, __fd_mask, __fd_mask)' (aka '(Int, Int, Int, Int, Int, Int, Int, Int, Int, 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)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<unknown>:0: error: build had 1 command failures

This is my swift version

$ swift --version
Swift version 3.0-dev (LLVM a922364e5b, Clang 968470f170, Swift 4d09c1803c)
Target: armv7--linux-gnueabihf

I also tried the workaround suggested by @dgsmith , and the build continues without errors.

czechboy0 commented 8 years ago

@tthbalazs Thanks for reporting, do you know if there's a way to discern Ubuntu from Debian at compile time? Until we have a compile flag that we can check at compilation time, we can't use the right size of the FDSet.