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 on OS X with SPM fails #23

Open
kylejm opened this Issue Feb 27, 2016 · 13 comments

Comments

Projects
None yet
5 participants
@kylejm

kylejm commented Feb 27, 2016

This is because the JSONParse.swift uses the JSON module on OS X:

https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/JSONParse.swift#L9

but in the Package.swift the CJSONC module is defined as a dependancy instead:

https://github.com/PureSwift/SwiftFoundation/blob/develop/Package.swift#L8

Is there a reason for no using CJSONC on OS X or vice versa for JSON on Linux?

@kylejm

This comment has been minimized.

Show comment
Hide comment
@kylejm

kylejm Feb 27, 2016

/Users/kylejm/Developer/Loot/OSS/bitrise-slack/Packages/SwiftFoundation-1.1.1/Sources/SwiftFoundation/JSONParse.swift:10:12: error: no such module 'JSON'
    import JSON
           ^

kylejm commented Feb 27, 2016

/Users/kylejm/Developer/Loot/OSS/bitrise-slack/Packages/SwiftFoundation-1.1.1/Sources/SwiftFoundation/JSONParse.swift:10:12: error: no such module 'JSON'
    import JSON
           ^
@colemancda

This comment has been minimized.

Show comment
Hide comment
@colemancda

colemancda Feb 27, 2016

Member

SPM is for Linux only. Use Carthage for Darwin platforms.

Member

colemancda commented Feb 27, 2016

SPM is for Linux only. Use Carthage for Darwin platforms.

@kylejm

This comment has been minimized.

Show comment
Hide comment
@kylejm

kylejm Feb 27, 2016

Sorry, I must be missing something. Where is SPM documented as only being for Linux platforms? Or do PureSwift projects specifically only support SPM for Linux?

kylejm commented Feb 27, 2016

Sorry, I must be missing something. Where is SPM documented as only being for Linux platforms? Or do PureSwift projects specifically only support SPM for Linux?

@colemancda

This comment has been minimized.

Show comment
Hide comment
@colemancda

colemancda Feb 27, 2016

Member

PureSwift only supports SPM for Linux.

Member

colemancda commented Feb 27, 2016

PureSwift only supports SPM for Linux.

@Danappelxx

This comment has been minimized.

Show comment
Hide comment
@Danappelxx

Danappelxx Feb 28, 2016

Why is this, again? There's nothing stopping you from supporting both...

Danappelxx commented Feb 28, 2016

Why is this, again? There's nothing stopping you from supporting both...

@colemancda

This comment has been minimized.

Show comment
Hide comment
@colemancda

colemancda Feb 28, 2016

Member

There isn't, im just not committed to always maintaining it since I see little benefit from it. Also you should always use dynamic frameworks on OS X, even for server applications. See http://colemancda.github.io/programming/2015/02/12/embedded-swift-frameworks-osx-command-line-tools/

Member

colemancda commented Feb 28, 2016

There isn't, im just not committed to always maintaining it since I see little benefit from it. Also you should always use dynamic frameworks on OS X, even for server applications. See http://colemancda.github.io/programming/2015/02/12/embedded-swift-frameworks-osx-command-line-tools/

@Danappelxx

This comment has been minimized.

Show comment
Hide comment
@Danappelxx

Danappelxx Feb 28, 2016

There's no maintenance involved and it's actually very important for a lot of people. People don't develop SPM applications on Linux, they do it on OSX. Building on OSX is not always done through Xcode, especially if you're not making a framework.

I think this is worthy of more discussion so I'm going to go ahead and reopen this.

Danappelxx commented Feb 28, 2016

There's no maintenance involved and it's actually very important for a lot of people. People don't develop SPM applications on Linux, they do it on OSX. Building on OSX is not always done through Xcode, especially if you're not making a framework.

I think this is worthy of more discussion so I'm going to go ahead and reopen this.

@Danappelxx Danappelxx reopened this Feb 28, 2016

@colemancda

This comment has been minimized.

Show comment
Hide comment
@colemancda

colemancda Feb 28, 2016

Member

