# How to prevent system libs auto linking in SwiftPM

**URL:** <https://forums.swift.org/t/how-to-prevent-system-libs-auto-linking-in-swiftpm/78250>\
**Category:** Swift Build\
**Tags:** packagemanager\
**Created:** [March 3, 2025, 6:36pm UTC](https://forums.swift.org/t/how-to-prevent-system-libs-auto-linking-in-swiftpm/78250 "2025-03-03T18:36:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmostafa](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@mmostafa](https://forums.swift.org/u/mmostafa)\
**Post date:** [March 3, 2025, 6:36pm UTC](https://forums.swift.org/t/how-to-prevent-system-libs-auto-linking-in-swiftpm/78250/1 "2025-03-03T18:36:28Z")

</div>

Hello, I am trying to use SqlCipher in a large codebase that uses SwiftPM and already uses Sqlite3. I removed all explicit linking to Sqlite3 and added the dependency to the static library built from SqlCipher source code. However, the linker keeps linking to the system Sqlite3 automatically. (which I can confirm by running otool -L on the executable)  
I tried in a vanilla app that does not use SwiftPM to turn off automatic linking by setting the `Link Frameworks and Libraries Automatically` ( `SWIFT_MODULES_AUTOLINK`) to No and if the code has any Sqlite3 imports the build fails as expected.

I am wondering if there is a way to achieve the same thing using SwiftPM?

---

<div class="post-metadata">

**Author:** ![NeoNacho](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/neonacho/32/1368_2.png) [@NeoNacho](https://forums.swift.org/u/NeoNacho)\
**Post date:** [March 4, 2025, 9:32pm UTC](https://forums.swift.org/t/how-to-prevent-system-libs-auto-linking-in-swiftpm/78250/2 "2025-03-04T21:32:18Z")

</div>

You should be able to pass `-Xfrontend -disable-all-autolinking` using `unsafeFlags` ([unsafeFlags(\_:\_:) | Apple Developer Documentation](https://developer.apple.com/documentation/packagedescription/swiftsetting/unsafeflags(_:_:)))
