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

[SR-2215] Error linking C wrapper module in Kitura when using generated Xcode project #5414

Closed
swift-ci opened this issue Jul 29, 2016 · 11 comments
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-2215
Radar None
Original Reporter kweinmeister (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 7.3.1 with 6/20 snapshot.

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee kweinmeister (JIRA)
Priority Medium

md5: e34bd2d7172d8df3b0648a6d11c0214e

duplicates:

  • SR-2465 [SwiftPM] Xcode project cannot use C language target with custom module map

Issue Description:

Running swift build using the CLI successfully compiles Kitura, including the step to link CHTTPParser. However, using the generated Xcode project to build Kitura results in the compilation failing with the following error:

ld: library not found for -lCHttpParser for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This issue is described further in the following Github issues:
Kitura/Kitura#634
Kitura/Kitura#574

Also, here the results of some initial investigation from our team: If one looks carefully at the failing ld command, the build tried to link in the CHTTPParser framework, which should been enough. It’s just that it also tried to link in CHTTPParser.dynlib, which was found in the modulemap file for CHTTPParser.

@gottesmm
Copy link
Member

Sounds like a Jordan thing.

@belkadan
Copy link

That really sounds like the module map is wrong.

@belkadan
Copy link

…or rather, we should build a dylib rather than a framework for C targets in the Xcode generator, or maybe the package manager should provide the "link" command in the module map rather than the user.

@belkadan
Copy link

Both the compiler and Xcode are behaving as expected.

@ankitspd
Copy link
Member

ankitspd commented Aug 1, 2016

SwiftPM generates correct modulemap for swift-build (dylibs) and Xcode (framework) project if the C library layout is supported.
If user provides a modulemap swiftpm doesn't try to generate a modulemap.

I'll suggest let swiftpm generate modulemap for you so it works with both Xcode and swift-build. All you have to do is move the public headers to include directory (and ofc remove the current modulemap).

@ankitspd
Copy link
Member

ankitspd commented Aug 1, 2016

@swift-ci
Copy link
Contributor Author

swift-ci commented Aug 1, 2016

Comment by Ian Partridge (JIRA)

Thank you @aciidb0mb3r! With this hint we were able to fix the issue on Kitura's side. 👍

@belkadan
Copy link

belkadan commented Aug 1, 2016

Sounds like we'll still want some way to allow custom module maps with Xcode support, but it's no longer urgent.

@ankitspd
Copy link
Member

ankitspd commented Aug 1, 2016

@ddunbar @abertelrud
I am not sure about the correct solution.
We can:

  1. switch back to dylibs
  2. have a --dylib mode when generating Xcode project
  3. allow specifying a custom module map for Xcode

@ddunbar
Copy link
Member

ddunbar commented Aug 1, 2016

I am not sure either. We don't officially support Swift dylibs in Xcode, which makes me question whether we should use them. On the other hand, it isn't clear our model is strong enough to actually support this... in particular with regard to RPATH-type things, which currently there is no way to specify.

@ankitspd
Copy link
Member

ankitspd commented Sep 7, 2016

Fixed in #630

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants