Server Side Swift with Kitura - Part 3: | Ray Wenderlich Videos

We'll set up your development environment and make sure you have everything you need to know to write all the code you'll need for this course.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3770-server-side-swift-with-kitura/lessons/3

Hi there,

Falling at the first hurdle here


I’ve downloaded Cocoa pods, copied the commands you detail and run ‘swift build’. The package manager goes away and get’s all the dependencies but then I get a Fatal error:

Fatal error: Duplicate values for key: ‘CouchDB’: file /BuildRoot/Library/Caches/com.apple.xbs/Binaries/swiftlang/install/TempContent/Objects/BNI_assert_lightweight/swift-macosx-x86_64/stdlib/public/core/8/HashedCollections.swift, line 8108
Illegal instruction: 4

Any idea’s what could be going on? Thanks!

@dokun1 Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @yodatg! Let’s see what we can do. Can you answer a couple of questions for me?

  • what version of swift are you running via your command line? (You can check with swift --version)
  • what did you use to install CouchDB (Homebrew or something else)?
  • what version of CouchDB is installed? (You can check this by visiting localhost:5984 in your browser.)

Also, if you don’t want to continue this question here, you can join our slack at http://slack.kitura.io and get help from myself or someone else on the Kitura team.

Hi Folks,

The 2 lines you are asked to add to the Package.swift file:

.package(url: "https://github.com/IBM-Swift/Kitura-CouchDB.git", .upToNextMinor(from: "2.0.1")),
.package(url: "https://github.com/IBM-Swift/Kitura-StencilTemplateEngine.git", .upToNextMinor(from: "1.9.1")),

Are already in the file. There is no need to re-add them.

Chris

1 Like

@cbcdiver Thank you for the heads up - much appreciated!

You saved my time, thank you so much!

vi Instructions

  1. To be able to start typing press i
  2. To save your file and exit press esc then type :wq and press enter
~/Downloads/getting-started/starter/EmojiJournalServer $ swift package generate-xcodeproj

warning: PackageDescription API v3 is deprecated and will be removed in the future; used by package(s): Stencil

'CommonCrypto' /Users/unipheas/Downloads/getting-started/starter/EmojiJournalServer/.build/checkouts/CommonCrypto.git--9083855582992868405: warning: Ignoring declared target(s) 'CommonCrypto' in the system package

'CCurl' /Users/unipheas/Downloads/getting-started/starter/EmojiJournalServer/.build/checkouts/CCurl.git--4701432290616523576: warning: Ignoring declared target(s) 'CCurl' in the system package

generated: ./EmojiJournalServer.xcodeproj

After running the SPM command and opening the package I then select the right Scheme and hit run. I then get the following errors.

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/CommonCrypto/module.modulemap:1:8: Redefinition of module 'CommonCrypto'

/Users/unipheas/Downloads/getting-started/starter/EmojiJournalServer/.build/checkouts/Kitura-WebSocket.git-5119411368287924598/Sources/KituraWebSocket/WSConnectionUpgradeFactory.swift:19:8: No such module 'Cryptor'

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/CommonCrypto/module.modulemap:1:8: Redefinition of module 'CommonCrypto'

/Users/unipheas/Downloads/getting-started/starter/EmojiJournalServer/.build/checkouts/SwiftMetrics.git--7583004232535015354/Sources/SwiftMetricsBluemix/SwiftMetricsBluemix.swift:26:8: No such module 'SwiftBAMDC'

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/CommonCrypto/module.modulemap:1:8: Redefinition of module 'CommonCrypto'

I got the same problem here!

@dokun1 Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hello! I will also address @boersma here. Can you let me know what happens if you run the following commands?

rm -rf .build
rm -rf Package.resolved
swift build
.build/debug/EmojiJournalServer

Expected result: the server should just run.

Hello David, @dokun1

I followed your instructions and I indeed can run the EmojiJournalServer by typing:
./.build/x86_64-apple-macosx10.10/debug/EmojiJournalServer

However I see the following warnings on the commandline:

Cloning GitHub - stencilproject/Stencil: Stencil is a simple and powerful template language for Swift.

Resolving GitHub - stencilproject/Stencil: Stencil is a simple and powerful template language for Swift. at 0.11.0

warning: PackageDescription API v3 is deprecated and will be removed in the future; used by package(s): Stencil

‘CommonCrypto’ /Users/jan/Developer/Projects/Kitura/getting-started/starter/EmojiJournalServer/.build/checkouts/CommonCrypto.git-6198766693013294880: warning: Ignoring declared target(s) ‘CommonCrypto’ in the system package

‘CCurl’ /Users/jan/Developer/Projects/Kitura/getting-started/starter/EmojiJournalServer/.build/checkouts/CCurl.git–8312469658033386208: warning: Ignoring declared target(s) ‘CCurl’ in the system package

In Xcode, it still won’t compile, see below

49

Hey @boersma - progress is progress :]

Can you show me which scheme you are trying to run in Xcode, as well as on which device? We want to make sure you are running the executable for EmojiJournalServer, and you want to be sure that it is running on “My Mac”.

In terminal when I run swift package generate-xcodeproj I get the following warnings

warning: PackageDescription API v3 is deprecated and will be removed in the future; used by package(s): Stencil

'CommonCrypto' /Users/unipheas/Downloads/getting-started/starter/EmojiJournalServer/.build/checkouts/CommonCrypto.git--7190019815585461610: warning: Ignoring declared target(s) 'CommonCrypto' in the system package

'CCurl' /Users/unipheas/Downloads/getting-started/starter/EmojiJournalServer/.build/checkouts/CCurl.git--1931583891200464794: warning: Ignoring declared target(s) 'CCurl' in the system package

generated: ./EmojiJournalServer.xcodeproj

It’s the same as @boersma.

This is my build log after running those commands you requested.

image

@dokun1 Do you have any feedback about this? Thank you - much appreciated! :]

1 Like

Is there a fix to this issue yet? We cannot proceed without it.

@unipheas Do you still have this issue?