Ok then.

Member

colemancda commented Feb 28, 2016

Ok then.

@kylejm

This comment has been minimized.

Show comment
Hide comment
@kylejm

kylejm Feb 28, 2016

I totally agree with @Danappelxx. A great deal, if not the majority, of Swift developers creating apps for Linux will be developing them on Mac OS. Having to use two different dependancy managers on each platform just seems absurd, especially when the idea is that SPM is made agnostically of the platform.

It's kind of ironic that Carthage, the dependancy manager you suggest, statically links Swift. Dynamically linking against CLI applications, which a lot of server apps will be, isn't straight forward. There is discussion all over the place about it:

I like what neonichu said about this in the last link in that list back in June 2015 when SPM was not public:

I don't think it is entirely solvable by us, considering that there is no "standard" way to distribute frameworks alongside a command line tool.

I'm sure Apple intend for SPM to be the "standard".

kylejm commented Feb 28, 2016

I totally agree with @Danappelxx. A great deal, if not the majority, of Swift developers creating apps for Linux will be developing them on Mac OS. Having to use two different dependancy managers on each platform just seems absurd, especially when the idea is that SPM is made agnostically of the platform.

It's kind of ironic that Carthage, the dependancy manager you suggest, statically links Swift. Dynamically linking against CLI applications, which a lot of server apps will be, isn't straight forward. There is discussion all over the place about it:

I like what neonichu said about this in the last link in that list back in June 2015 when SPM was not public:

I don't think it is entirely solvable by us, considering that there is no "standard" way to distribute frameworks alongside a command line tool.

I'm sure Apple intend for SPM to be the "standard".

@colemancda

This comment has been minimized.

Show comment
Hide comment
@colemancda

colemancda Feb 28, 2016

Member

There is no support for SPM for iOS, WatchOS or tvOS. Also the link you mentioned regarding Carthage statically linking Swift, does not apply if you follow the my method. If you use a App Bundle Structure, it will dynamically link it. Getting down to business, I am open to supporting this since users may want it, but I personally will not make the changes to support this. If you want to open a PR, I am open to that.

On OS X the only dependency would be JSON-C which you can get from Homebrew. I cannot name the JSON-C dynamic framework CJSONC, because the generated module map expects "JSON" to be the name of the module. That has been my issue so far.

Member

colemancda commented Feb 28, 2016

There is no support for SPM for iOS, WatchOS or tvOS. Also the link you mentioned regarding Carthage statically linking Swift, does not apply if you follow the my method. If you use a App Bundle Structure, it will dynamically link it. Getting down to business, I am open to supporting this since users may want it, but I personally will not make the changes to support this. If you want to open a PR, I am open to that.

On OS X the only dependency would be JSON-C which you can get from Homebrew. I cannot name the JSON-C dynamic framework CJSONC, because the generated module map expects "JSON" to be the name of the module. That has been my issue so far.

@kylejm

This comment has been minimized.

Show comment
Hide comment
@kylejm

kylejm Feb 29, 2016

Cool, I'll open a PR as soon as I can get around to it, but hopefully Foundation gets to implementing NSURLSession etc. first. The side project I was working on with SeeURL has taken a lower priority for a while.

kylejm commented Feb 29, 2016

Cool, I'll open a PR as soon as I can get around to it, but hopefully Foundation gets to implementing NSURLSession etc. first. The side project I was working on with SeeURL has taken a lower priority for a while.

@colemancda colemancda modified the milestone: v2.0.0 Jun 29, 2016

@Blackjacx

This comment has been minimized.

Show comment
Hide comment
@Blackjacx

Blackjacx Aug 15, 2016

What about this issue???

Blackjacx commented Aug 15, 2016

What about this issue???

@foldericon

This comment has been minimized.

Show comment
Hide comment
@foldericon

foldericon Nov 20, 2016

The solution for this issue would be to install JSON-C using homebrew and remove the "import JSON" statement, right?

foldericon commented Nov 20, 2016

The solution for this issue would be to install JSON-C using homebrew and remove the "import JSON" statement, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment