Sqlite.swift: Can't use the library with Xcode

Created on 24 Jul 2017  路  8Comments  路  Source: stephencelis/SQLite.swift

Hello,

I have compilation problem with Xcode.
Compilation was successful with swift build -Xlinker -lsqlite3 but i can't reproduce the same in Xcode. The module SqlLiteOBJ gives 22 errors.

Do you have a tutorial about use the library with Xcode ? I used the package manager to include SQLite. I also tried to add the module manually as a sub-module.

What i do not understand is that my project compiles right with swift build -Xlinker -lsqlite3 but not with Xcode, even if i add -Xlinker -lsqlite3 in argument.

I can provide more information or screenshot if you need.
Thank you for your time.

Tchoupinax

Most helpful comment

@mikecsh I just tried it and the build fails because modules are not enabled for the SQLiteObjc target. I'm not sure if and how they can be enabled automatically.

schermata 2017-10-26 alle 11 44 57

All 8 comments

@Tchoupinax did you ever solve this problem? I'm running into it with one of my projects using SQLite.swift, (fine when built using Carthage or command line).

Does this still happen with the 0.11.4?

@jberkel, yes, I am seeing this when I use Swift package manager, add SQLite.swift as a dependency and then use:

swift package generate-xcodeproj

So perhaps generate-xcodeproj is not setting some required settings?

Example Package.swift:

````
// swift-tools-version:4.0

import PackageDescription

let package = Package(
name: "TestSQL",
products: [
.library(
name: "TestSQL",
targets: ["TestSQL"]),
],
dependencies: [
.package(url: "https://github.com/stephencelis/SQLite.swift", .upToNextMajor(from:"0.11.4")),
],
targets: [
.target(
name: "TestSQL",
dependencies: ["SQLite"]),
.testTarget(
name: "TestSQLTests",
dependencies: ["TestSQL"]),
]
)
````

@mikecsh I just tried it and the build fails because modules are not enabled for the SQLiteObjc target. I'm not sure if and how they can be enabled automatically.

schermata 2017-10-26 alle 11 44 57

Hello guys,

let's me thank you to consider my issue, but honestly, it was 3 months ago and i did not remember what it really happened .. I experimented many things at this moment. ^^
Anyway I will come back here if my way cross again this library.
Thank you !

@jberkel thank you very much for that - at least I can us it as a workaround now. I will do a bit of research and if I find that it is possible to set that flag with SPM I鈥檒l report back.

@jberkel Thanks. I can build with this setting.

I automated this setting patch each xcodeproj generation.
https://gist.github.com/omochi/2a2ebe3cf99a1e5a63fbf6a38c587dc6

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DiamondYuan picture DiamondYuan  路  3Comments

justdan0227 picture justdan0227  路  7Comments

WDDong picture WDDong  路  7Comments

bitflying picture bitflying  路  5Comments

tommycloud picture tommycloud  路  6Comments