jakeheis / Shout

SSH made easy in Swift
MIT License
360 stars 105 forks source link

Compiling on Linux #21

Closed jdmcd closed 5 years ago

jdmcd commented 5 years ago

This does not work on Linux currently, unfortunately. I tried the following:

apt-get install -yq libssh2-1-dev

However, compiling then results in the following build log:

/root/project/.build/checkouts/Shout--6099989465269811733/Sources/Bindings/SFTP.swift:38:32: error: ambiguous use of 'S_IRUSR'
            if (value & CShort(S_IRUSR) == CShort(S_IRUSR)) { permissions.owner.insert(.read) }
                               ^
Glibc.S_IRUSR:1:12: note: found this candidate
public var S_IRUSR: mode_t { get }
           ^
SwiftGlibc.S_IRUSR:1:12: note: found this candidate
public var S_IRUSR: Int32 { get }
           ^
/root/project/.build/checkouts/Shout--6099989465269811733/Sources/Bindings/SFTP.swift:39:32: error: ambiguous use of 'S_IWUSR'
            if (value & CShort(S_IWUSR) == CShort(S_IWUSR)) { permissions.owner.insert(.write) }
                               ^
Glibc.S_IWUSR:1:12: note: found this candidate
public var S_IWUSR: mode_t { get }
           ^
SwiftGlibc.S_IWUSR:1:12: note: found this candidate
public var S_IWUSR: Int32 { get }
           ^
/root/project/.build/checkouts/Shout--6099989465269811733/Sources/Bindings/SFTP.swift:40:32: error: ambiguous use of 'S_IXUSR'
            if (value & CShort(S_IXUSR) == CShort(S_IXUSR)) { permissions.owner.insert(.execute) }
                               ^
Glibc.S_IXUSR:1:12: note: found this candidate
public var S_IXUSR: mode_t { get }
           ^
SwiftGlibc.S_IXUSR:1:12: note: found this candidate
public var S_IXUSR: Int32 { get }

Can anyone point me in the right direction for this? Not sure where to start when it comes to getting this up and running on Linux.

jdmcd commented 5 years ago

So it looks like this is only occurring when targeting the master branch with the new SFTP additions. Everything compiles fine on Linux otherwise. @beefon Do you have any idea what could be causing this?

beefon commented 5 years ago

I guess there is an import overlapping or something like this. Perhaps SwiftGlibc.S_IWUSR and Glibc.S_IXUSR both have same vars. I can't check this myself unfortunately.

jdmcd commented 5 years ago

@beefon Got it, thanks for the quick response. Any idea how I would go about fixing/diagnosing the issue? I don't have much experience with C bindings in Swift.

jakeheis commented 5 years ago

Builds cleanly on Linux in 0.5.0