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-1191] Failed to use REPL with SPM built modules #5462
Comments
I think you need a -L flag there too, but maybe there should be a nice way to do this (e.g. if you start the REPL in a package directory, you automatically get -I and -L for the package and any dependencies). |
Comment by Oleg Dreyman (JIRA) @belkadan thanks for the reply! I tried to add -L, but that still doesn’t work. $ swift -I .build/debug -L .build/debug
Welcome to Apple Swift version 3.0-dev (LLVM b010debd0e, Clang 3e4d01d89b, Swift 7182c58cb2). Type :help for assistance.
1> import Analysis
2> let list: List = [1, 2, 3, 4]
list: Analysis.List = {
elements = <extracting data from value failed>
}
error: Couldn't lookup symbols:
__TMO8Analysis9DataPoint
__TFO8Analysis9DataPointCfT14integerLiteralSi_S0_
__TFV8Analysis4ListCft12arrayLiteralGSaOS_9DataPoint__S0_ |
Auto-link issue? I have no idea how the auto-linking works. I tried reading up on it, but didn't find much material. |
Sean Callanan will probably want to take a look at this. |
We don't currently compile a DSO for each Swift module, so this certainly can't work until that happens. |
I tried with PackageDescription with swiftpm and it doesn't work there either.
|
Works if you have dylibs and `$ swift -I .build/debug -L .build/debug -l<modulename>` |
Confirmed:
It's a mystery to me when auto-linking works or not. Though I guess this is outside of that system. |
This is not a bug, as noted in comments REPL works fine if passed correct flags |
Comment by Robert Atkins (JIRA) I'm doing |
You can produce dylib products once the product proposal is implemented. as of now there is a product API (see swiftpm's Package.swift) but we don't recommend using it as it will be removed without deprecation. |
Comment by Robert Atkins (JIRA) adding:
to my (This is just a temporary thing to try and debug a test that passes on macOS but fails on Linux, so I don't mind hacking around.) UPDATE: Turns out this was working all along, but the specific function I was trying to call in my Foo has some other kind of problem which was leading me to think the import process itself was broken. |
Comment by Jonathan McAllister (JIRA) In case someone finds this ticket searching for help on how to import spm packages in the repl with swift 4, here is a helpful write up https://github.com/profburke/swiftreplmadness |
Environment
OS X 10.11, DEVELOPMENT-SNAPSHOT-2016-03-24-a
Additional Detail from JIRA
md5: ac28f4342824c5000f6ec58e6cf6e10f
relates to:
Issue Description:
SPM built modules are unable to use with REPL.
import statement works, but then error occurs:
UPDATE
Error descriptions on Linux seems to be more informative:
The text was updated successfully, but these errors were encountered: