次のセットアップ(gist)では:スウィフト "エラー:自動インポートでは:ASTコンテキストからモジュール 'foo' を取得に失敗しました:"
Package.swift:
import PackageDescription
let package = Package(
name: "foo",
dependencies: [
.Package(url: "https://github.com/rxwei/LLVM_C", majorVersion: 1, minor: 0)
]
)
Makefileの:
all:
@swift build \
-Xcc -I`llvm-config --includedir` \
-Xlinker -L`llvm-config --libdir` \
-Xlinker -rpath -Xlinker `llvm-config --libdir`
main.swift:
import LLVM_C.Core
func foo(_ a: Int) {
let b = a * a
print(b)
}
foo(4)
make
で実行可能ファイルをコンパイルし、デバッガで実行可能ファイルを起動した後、私はすべての変数の値を印刷することはできませんが。
(lldb) b foo
Breakpoint 1: where = foo`foo.foo (Swift.Int) ->() + 12 at main.swift:4, address = 0x00000001000014dc
(lldb) r
Process 14376 launched: '/Users/emlai/Code/foo/.build/debug/foo' (x86_64)
Process 14376 stopped
* thread #1: tid = 0x226d5, 0x00000001000014dc foo`foo(a=4) ->() + 12 at main.swift:4, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00000001000014dc foo`foo(a=4) ->() + 12 at main.swift:4
1 import LLVM_C.Core
2
3 func foo(_ a: Int) {
-> 4 let b = a * a
5 print(b)
6 }
7
(lldb) p a
error: in auto-import:
failed to get module 'foo' from AST context:
(lldb) p a
Shared Swift state for foo has developed fatal errors and is being discarded.
REPL definitions and persistent names/types will be lost.
warning: Swift error in module foo.
Debug info from this module will be unavailable in the debugger.
error: in auto-import:
failed to get module 'foo' from AST context
私はimport LLVM_C.Core
行をコメントアウトした場合、すべてが正常に動作します。
これは、私のプロジェクトをデバッグして進行を妨げています。これをどうすれば解決できますか?