Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building for Linux #14

Open
daustin2011 opened this issue Oct 3, 2016 · 2 comments
Open

Building for Linux #14

daustin2011 opened this issue Oct 3, 2016 · 2 comments

Comments

@daustin2011
Copy link

How can we build this code on the linux platform?

@sahandnayebaziz
Copy link
Contributor

@daustin2011 this repository should already work if running Swift on Linux. Are you encountering an error?

@RndmTsk
Copy link

RndmTsk commented Feb 17, 2017

When attempting to build inside a docker container using the default Kitura image I'm getting the following error:

/kitura/Packages/MySQLDriver-1.3.3/Sources/MySQLDriver/Table.swift:41:29: error: value of type 'String' has no member 'bridge'
                let range = s.bridge().rangeOfString("Optional<")
                            ^ ~~~~~~
/kitura/Packages/MySQLDriver-1.3.3/Sources/MySQLDriver/Utils.swift:139:28: error: value of type 'NSString' has no member 'bridge'
                    return str.bridge()
                           ^~~ ~~~~~~
/kitura/Packages/MySQLDriver-1.3.3/Sources/MySQLDriver/Result.swift:383:49: error: value of type 'NSString' has no member 'bridge'
                            row[cols[i].name] = NSString(format: "%4d-%02d-%02d", y, mo, d).bridge()
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
/kitura/Packages/MySQLDriver-1.3.3/Sources/MySQLDriver/Result.swift:421:48: error: value of type 'NSString' has no member 'bridge'
                           row[cols[i].name] = NSString(format: "%02d:%02d:%02d.%06d", h, m, s, u).bridge()
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
/kitura/Packages/MySQLDriver-1.3.3/Sources/MySQLDriver/Result.swift:467:49: error: value of type 'NSString' has no member 'bridge'
                            row[cols[i].name] = NSString(format: "%4d-%02d-%02d %02d:%02d:%02d.%06d", y, mo, d, h, m, s, u).bridge()
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
/kitura/Packages/MySQLDriver-1.3.3/Sources/MySQLDriver/Socket.swift:189:45: error: value of optional type 'UnsafePointer<UInt8>?' not unwrapped; did you mean to use '!' or '?'?
                    let s = send(self.s, $0.baseAddress + sent, Int(buffer.count - sent), Int32(MSG_NOSIGNAL))
                                            ^
                                                       !
/kitura/Packages/MySQLDriver-1.3.3/Sources/MySQLDriver/sha1.swift:95:16: error: 'AnyGenerator' has been renamed to 'AnyIterator'
        return AnyGenerator(body)
               ^~~~~~~~~~~~
               AnyIterator
<unknown>:0: error: build had 1 command failures
swift-build: error: exit(1): /root/swift-3.0.2-RELEASE-ubuntu14.04/usr/bin/swift-build-tool -f /kitura/.build/debug.yaml
The command '/bin/sh -c cd /kitura && swift build' returned a non-zero code: 1

Also your project does not work with the Swift Package Manager. If I include your package inside my project I receive an error referencing duplicate main.swift files. I've cleaned some of this up in my fork: https://github.com/RndmTsk/MySqlSwiftNative (that's why you see v1.3.3).

The contents of my Dockerfile:

# Start from a Debian image with the latest version of Kitura installed
FROM ibmcom/kitura-ubuntu

# Copy the local package files to the container's workspace
ADD . /kitura

RUN cd /kitura && swift build

# Run the outyet command by default when the container starts.
ENTRYPOINT /kitura/.build/debug/Server

# Document that the service listens on port 8080.
EXPOSE 8090

If you build a sample project following the Kitura tutorial (approx 10 mins) you'll run into the same issues:
http://www.kitura.io/en/starter/gettingstarted.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants