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

Open
ky1ejs opened this issue Feb 27, 2016 · 13 comments
Open

Building on OS X with SPM fails #23

ky1ejs opened this issue Feb 27, 2016 · 13 comments

Comments

@ky1ejs
Copy link

ky1ejs 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?

@ky1ejs
Copy link
Author

ky1ejs 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
Copy link
Member

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

@ky1ejs
Copy link
Author

ky1ejs 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
Copy link
Member

PureSwift only supports SPM for Linux.

@Danappelxx
Copy link

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

@colemancda
Copy link
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/

@Danappelxx
Copy link

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
Copy link
Member

Ok then.

@ky1ejs
Copy link
Author

ky1ejs 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
Copy link
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.

@ky1ejs
Copy link
Author

ky1ejs 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
Copy link

What about this issue???

@foldericon
Copy link

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
Projects
None yet
Development

No branches or pull requests

5 participants