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-10211] Custom Linker Flags Break swift test #4720

Closed
CodaFi opened this issue Mar 28, 2019 · 1 comment
Closed

[SR-10211] Custom Linker Flags Break swift test #4720

CodaFi opened this issue Mar 28, 2019 · 1 comment
Labels

Comments

@CodaFi
Copy link
Member

CodaFi commented Mar 28, 2019

Previous ID SR-10211
Radar rdar://problem/51081221
Original Reporter @CodaFi
Type Bug
Status Closed
Resolution Invalid
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 586557bdfbfdecc6e26849287b191c57

Issue Description:

To reproduce, run these commands

cd /Some/Folder
mkdir SwiftPMTestFail
cd SwiftPMTestFail
swift package init

Now edit the package configuration to include linker settings

// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "SwiftPMTestFail",
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
        .library(
            name: "SwiftPMTestFail",
            targets: ["SwiftPMTestFail"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "SwiftPMTestFail",
            dependencies: [],
            linkerSettings: [
              .unsafeFlags([ "-w" ])
            ]),
        .testTarget(
            name: "SwiftPMTestFailTests",
            dependencies: ["SwiftPMTestFail"]),
    ]
)

Finally, run

swift test -v
> <unknown>:0: error: unknown argument: '-w'
@ankitspd
Copy link
Member

This is expected because SwiftPM uses swiftc as a linker. I think you need to do ` -Xlinker -w` if you want to pass options to the linker directly.

@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

2 participants