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

clang symbols not found #13

Closed
EddyHahn opened this issue Apr 5, 2016 · 7 comments
Closed

clang symbols not found #13

EddyHahn opened this issue Apr 5, 2016 · 7 comments
Assignees

Comments

@EddyHahn
Copy link

EddyHahn commented Apr 5, 2016

Hi,
I have all the toolchains setup correctly. When I build from the command line I get a successful build. However when I try to build from Xcode the linker cannot link to the MongoKitten.swiftmodule.

Do I have to use a different version of clang?

Undefined symbols for architecture x86_64:
"MongoKitten.Server.__allocating_init (at : Swift.String, port : Swift.Int, using : (username : Swift.String, password : Swift.String)?, automatically : Swift.Bool) throws -> MongoKitten.Server", referenced from:
test.AppDelegate.applicationDidFinishLaunching (__ObjC.NSNotification) -> () in AppDelegate.o

ld: symbol(s) not found for architecture x86_64

Any idea?

Thanks,

Eddy

@Obbut
Copy link
Collaborator

Obbut commented Apr 6, 2016

Are you using the Swift Development Snapshot 2016-03-24-a?

We (me and @Joannis) haven't used MongoKitten with a 'normal' OS X app project, we just swift build --init and then swift build -X. How did you set up your Xcode project to use MongoKitten?

@EddyHahn
Copy link
Author

EddyHahn commented Apr 6, 2016

  1. Yes, I am using Swift Development Snapshot 2016-03-24-a?
  2. I did the same initialization swift build —init and swift build -X
  3. Opened the project file and added to Build Settings -> Swift compiler - Search -> Import Path the path to .build/debug
  4. Then I added just ten #iport MongoKitten to main.swift and built. It was OK.
  5. After that I added the example code to the main.swift (connect to local mongo etc). Then the build failed. but the code complete did show the functions etc in the editor.

Eddy

On Apr 6, 2016, at 1:56 AM, Robbert Brandsma notifications@github.com wrote:

Are you using the Swift Development Snapshot 2016-03-24-a?

We (me and @Joannis https://github.com/Joannis) haven't used MongoKitten with a 'normal' OS X app project, we just swift build --init and then swift build -X. How did you set up your Xcode project to use MongoKitten?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #13 (comment)

@Joannis
Copy link
Member

Joannis commented Apr 6, 2016

Could you post your Package.swift?

@Joannis
Copy link
Member

Joannis commented Apr 6, 2016

On another note: Why are you adding an import path?
swift build -X should take care of that.

@Joannis
Copy link
Member

Joannis commented Apr 6, 2016

@EddyHahn I've managed to reproduce the error. Tell me if I'm incorrect:

You've created a project in XCode. Added a package.swift with the required information. Then you've linked the .build/debug directory in the import path. Ran swift build and then you got the error, correct?

Currently XCode does not support SPM (Swift Package Manager) projects by default. So to solve this you'll have to generate the project differently.

Create a directory with the name of your project:
mkdir MyAwesomeProject
Go in the direcotry:
cd MyAwesomeProject
Initialize the project:
swift build --init
Edit the Package.swift file to contain your dependencies:
open Package.swift
Save it (of course) and go back to the terminal
Create the XCode project using the Command Line tools
swift build -X
Enter the directory using finder
open .
and open the XCode project by double-clicking it

This is not a bug in MongoKitten or any similar project. It's a missing feature in XCode that everyone is still waiting for. So I'll also write some instructions for when you're adding more dependencies:

Open the Package.swift using your editor and add the dependencies like above.
Open the terminal and enter your root-directory of the project again (same level as Package.swift)
Clean all build-directories:
swift build --clean dist
And remake the project:
swift build -X

Now you can open the project again with XCode and you'll be set with your new dependencies.
If you're having issues for any reason within the XCode project at this point it's best to clean your XCode project. (CMD + K)

I hope this helps!

@Joannis Joannis self-assigned this Apr 6, 2016
@EddyHahn
Copy link
Author

EddyHahn commented Apr 6, 2016

Thanks!

I do not know what happened but this time around the swift build -X worked and all the packages now show up in Xcode. Build did work swell and I can debug too!

Thank you Again!

Eddy

On Apr 6, 2016, at 8:47 AM, Joannis Orlandos notifications@github.com wrote:

@EddyHahn https://github.com/EddyHahn I've managed to reproduce the error. Tell me if I'm incorrect:

You've created a project in XCode. Added a package.swift with the required information. Then you've linked the .build/debug directory in the import path. Ran swift build and then you got the error, correct?

Currently XCode does not support SPM (Swift Package Manager) projects by default. So to solve this you'll have to generate the project differently.

Create a directory with the name of your project:
mkdir MyAwesomeProject
Go in the direcotry:
cd MyAwesomeProject
Initialize the project:
swift build --init
Edit the Package.swift file to contain your dependencies:
open Package.swift
Save it (of course) and go back to the terminal
Create the XCode project using the Command Line tools
swift build -X
Enter the directory using finder
open .
and open the XCode project by double-clicking it

This is not a bug in MongoKitten or any similar project. It's a missing feature in XCode that everyone is still waiting for. So I'll also write some instructions for when you're adding more dependencies:

Open the Package.swift using your editor and add the dependencies like above.
Open the terminal and enter your root-directory of the project again (same level as Package.swift)
Clean all build-directories:
swift build --clean dist
And remake the project:
swift build -X

Now you can open the project again with XCode and you'll be set with your new dependencies.
If you're having issues for any reason within the XCode project at this point it's best to clean your XCode project. (CMD + K)

I hope this helps!


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #13 (comment)

@Joannis
Copy link
Member

Joannis commented Apr 6, 2016

No problem! Good luck with MongoKitten! Just enter another ticket if you need additional assistance.

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