Coder Social home page Coder Social logo

apple / swift-package-manager Goto Github PK

View Code? Open in Web Editor NEW
9.6K 9.6K 1.3K 29.92 MB

The Package Manager for the Swift Programming Language

License: Apache License 2.0

Swift 96.58% Python 0.45% C 0.06% Emacs Lisp 0.01% Objective-C 0.07% Shell 0.13% Dockerfile 0.01% CMake 0.46% Objective-C++ 0.01% C++ 2.22%

swift-package-manager's Introduction

Swift Package Manager Project

The Swift Package Manager is a tool for managing distribution of source code, aimed at making it easy to share your code and reuse others’ code. The tool directly addresses the challenges of compiling and linking Swift packages, managing dependencies, versioning, and supporting flexible distribution and collaboration models.

We’ve designed the system to make it easy to share packages on services like GitHub, but packages are also great for private personal development, sharing code within a team, or at any other granularity.

Swift Package Manager includes a build system that can build for macOS and Linux. Starting with Xcode 11, Xcode integrates with SwiftPM to provide support for including packages in iOS, macOS, watchOS, and tvOS applications.

The SourceKit-LSP project leverages libSwiftPM and provides Language Server Protocol implementation for editors that support LSP.


Table of Contents


Getting Started

Please use this guide for learning package manager basics.


Documentation

For Quick Help use the swift package --help command.

For documentation on using Swift Package Manager, creating packages, and more, see the documentation directory.

For documentation on developing the Swift Package Manager itself, see the contribution guide.

For detailed documentation on the package manifest API, see PackageDescription API.

For release notes with information about changes between versions, see the release notes.


System Requirements

The package manager’s system requirements are the same as those for Swift with the caveat that the package manager requires Git at runtime as well as build-time.


Installation

The package manager is available as part the Swift toolchains available on Swift.org) including snapshots for the latest versions built from main branch. For installation instructions for downloaded snapshots, please see the Getting Started section of Swift.org.

The Swift Package Manager is also included in Xcode 8.0 and all subsequent releases.

You can verify your installation by typing swift package --version in a terminal:

$ swift package --version
Apple Swift Package Manager - ...

Contributing

There are several ways to contribute to Swift Package Manager. To learn about the policies, best practices that govern contributions to the Swift project and instructions for setting up the development environment please read the Contributor Guide.

The Swift package manager uses llbuild as the underlying build system for compiling source files. It is also open source and part of the Swift project.


Reporting issues

If you have any trouble with the package manager, help is available. We recommend:

When reporting an issue please follow the bug reporting guidelines, they can be found in contribution guide.

If you’re not comfortable sharing your question with the list, contact details for the code owners can be found in CODEOWNERS; however, Swift Forums is usually the best place to go for help.


License

Copyright 2015 - 2023 Apple Inc. and the Swift project authors. Licensed under Apache License v2.0 with Runtime Library Exception.

See https://swift.org/LICENSE.txt for license information.

See https://swift.org/CONTRIBUTORS.txt for Swift project authors.

swift-package-manager's People

Contributors

abertelrud avatar ankitspd avatar artemcm avatar bhargavg avatar bouke avatar compnerd avatar czechboy0 avatar ddunbar avatar douggregor avatar elsh avatar finagolfin avatar gmittert avatar grynspan avatar hartbit avatar jakepetroules avatar kateinoigakukun avatar keith avatar kiliankoe avatar kostiakoval avatar mattt avatar maxdesiatov avatar mxcl avatar neonichu avatar shahmishal avatar swift-ci avatar therealbnut avatar tomerd avatar wowbaggersliquidlunch avatar xedin avatar yim-lee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swift-package-manager's Issues

[SR-113] Swift Package Manager does not accept semver versions such as 1.0.0rc1

Previous ID SR-113
Radar None
Original Reporter @groue
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee jakeheis (JIRA)
Priority Medium

md5: 5db4a5b3e1589298872bbccda71e0ab9

Issue Description:

Hello,

https://swift.org/package-manager/ makes explicit mention of http://semver.org, yet fails to link to a package with tags such as 1.0.0rc1.

When one declares a dependency such as Package(url: "<repo URL>", majorVersion: 1, minor: 0), one expects the tag 1.0.0rc1 to be checked out.

It is not. Instead, `swift build` outputs the following error:

swift-build: The dependency graph could not be satisfied.

[SR-648] swift package manager should have the option to produce statically linked binaries

Previous ID SR-648
Radar rdar://problem/32618121
Original Reporter jaybuff (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 34
Component/s Package Manager
Labels Improvement
Assignee None
Priority Medium

md5: a97136565bbf5fd9b15515ab552f61b8

is blocked by:

  • SR-2280 swiftc -static-stdlib option fails on Ubuntu 14.04 & 15.10

is duplicated by:

  • SR-727 (emscripten support) Compile Swift code with statically linked stdlib
  • SR-10624 SwiftPM doesn't hand --swift-static-stdlib through

relates to:

  • SR-2280 swiftc -static-stdlib option fails on Ubuntu 14.04 & 15.10
  • SR-10625 tests for -static-*
  • SR-730 Flag to statically link Swift standard library

Issue Description:

When I do swift build for a simple hello world swift program it ldd tells me that it is linked against libstdc++.so.6, libswiftCore.so and other .so files. I would like to ask swift build to produce a single file that is not dynamically linked against any shared objects.

[SR-397] Linux - module using <dispatch/dispatch.h> does not compile cleanly with "swift build"

Previous ID SR-397
Radar None
Original Reporter tomsheffler (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Ubuntu 14.04

Additional Detail from JIRA
Votes 3
Component/s Compiler, Package Manager
Labels Bug, Dispatch, Linux
Assignee @aciidb0mb3r
Priority Medium

md5: 3ce10e8ea99c16ef2da7e8631d663144

is duplicated by:

  • SR-415 blocks support in external c libraries disabled
  • SR-577 Compiler should pass -Xcc -fblocks when processing .h files

Issue Description:

While libdispatch is well-supported on Linux, using "Swift Build" for a module wrapping <dispatch/dispatch.h> does not compile cleanly. The problem is that to get all of the features of dispatch, "-fblocks" needs to be specified to Clang, and currently, "swift build" does not enable "-fblocks" for modules that wrap C libraries.

  • using "swift build" does not include the -fblocks directive

  • compiling directly with swiftc and including the -fblocks directive works fine

  • creating a module map that specifies "requires blocks" causes a complaint that Objective-C is not supported

Here is my original report, and a Github repo that illustrates the problem.

I made a module called "CDispatch" with a module.modulemap like this

=======
module CDispatch [system] {
header "/usr/include/dispatch/dispatch.h"
export *
link "dispatch"
}

Then I created a little demo project called gcd4 whose Source/main.swift prints some things and then uses a dispatch queue and a block to print a message after 2 seconds delay.

=========
CDispatch.dispatch_after(time, queue, {
print("Delayed!")
})

The entire project is checked in at https://github.com/sheffler/gcd4 <https://github.com/sheffler/gcd4\>
and the CDispatch module is checked in at https://github.com/sheffler/CDispatch <https://github.com/sheffler/CDispatch\>

If I try to "swift build" the project, it almost works but reports that dispatch_after is not found. It seems that this function is not defined if the "blocks" feature is not provided at compilation time.

========
Compiling Swift Module 'gcd4' (1 sources)
/home/sheffler/swift/gcd4/Sources/main.swift:42:1: error: module 'CDispatch' has no member named 'dispatch_after'
CDispatch.dispatch_after(time, queue, {
^~~~~~~~~ ~~~~~~~~~~~~~~
<unknown>:0: error: build had 1 command failures
swift-build: exit(1): ["/home/sheffler/src/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/swift-build-tool", "-f", "/home/sheffler/swift/gcd4/.build/debug/gcd4.o/llbuild.yaml"]

I got the demo program to work by first using "swift build" to retrieve the CDispatch module, and then manually running the compiler like this (and including the "-Xcc -fblocks" arguments)

swiftc -v -o gcd4 Sources/main.swift -I .build/debug -j8 -Onone -g -Xcc -fblocks -Xcc -F-module-map=Packages/CDispatch-1.0.0/module.modulemap -I Packages/CDispatch-1.0.0 -I /usr/local/include

[SR-45] Package metadata in manifests

Previous ID SR-45
Radar rdar://problem/28171622
Original Reporter Dominik (JIRA User)
Type Improvement
Status Reopened
Resolution
Additional Detail from JIRA
Votes 2
Component/s Package Manager
Labels Improvement
Assignee None
Priority Medium

md5: 9eb80fc7b5fd544bda453d0d78c1c595

Issue Description:

Is it planned to add metadata to package manifests?

It would be great to be able to add some information about a package, which could then be exposed via the package manager (or i.e. a future "registry" webapp helping with discovery of packages, similar to e.g. [Packagist](https://packagist.org) for [Composer](https://getcomposer.org) packages. Composer is a php package manager).

Such metadata might contain stuff like:

  • package name

  • package description

  • package keywords (for search/discovery)

  • package homepage

  • license of the package

  • author(s) of the package

Maybe the [composer.json schema](https://getcomposer.org/doc/04-schema.md) is also worth a look in terms of inspiration.

[SR-521] Public symbols are never dead stripped

Previous ID SR-521
Radar None
Original Reporter @allevato
Type Bug
Status Resolved
Resolution Done
Environment

Tested on OS X:
Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 51a9cea5cd)
Target: x86_64-apple-macosx10.9

Tested on Linux:
Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 1f2908b4f7)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s Compiler, Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 58e0a16182b3604b18df177057c9bc29

relates to:

  • SR-1021 Don't export public symbols from static libraries by default

Issue Description:

Symbols declared with public visibility are never dead stripped by the linker, even when linking an executable where there is no expectation that the result would be linked into anything else (and thus unused symbols could be safely discarded).

Stripping these symbols is important when building an executable that links to a large library that it only uses a portion of, to prevent code bloat.

STEPS TO REPRODUCE

1. Create functions.swift, first using internal visibility:

func foo() { print("foo") }
func bar() { print("bar") }

2. Create main.swift:

bar()

3. Build an executable (example provided is for OS X):
swiftc functions.swift main.swift -Xlinker -dead_strip

4. Run nm main and observe that foo has been stripped from the executable.

5. Modify functions.swift to declare the functions with public visibility:

public func foo() { print("foo") }
public func bar() { print("bar") }

6. Build the executable again:
swiftc functions.swift main.swift -Xlinker -dead_strip

7. Run nm main and observe that foo is still present.

EXPECTED BEHAVIOR

foo should be removed because we are building an executable and it is never referenced within that binary.

OTHER NOTES

On OS X, adding the -whole-module-optimization option to swiftc has no effect.

On Linux, the behavior differs. -Xlinker -dead_strip doesn't apply here; instead, we see the following based on -whole-module-optimization:

1. Internal visibility compiled without -whole-module-optimization: foo is not stripped
2. Internal visibility compiled with -whole-module-optimization: foo is stripped
3. Public visibility regardless of the presence of -whole-module-optimization: foo is not stripped

[SR-674] swiftpm should expose a way to set rpath

Previous ID SR-674
Radar rdar://problem/27119493
Original Reporter jaybuff (JIRA User)
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: 186d94abaf1ebb6e2c49fa8298c993b1

is duplicated by:

  • SR-1968 [SwiftPM] Need support for managing RPATH entries w.r.t. distribution
  • SR-6091 Module linked multiple times if dylib is importing same module that main executable does

relates to:

  • SR-1968 [SwiftPM] Need support for managing RPATH entries w.r.t. distribution

Issue Description:

There looks to be an undocumented way (e.g. setting SWIFTPM_EMBED_RPATH env var), but I take it that is only used for bootstrapping swift-build.

I'd prefer to be able to specify rpath in my Package.swift file.

[SR-109] RFE: `swift build` command line option to also pass -v to compiler

Previous ID SR-109
Radar None
Original Reporter @ddunbar
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: df4ce32c056169a5587c93252ee68269

Issue Description:

When triaging incoming bug reports, it is often useful to see the compilers -v output in addition to swift-build-tool's.

Maybe we should make:
swift build -v -v
automatically pass -v to the swift compiler invocations?

[SR-66] Unsupported source layout doesn't error as expected

Previous ID SR-66
Radar None
Original Reporter py (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @mxcl
Priority Medium

md5: 5cbcbb0092370ff69ffe83ac2bae3689

Issue Description:

As discussed on the swift-build-dev mailing list, when running swift build on the following directory structure, types defined in A.swift are considered to be undeclared in B.swift.

Sources/A.swift
Sources/B/B.swift

This ticket serves as a place to diagnose the issue and improve documentation, as requested by @ddunbar

It was suggested by @mxcl that this layout should either be supported or error.

[SR-107] Where to put/find the Package definition for a public dependency like SQLite?

Previous ID SR-107
Radar None
Original Reporter @groue
Type Bug
Environment

OSX

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 7fc8cb565e4091e3e7427ac154243ada

Issue Description:

I could define the package http://github.com/groue/CSQLite, and then have it used by https://github.com/groue/GRDB.swift/blob/Swift2.2/Package.swift. It all works, and that's pretty cool.

However I feel uncomfortable using this ad-hoc http://github.com/groue/CSQLite repository. It will never become the de-facto package definition for SQLite, and defeats the purpose of a Package Manager.

What is your advice?

[SR-40] Port Swift to Linux on Raspberry Pi

Previous ID SR-40
Radar None
Original Reporter @gribozavr
Type New Feature
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 24
Component/s Compiler, Foundation, Package Manager, Standard Library, XCTest
Labels New Feature, NewPortRequest, arm
Assignee @hpux735
Priority Medium

md5: 7062026e0685ad58b94ffcbb4be1f47b

Sub-Tasks:

  • SR-387 Undef. symbols when linking SwiftPM
  • SR-359 Undef. symbols when linking to Foundation (ARM)

Issue Description:

It would be good to get Swift compiler running on Raspberry Pi, as well as having a cross-compiler from x86 to Raspberry Pi.

[SR-662] swiftpm doesn't correctly order .a files when constructing swiftc args

Previous ID SR-662
Radar None
Original Reporter jaybuff (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 2
Component/s Package Manager
Labels Bug
Assignee @mxcl
Priority Medium

md5: f13d5ad12d638b307720fac644c5388f

relates to:

  • SR-387 Undef. symbols when linking SwiftPM

Issue Description:

It looks like llbuild doesn't consider order to pass .a files to swiftc.

$ swift --version
Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 42591f7cba)
Target: x86_64-unknown-linux-gnu

# build a package that depends on the swift package manager
$ cat Package.swift
import PackageDescription

let package = Package(
    name: "swift-ld-bug",
    dependencies: [
        .Package(url: "https://github.com/apple/swift-package-manager.git", Version!("0.1.0")),
    ]
)

# try to use the sys.Path method provided by swift pm
$ cat Sources/main.swift
import sys
let path = Path.join("usr", "bin")
print("path is \(path)")

# the build fails with linker issues: sys can't find methods in libc and POSIX
$ swift build
Compiling Swift Module 'libc' (3 sources)
Compiling Swift Module 'PackageDescription' (3 sources)
Linking Library:  .build/debug/libc.a
Compiling Swift Module 'POSIX' (22 sources)
Linking Library:  .build/debug/POSIX.a
Compiling Swift Module 'sys' (9 sources)
Linking Library:  .build/debug/sys.a
Linking Library:  .build/debug/PackageDescription.a
Compiling Swift Module 'dep' (9 sources)
Linking Library:  .build/debug/dep.a
Compiling Swift Module 'swiftbuild' (3 sources)
Linking Executable:  .build/debug/swift-build
Compiling Swift Module 'swiftldbug' (1 sources)
Linking Executable:  .build/debug/swift-ld-bug
/home/jaybuff/swift-ld-bug/.build/debug/sys.a(Path.swift.o): In function `_TFE3sysSSg10isAbsoluteSb':
/home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0/Sources/sys/Path.swift:194: undefined reference to `_TFE4libcSS9hasPrefixfSSSb'
/home/jaybuff/swift-ld-bug/.build/debug/sys.a(Path.swift.o): In function `_TZFV3sys4Pathg4homeSS':
/home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0/Sources/sys/Path.swift:48: undefined reference to `_TF5POSIX6getenvFSSGSqSS_'
/home/jaybuff/swift-ld-bug/.build/debug/sys.a(Path.swift.o): In function `_TFE3sysSS7abspathfzT_SS':
/home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0/Sources/sys/Path.swift:189: undefined reference to `_TF5POSIX6getcwdFzT_SS'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
error: exit(1): ["/home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swift-build-tool", "-f", "/home/jaybuff/swift-ld-bug/.build/debug/swift-ld-bug.o/llbuild.yaml"]

# run that build with verbose output and see the swiftc command it's using:
$ swift build -v
/home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swiftc --driver-mode=swift -I /home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/lib/swift/pm -L /home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/lib/swift/pm -lPackageDescription /home/jaybuff/swift-ld-bug/Package.swift
/usr/bin/git -C /home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0 config --get remote.origin.url
/usr/bin/git -C /home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0 config --get remote.origin.url
/home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swiftc --driver-mode=swift -I /home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/lib/swift/pm -L /home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/lib/swift/pm -lPackageDescription /home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0/Package.swift
/usr/bin/git -C /home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0 config --get remote.origin.url
/home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swiftc --driver-mode=swift -I /home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/lib/swift/pm -L /home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/lib/swift/pm -lPackageDescription /home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0/Package.swift
/home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swift-build-tool -v -f /home/jaybuff/swift-ld-bug/.build/debug/SwiftPackageManager.o/llbuild.yaml
/home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swift-build-tool -v -f /home/jaybuff/swift-ld-bug/.build/debug/swift-ld-bug.o/llbuild.yaml
/home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swiftc -o /home/jaybuff/swift-ld-bug/.build/debug/swift-ld-bug /home/jaybuff/swift-ld-bug/.build/debug/swift-ld-bug.o/Sources/main.swift.o -g /home/jaybuff/swift-ld-bug/.build/debug/dep.a /home/jaybuff/swift-ld-bug/.build/debug/libc.a /home/jaybuff/swift-ld-bug/.build/debug/PackageDescription.a /h
ome/jaybuff/swift-ld-bug/.build/debug/POSIX.a /home/jaybuff/swift-ld-bug/.build/debug/sys.a -L/usr/local/lib
/home/jaybuff/swift-ld-bug/.build/debug/sys.a(Path.swift.o): In function `_TFE3sysSSg10isAbsoluteSb':
/home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0/Sources/sys/Path.swift:194: undefined reference to `_TFE4libcSS9hasPrefixfSSSb'
/home/jaybuff/swift-ld-bug/.build/debug/sys.a(Path.swift.o): In function `_TZFV3sys4Pathg4homeSS':
/home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0/Sources/sys/Path.swift:48: undefined reference to `_TF5POSIX6getenvFSSGSqSS_'
/home/jaybuff/swift-ld-bug/.build/debug/sys.a(Path.swift.o): In function `_TFE3sysSS7abspathfzT_SS':
/home/jaybuff/swift-ld-bug/Packages/swift-package-manager-0.1.0/Sources/sys/Path.swift:189: undefined reference to `_TF5POSIX6getcwdFzT_SS'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
/usr/bin/which clang++
error: exit(1): ["/home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swift-build-tool", "-v", "-f", "/home/jaybuff/swift-ld-bug/.build/debug/swift-ld-bug.o/llbuild.yaml"]

# what if we we run the swiftc, but put sys.a before POSIX.a and libc.a in the args:
$ /home/jaybuff/swift-2.2-SNAPSHOT-2016-01-11-a-ubuntu15.10/usr/bin/swiftc -o /home/jaybuff/swift-ld-bug/.build/debug/swift-ld-bug /home/jaybuff/swift-ld-bug/.build/debug/swift-ld-bug.o/Sources/main.swift.o -g /home/jaybuff/swift-ld-bug/.build/debug/sys.a /home/jaybuff/swift-ld-bug/.build/debug/dep.a /home/jaybuff/swift-ld-bug/.build/debug/libc.a /home/jaybuff/s
wift-ld-bug/.build/debug/PackageDescription.a /home/jaybuff/swift-ld-bug/.build/debug/POSIX.a  -L/usr/local/lib

# it worked!
$  .build/debug/swift-ld-bug
path is usr/bin

The list of .a files and their order is passed from swiftc to clang++, which is finally passed to ld. ld's man page says that order matters:

Normally, an archive is searched only once in the order that it is specified on the command line. If a symbol in that archive is needed to resolve an undefined symbol referred to by an object in an archive that appears later on the command line, the linker would not be able to resolve that reference.

[SR-561] Package manager doesn't use SSH keyagent

Previous ID SR-561
Radar None
Original Reporter @Bouke
Type Bug
Status Closed
Resolution Done
Environment

OS X 10.11

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: aa2ef7aad1213b788c56c9fe72f16d45

Issue Description:

I would expect that swift build uses the SSH keyagent, so I don't have to provide the password for my keys;

> swift build
Cloning ssh://git@(...)
Enter passphrase for key '(...)/.ssh/id_rsa': 

Whereas I run the git clone command myself from the terminal:

> /usr/local/bin/git clone --recursive --depth 10 ssh://git@(...) (...)
Cloning into '(...)'...
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (4/4), done.
Checking connectivity... done.

[SR-387] Undef. symbols when linking SwiftPM

Previous ID SR-387
Radar None
Original Reporter @hpux735
Type Sub-task
Status Resolved
Resolution Cannot Reproduce
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Sub-task, StarterBug, arm, armhf, linux
Assignee @hpux735
Priority Medium

md5: c7d1f5db28cce77c7cc686cf6e7bddd9

Parent-Task:

  • SR-40 Port Swift to Linux on Raspberry Pi

relates to:

  • SR-662 swiftpm doesn't correctly order .a files when constructing swiftc args

Issue Description:

Linking fails while compiling the swift 'swift_build' module:

Compiling Swift Module 'swift_build' (3 sources)
Link /home/wdillon/build/Ninja-ReleaseAssert/swiftpm-linux-armv7/.bootstrap/bin/swift-build
bootstrap: note: building self-hosted 'swift-build': env SWIFTC=/home/wdillon/build/Ninja-ReleaseAssert/swift-linux-armv7/bin/swiftc SWIFT_BUILD_TOOL=/home/wdillon/build/Ninja-ReleaseAssert/llbuild-linux-armv7/bin/swift-build-tool SWIFT_BUILD_PATH=/home/wdillon/build/Ninja-ReleaseAssert/swiftpm-linux-armv7 SWIFTPM_EMBED_RPATH=$ORIGIN/../lib/swift/linux /home/wdillon/build/Ninja-ReleaseAssert/swiftpm-linux-armv7/.bootstrap/bin/swift-build
LLVM ERROR: Program used external function '_TMaC18PackageDescription7Package' which could not be resolved!
error: ExitStatus(1, ["/home/wdillon/build/Ninja-ReleaseAssert/swift-linux-armv7/bin/swiftc", "--driver-mode=swift", "-I", "/home/wdillon/build/Ninja-ReleaseAssert/swiftpm-linux-armv7/.bootstrap/lib/swift/pm", "-L", "/home/wdillon/build/Ninja-ReleaseAssert/swiftpm-linux-armv7/.bootstrap/lib/swift/pm", "-lPackageDescription", "/home/wdillon/swiftpm/Package.swift"])
bootstrap: error: build failed with exit status 1
utils/build-script: command terminated with a non-zero exit status 1, aborting

[SR-679] swiftpm should support rewriting dependent package urls for vendoring

Previous ID SR-679
Radar rdar://problem/28895755
Original Reporter jaybuff (JIRA User)
Type New Feature
Status Reopened
Resolution
Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels New Feature
Assignee None
Priority

md5: 2a3c7f12451e616747e3dc55507e86d4

relates to:

  • SR-1168 Deal with dependency name collisions

Issue Description:

We would like a method to munge dependency urls for a number of reasons. We want to "vendor" dependencies. Vendoring would give us a number of benefits:

  1. integrity - no one would be able to change a tag out from under us

  2. customization - place to put custom patches

  3. availability - we don't have to depend on uptime of an external system

I imagine a hook that we could register in the top Package.swift that would have a signature like this:

mungeDependency(originalUrl: String, originalVersion: Version) -> (newUrl: String, newVersion: Version)

This is partially related to the "scheme" problem where the user running swift build rather than the developer writing Package.swift should be controlling if the git clone is happening using the https or git protocol.

[SR-81] Cant Build Hello World on Ubuntu 14.04

Previous ID SR-81
Radar None
Original Reporter @colemancda
Type Bug
Status Closed
Resolution Cannot Reproduce

Attachment: Download

Environment

Ubuntu 14.04 VMWare Fusion

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @colemancda
Priority Medium

md5: e77125661a1335083d5fd3afd9f39af0

relates to:

  • SR-60 exit status 127 when compiling a C dependency

Issue Description:

I tried to write a simple hello world command line executable to test Swift. The Swift build command exits with linker error 127.

Log: (Jira will detect "PATH" as a macro, ignore it)

coleman@ubuntu:export PATH='/home/coleman/Swift/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin':"${PATH}"
coleman@ubuntu:~/Swift/HelloWorld$ swift build -v
/home/coleman/Swift/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/swiftc -module-name HelloWorld -incremental -emit-dependencies -emit-module -emit-module-path /home/coleman/Swift/HelloWorld/.build/debug/HelloWorld.swiftmodule -output-file-map /home/coleman/Swift/HelloWorld/.build/debug/HelloWorld.o/HelloWorld/output-file-map.json -c /home/coleman/Swift/HelloWorld/main.swift -I /home/coleman/Swift/HelloWorld/.build/debug -j8 -Onone -g -I /usr/local/include
/home/coleman/Swift/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/swiftc -o /home/coleman/Swift/HelloWorld/.build/debug/HelloWorld /home/coleman/Swift/HelloWorld/.build/debug/HelloWorld.o/main.swift.o -L/usr/local/lib
<unknown>:0: error: link command failed with exit code 127 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
swift-build: exit(1): ["/home/coleman/Swift/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/swift-build-tool", "-v", "-f", "/home/coleman/Swift/HelloWorld/.build/debug/HelloWorld.o/llbuild.yaml"]

I've attached the simple project.

[SR-688] Package.swift isn't respected for dependencies

Previous ID SR-688
Radar None
Original Reporter @jpsim
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee kkoval (JIRA)
Priority

md5: 843a95daa5865ec2651e488a650f2990

Issue Description:

Swift Package Manager doesn't respect its dependencies' Package.swift files, which means (among other issues) that packages with interdependencies fail to build when included as dependencies to other projects.

For example, take this Package description from the Swift Package Manager's documentation:

let package = Package(
    name: "Example",
    targets: [
        Target(
            name: "top",
            dependencies: [.Target(name: "bottom")]),
        Target(
            name: "bottom")
    ]
)

If I attempt to use this package as a dependency, {code:none}swift build

[SR-179] Including Gtk header (gtk/gtk.h) in a module - can't find gdk/gdk.h

Previous ID SR-179
Radar None
Original Reporter Lanza (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Linux from scratch (~7.8), x86_64 - systemd - Gnome/Gtk+ 3.18
Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift f25b887686)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 1
Component/s Compiler, Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 2291c7682614c944c65753a6cdb17259

duplicates:

  • SR-145 Need a way to add include paths in modulemap

Issue Description:

When trying to include gtk.h from a module, swift complains it can't find gdk.h

<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "/usr/include/gtk-3.0/gtk/gtk.h"
         ^
/usr/include/gtk-3.0/gtk/gtk.h:30:10: error: 'gdk/gdk.h' file not found
#include <gdk/gdk.h>
         ^
main.swift:1:8: error: could not build Objective-C module 'CGtk'
import CGtk

gtk.h sits in /usr/include/gtk-3.0/gtk/gtk.h and gdk.h is in /usr/include/gtk-3.0/gdk/gdk.h

I've tried with package manager and directly using swiftc, I've created a module for gdk, nothing works and it swift still cannot find gdk/gdk.h

[SR-473] Add version constants to each package

Previous ID SR-473
Radar None
Original Reporter @mxcl
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels New Feature
Assignee kkoval (JIRA)
Priority Medium

md5: a3094f8613e66dbff0c75b9857d3ac66

relates to:

  • SR-12926 provide a way to get the SHA of the current package in code

Issue Description:

Every package should generate a swift file that contains two public constants:

public let url: String
public let version: (Int, Int, Int, String?)

Ideally this would be part of llbuild’s YAML so it is involved in the build graph. But it will be enough for now to just generate the file every build.

[SR-209] Package Manager unable to download dependencies with a major of 0

Previous ID SR-209
Radar None
Original Reporter camelCaseD (JIRA User)
Type Bug
Status Resolved
Resolution Cannot Reproduce
Environment

Ubuntu 14.04

Additional Detail from JIRA
Votes 2
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: b1484331102fb514ef15583d12f61b45

Issue Description:

Having a Package.swift like the following that depends on a package with no major version of 1 or greater than:

import PackageDescription

let package = Package(
  name: "Hello",
  dependencies: [
    .Package(url: "https://github.com/huytd/swift-http.git", versions: Version(0,0,0)...Version(1,0,0))
  ]
)

results in the following error when running swift build

The dependency graph could not be satisifed (https://github.com/huytd/swift-http.git). 

While the repository has been tagged with version 0.0.1.

I than created a fork of the repo and quickly created a tag of 1.0.0 then updated my Package.swift file to point to the fork and point to any version between majors of 1 and 2. Running swift build after this worked with no problems.

[SR-85] LLDB error while debugging packages created using SPM on mac

Previous ID SR-85
Radar None
Original Reporter @aciidb0mb3r
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c)
Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @ddunbar
Priority Medium

md5: 4794cc89978f5d958c594e90726fd635

Issue Description:

Trying to do anything at a breakpoint in lldb produces this error on mac
error: Error in auto-import:
failed to get module '<package name>' from AST context

This doesn't happen on Ubuntu 15.10 and lldb works as expected

Steps to reproduce:
$ git clone https://github.com/aciidb0mb3r/sample-swift-package.git
$ cd sample-swift-package
$ swift build
$ lldb .build/debug/SamplePackage
(lldb) breakpoint set -f main.swift -l 2
(lldb) r
(lldb) p foo

adding args += ["-g"] before args += ["-L/usr/local/lib"] in method writeLinkNode(target: ) at
https://github.com/apple/swift-package-manager/blob/master/Sources/dep/llbuild.swift resolves the issue

not sure if should it be added with conditional for OSX?

[SR-588] Allow custom env variables in Package.swift

Previous ID SR-588
Radar None
Original Reporter Memorion (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

OS X 10.11

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 30222e0229f3a915aa19abe648c6ced4

Issue Description:

Currently if you try something like this in your Package.swift

if let _ = String.fromCString(getenv("TEST")) {
    let package = Package(name: "getenv_was_true")
} else {
    let package = Package(name: "getenv_was_false")
}

it uses the else path whether TEST is set or not which I assume is due to the explicit environment parameter here:

let toml = try popen(cmd, environment: ["SWIFT_DUMP_PACKAGE": "1"])

I wrote a sample project for the issue:
https://github.com/Memorion/getenvdemo

[SR-83] Can't link to UUID library

Previous ID SR-83
Radar None
Original Reporter @colemancda
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Ubuntu 14.04 VMWare Fusion

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: e3676bcb79fba0363bae0879a54c8e91

Issue Description:

I cannot link to the UUID library despite installing uuid-dev package.

Proposed fix:

I believe I know what the problem is. The SPM (Swift Package Manager) seems to be linking against libraries in /usr/lib. The UUID library in Ubuntu 14.04 is in /usr/lib/x86-linux-gnu/libuuid.so. The fix for this has to be either in Swift, under the Glibc module, or in the SPM.

Log:

coleman@ubuntu:~/Swift/SwiftFoundationExample$ swift build
Compiling Swift Module 'SwiftFoundationExample' (1 sources)
Linking Executable: .build/debug/SwiftFoundationExample
/home/coleman/Swift/SwiftFoundationExample/.build/debug/SwiftFoundation.a(POSIXUUID.swift.o): In function `TFF15SwiftFoundation21POSIXUUIDCreateRandomFT_TVs5UInt8S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0U_FGSpTS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0T*':
/home/coleman/Swift/SwiftFoundationExample/Packages/SwiftFoundation-1.0.1/Sources/POSIXUUID.swift:35: undefined reference to `uuid_generate'
/home/coleman/Swift/SwiftFoundationExample/.build/debug/SwiftFoundation.a(POSIXUUID.swift.o): In function `TFF15SwiftFoundation28POSIXUUIDConvertToUUIDStringFTVs5UInt8S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0TVs4Int8S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1U_FTGSpTS0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0GSpTS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1*_T':
/home/coleman/Swift/SwiftFoundationExample/Packages/SwiftFoundation-1.0.1/Sources/POSIXUUID.swift:60: undefined reference to `uuid_unparse'
/home/coleman/Swift/SwiftFoundationExample/.build/debug/SwiftFoundation.a(POSIXUUID.swift.o): In function `TF15SwiftFoundation28POSIXUUIDConvertStringToUUIDFSSGSqTVs5UInt8S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0_S0
_':
/home/coleman/Swift/SwiftFoundationExample/Packages/SwiftFoundation-1.0.1/Sources/POSIXUUID.swift:85: undefined reference to `uuid_parse'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
swift-build: exit(1): ["/home/coleman/Swift/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/swift-build-tool", "-f", "/home/coleman/Swift/SwiftFoundationExample/.build/debug/SwiftFoundationExample.o/llbuild.yaml"]

[SR-608] Provide automatic features for exposing Swift function profiling data

Previous ID SR-608
Radar None
Original Reporter @ddunbar
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels New Feature, StarterBug
Assignee None
Priority Medium

md5: 03fe6c3771211358a4f1f23f58df8c31

Issue Description:

swiftpm should have a feature where we automatically enable and extract the per-function time data from the compiler, then aggregate it and report it.

This could be invaluable for people who are having performance issues with large Swift projects.

[SR-710] Generate XCTestCaseProvider entries on Linux

Previous ID SR-710
Radar rdar://problem/32453385
Original Reporter @mxcl
Type Improvement

Attachment: Download

Additional Detail from JIRA
Votes 6
Component/s Package Manager, XCTest
Labels Improvement
Assignee None
Priority Medium

md5: d49557eb297404f7997ff4b6bf1a55f5

Sub-Tasks:

  • SR-1613 Require blocks runtime when compiling SourceKit on Linux
  • SR-1639 [SourceKit] Add in-process implementations of sourcekitd functions only defined for XPC

is blocked by:

duplicates:

  • SR-32 Find way to make allTests required / audited on OS X

Issue Description:

To test on Linux XCTestCase entries must conform to the protocol XCTestCaseProvider.

This means mostly mac developers probably won't bother making their tests run on Linux, which is not ideal.

XCTestCaseProvider will exist until Swift has reflection support on Linux, so we should try to generate these entries on Linux for now in the PM.

Use the AST to extract XCTestCase classes and their test functions, generate a source, add it to the test module.

Also generate an XCTMain for the full package suite.

This feature depends on me landing testing support (hopefully today).

[SR-666] swiftpm should allow me to depend on latest commit of a branch

Previous ID SR-666
Radar rdar://problem/29964194
Original Reporter jaybuff (JIRA User)
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 4
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: b10f288e55add23846354603cdc57b6c

is duplicated by:

  • SR-1867 Specify the branch to clone in Package.swift

Issue Description:

I want the ability to depend on the latest version of a particular branch in a repo (master being the most common).

Sometimes upstream library authors might have a fix or a feature in the latest version, but they haven't done a release yet. For development I'd like to try that out before the release is official.

[SR-785] Command line argument parsing: swift-test should print help when passed -h, --help

Previous ID SR-785
Radar None
Original Reporter @modocache
Type Improvement
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Improvement, StarterBug
Assignee @aciidb0mb3r
Priority Medium

md5: 3add60f1bf6a3cfdae084373421fe1a7

Issue Description:

swift-build prints instructions on how to use it when passed --help:

$ swift-build --help
OVERVIEW: Build sources into binary products

USAGE: swift build [options]

MODES:
  --configuration <value>  Build with configuration (debug|release) [-c]
  --clean[=<mode>]         Delete artefacts (build|dist) [-k]
  --init                   Creates a new Swift project
  --fetch                  Fetch package dependencies

OPTIONS:
  --chdir <value>    Change working directory before any other operation [-C]
  -v[v]              Increase verbosity of informational output
  -Xcc <flag>        Pass flag through to all C compiler instantiations
  -Xlinker <flag>    Pass flag through to all linker instantiations
  -Xswiftc <flag>    Pass flag through to all Swift compiler instantiations

swift-test does not do the same:

$ swift-test --help
error: system(["swift-build-tool", "-f", "/Users/bgesiak/GitHub/tmp/SimpleGetClient/.build/debug.yaml", "test"], posix_spawn error: No such file or directory (2), `["swift-build-tool", "-f", "/Users/bgesiak/GitHub/tmp/SimpleGetClient/.build/debug.yaml", "test"]`)

The underlying problem is that the command-line parsing for swift-build is not shared with swift-test. It seems like we should share a generic command line argument parsing mechanism.

I know a great deal of command line argument parsing modules exist on GitHub. https://github.com/kylef/Commander in particular is installable via SwiftPM. Perhaps we should consider using an existing solution?

[SR-29] Support custom directory layouts

Previous ID SR-29
Radar rdar://problem/28039974
Original Reporter @krzyzanowskim
Type New Feature
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 3
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: e62834d3875d27814a7aba76facdedb5

relates to:

  • SR-3405 the package has an unsupported layout

Issue Description:

The Swift Package Manager relies on folder names very much. I found it impossible to create Package with folders layout not blessed by Swift Package Manager. This is issue for current project where Xcode has it's own layout of directories - incompatible with the approach of Swift Package Manager.

I tried create Package and failed. This is what I have build: https://github.com/krzyzanowskim/CryptoSwift/tree/develop/SwiftPackageManager it builds but I can't use it anywhere because it complain about folders.

and yes, I hate it 😉

[SR-25] No option for specifying module search path

Previous ID SR-25
Radar None
Original Reporter dunkelstern (JIRA User)
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 285414b2766ebde40af7aa93bb8b9d79

Issue Description:

The swift build command has no option to tell the build system where to search for custom module maps.

I think llbuild is able to do that but there's no obvious interface to tell the build command where to search (or at least it is not documented how to do so).

[SR-82] Undefined reference errors when linking against Foundation on Linux

Previous ID SR-82
Radar None
Original Reporter @sharplet
Type Bug
Status Resolved
Resolution Cannot Reproduce
Environment
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:    15.10
Codename:   wily
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 2175b88b9bbb7d223d9d9c8498681739

Issue Description:

I'm trying to get an existing project building on Linux.

The project is a wrapper around NSRegularExpression. I'm aware that NSRegularExpression is currently unimplemented on Linux. So I expected the code to compile and link successfully, but to see a runtime error.

Instead, the library compiles fine, but fails when linking to an executable with a number of undefined reference errors:

$ swift build
Compiling Swift Module 'Regex' (3 sources)
Linking Library:  .build/debug/Regex.a
Compiling Swift Module 'testregex' (1 sources)
Linking Executable:  .build/debug/testregex
/home/sharplet/src/scratch/testregex/.build/debug/Regex.a(MatchResult.swift.o): In function `_TFC5RegexP33_39987651F4A52C01A04E0211B81F3A7A12_MatchResultD':
/home/sharplet/src/scratch/testregex/.build/debug/Regex.o/Source/MatchResult.swift.o:(.text+0x10c1): undefined reference to `_TMaC10Foundation20NSTextCheckingResult'
/home/sharplet/src/scratch/testregex/.build/debug/Regex.a(MatchResult.swift.o): In function `_TFFC5RegexP33_39987651F4A52C01A04E0211B81F3A7A12_MatchResultg13captureRangesGSaGVs5RangeVVSS9UTF16View5Index__U_FT_GSaGS1_S3___':
/home/sharplet/src/scratch/testregex/Packages/Regex-0.2.3/Source/MatchResult.swift:43: undefined reference to `_TMV10Foundation8_NSRange'
/home/sharplet/src/scratch/testregex/Packages/Regex-0.2.3/Source/MatchResult.swift:43: undefined reference to `_TMV10Foundation8_NSRange'
/home/sharplet/src/scratch/testregex/.build/debug/Regex.a(MatchResult.swift.o): In function `_TMaGSaV10Foundation8_NSRange_':
/home/sharplet/src/scratch/testregex/Packages/Regex-0.2.3/Source/MatchResult.swift:(.text+0x20b3): undefined reference to `_TMV10Foundation8_NSRange'
/home/sharplet/src/scratch/testregex/.build/debug/Regex.a(MatchResult.swift.o): In function `_TMaGVs17IndexingGeneratorGSaV10Foundation8_NSRange__':
/home/sharplet/src/scratch/testregex/Packages/Regex-0.2.3/Source/MatchResult.swift:(.text+0x2128): undefined reference to `_TMV10Foundation8_NSRange'
/home/sharplet/src/scratch/testregex/.build/debug/Regex.a(MatchResult.swift.o): In function `_TMaGVs10ArraySliceV10Foundation8_NSRange_':
/home/sharplet/src/scratch/testregex/Packages/Regex-0.2.3/Source/MatchResult.swift:(.text+0x21a3): undefined reference to `_TMV10Foundation8_NSRange'
/home/sharplet/src/scratch/testregex/.build/debug/Regex.a(MatchResult.swift.o):/home/sharplet/src/scratch/testregex/Packages/Regex-0.2.3/Source/MatchResult.swift:(.text+0x22c8): more undefined references to `_TMV10Foundation8_NSRange' follow
...

When I import Foundation in the REPL and try to use NSRegularExpression, I see the expected runtime error.

Steps to reproduce:

1. Create a new directory with the following `Package.swift` file:

import PackageDescription

let package = Package(
  name: "testregex",
  dependencies: [
    .Package(url: "https://github.com/sharplet/Regex.git", majorVersion: 0, minor: 2),
  ]
)

2. Run swift build

[SR-166] Package manager fails in virtualbox shared folder

Previous ID SR-166
Radar None
Original Reporter george (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Mac OS X 10.11.2 (Host)
Ubuntu 15.10 (Virtualbox Guest)

Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 881bff0fe9dad1bc4eed45931e69117a

Issue Description:

The package manager fails when run in a virtualbox shared folder.

Steps to reproduce:

  1. Create a guest Ubuntu 15.10 OS in an OS X El Capitan host
  2. Share a folder "workspace" from the host OS to the guest OS
  3. Type the following in the guest terminal:
    `cd $SHARED_FOLDER_LOCATION`
    `git clone https://github.com/apple/example-package-dealer`
    `cd example-package-dealer`
    `swift build`

Result:
swift-build: rename error: File exists (17): /media/sf_documents/example-package-dealer/Packages/example-package-fisheryates -> /media/sf_documents/example-package-dealer/Packages/example-package-fisheryates-1.0.2

Expected:
Build Succeeds

[SR-467] Package Manager Unable to Build Dependency with Prerelease Identifiers

Previous ID SR-467
Radar None
Original Reporter jbl (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @mxcl
Priority Medium

md5: 801ee557ccaa4b312197e300c0ed64a0

Issue Description:

When a dependency has a prerelease identifier, for instance version 1.2.3-beta5, swiftpm is unable to build it. I've been able to trace it to the initializer in dep/Package.swift, which uses the hyphen to split the folder name and then assumes the last component in the version. For example, with version 1.2.3-beta5 of the package deck-of-playing-cards, the package would get checked out into the folder deck-of-playing-cards-1.2.3-beta5. That initializer then interprets the version as beta5 and refuses to build the package because the version is incorrectly formatted.

[SR-24] Package manager warning for swift files w/o symbols

Previous ID SR-24
Radar None
Original Reporter @gfontenot
Type Bug
Status Closed
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Bug
Assignee @belkadan
Priority Medium

md5: 48e0c3b7b63e8fc4c54863502a002027

Issue Description:

When building a package, Swift is apparently unable to compile files that don't explicitly export symbols, such as files that only define operators. For organizational purposes, sometimes it's useful to separate the operator definitions from the implementations, so this causes an issue.

To reproduce:

Try to run `swift build` in the attached sample

Expected:

A module is built, and `Operators.swift` is compiled successfully.

Actual:

`swift build` fails with the following error:

```
Compiling Swift Module 'Foo' (1 sources)
Linking Library: .build/debug/Foo.a
<snip>ranlib: file: <snip>/Foo/.build/debug/Foo.a(Operators.swift.o) has no symbols
```

[SR-33] Support packaging Swift packages as dynamic libraries

Previous ID SR-33
Radar None
Original Reporter @ahti
Type New Feature
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 6
Component/s Package Manager
Labels New Feature
Assignee @mxcl
Priority Medium

md5: c5e1c0ac4de9e353bcff819b4c922692

Issue Description:

From what I've read in the documentation about the package manager, it will currently statically link all code from dependencies into one final binary.

If (and hopefully when) Swift gains traction in the Linux community, Linux distributions will at some point in time want to integrate Swift packages into their native packaging mechanism. For this it would be advantageous to:

  1. have the ability to compile a Swift package into a dynamic library (maybe plus some more metadata) that can be packaged independently

  2. allow swift applications to be built to dynamically load their dependencies at runtime

The concept of dynamic frameworks on iOS/OSX could be used on Linux as well, having some sort of Swift packages/frameworks folder that packages will be sought for in when a binary is trying to load a dependency.

[SR-671] swiftpm isn't passing correct flags to cause clang to load module map files

Previous ID SR-671
Radar None
Original Reporter @ddunbar
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: b6618b0fccfb3ecb43ad793ddcf42d25

Issue Description:

swiftpm is currently passing -F-module-map=(path) for module map packages. What this is actually doing is adding a directory "-module-map=(path)" to the compiler framework search paths, it is not actually causing Clang to load the module map.

The correct spelling for this flag is -fmodule-map-file=(path).

The fact that this flag isn't being passed correctly apparently indicates that we don't really need it. It would be worth investigating if there are corner cases that just aren't working, or if we really don't need it.

[SR-668] Mistyping swift when compiling yields incomprehensible error message

Previous ID SR-668
Radar rdar://problem/40205896
Original Reporter yenrab (JIRA User)
Type Bug
Environment

OS X 10.11, Swift 2.2

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug, Driver
Assignee @ddunbar
Priority Medium

md5: ff874a88459fe51b83bda74b49cfc915

Issue Description:

If a typo is made and Swift is used instead of swift when compiling a package the message reported is

<unknown>:0: error: invalid value 'Swift' in '--driver-mode='

Something much more understandable should be displayed.

[SR-159] Add ability to specify localpath for a dependency.

Previous ID SR-159
Radar None
Original Reporter kkoval (JIRA User)
Type New Feature
Status Resolved
Resolution Won't Do
Additional Detail from JIRA
Votes 2
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: 2e74a9a37d27f5dcd089924474b89238

relates to:

  • SR-2261 Improve the error message that's shown when trying to access a package by path

Issue Description:

Use case:
I want to create a simple module on my PC and specify it as a dependency.

let package = Package(
    name: "Pa",
    dependencies: [
        .Package( url: "../LibADep")
    ]
)

Now to make it work i need to create a .git and add a version.
this makes the process of creating new Packages more complex and hard.

[SR-415] blocks support in external c libraries disabled

Previous ID SR-415
Radar None
Original Reporter dunkelstern (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Snapshot from 2015-12-22 on Ubuntu 15.10

Additional Detail from JIRA
Votes 0
Component/s Compiler, Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 8b498b23f358b9220a306299718d7edd

duplicates:

  • SR-397 Linux - module using <dispatch/dispatch.h> does not compile cleanly with "swift build"

Issue Description:

I wanted to do some code in C because of missing support in Swift (try to use a socket interface, that casting is horrible) so I did the "complex" part in C and just wanted to call back into swift with the data.

If you use a C-Function pointer as callback interface you'll get:
"error: a C function pointer cannot be formed from a closure that captures context"

that sounds reasonable so i tried to use a clang block callback but then i get:
"error: blocks support disabled - compile with -fblocks or pick a deployment target that supports them"

I know for compiling my C test program that uses the interface I have to link against "BlocksRuntime" and compile with "-fBlocks" but how do I set the compile parameter with "swift build"?

If you want to see what I want to do look here: https://github.com/dunkelstern/libUnchainedSocket

(current github checkin with tag 0.0.1 has the c function pointer interface, see branch "blocks" for the blocks version, you'll need "libblocksruntime-dev")

[SR-353] Swift Package Manager "npm init"-style new project creation

Previous ID SR-353
Radar None
Original Reporter joeiachievedit (JIRA User)
Type Improvement
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 6
Component/s Package Manager
Labels Improvement
Assignee None
Priority Medium

md5: e7761834596189b625f8570ffec1a687

Issue Description:

npm init is a quick way to create a Package.json file filled out with enough information to bootstrap a new NodeJS application. I typically start my Swift projects by copying an existing Package.swift and editing, this could be bootstrapped as well with something like swift build init or swift build --create, etc.

[SR-712] [Swiftpm] Unstable test: MiscellaneousTestCase.testManifestExcludes2

Previous ID SR-712
Radar None
Original Reporter @shahmishal
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @ddunbar
Priority Medium

Watchers: @shahmishal

md5: e8099bd9f561d8f5edb10351ffed5ad2

Issue Description:

Swiftpm project has a unstable test which is causing CI to report failure.

https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-15_10/2358/console

Test Case 'MiscellaneousTestCase.testManifestExcludes2' started.
/home/buildnode/jenkins/workspace/oss-swift-incremental-RA-linux-ubuntu-15_10/swiftpm/Sources/../Tests/Functional/TestMiscellaneous.swift:66: error: MiscellaneousTestCase.testManifestExcludes2 : failed - `swift build' failed:

exit(1): ["/home/buildnode/jenkins/workspace/oss-swift-incremental-RA-linux-ubuntu-15_10/Ninja-ReleaseAssert/swiftpm-linux-x86_64/.bootstrap/bin/swift-build", "--chdir", "/tmp/Miscellaneous_ExcludeDiagnostic2.H8yj4x/ExcludeDiagnostic2"]

/home/buildnode/jenkins/workspace/oss-swift-incremental-RA-linux-ubuntu-15_10/swiftpm/Sources/../Tests/Functional/TestMiscellaneous.swift:67: error: MiscellaneousTestCase.testManifestExcludes2 : failed - Expected file doesn’t exist: /tmp/Miscellaneous_ExcludeDiagnostic2.H8yj4x/ExcludeDiagnostic2/.build/debug/BarLib.a
Test Case 'MiscellaneousTestCase.testManifestExcludes2' failed (0.354 seconds).

[SR-362] Run swiftpm tests in parallel

Previous ID SR-362
Radar None
Original Reporter @gribozavr
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @gribozavr
Priority Medium

md5: ca375caeed16f1e747510ff7e4098d65

relates to:

  • SR-804 Improve SwiftPM Testing Time

Issue Description:

swiftpm tests should run in parallel. This will save us time in CI.

[SR-35] Cannot find -lstdc++

Previous ID SR-35
Radar None
Original Reporter hhnghia (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Ubuntu 14.04

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug, Linux
Assignee hhnghia (JIRA)
Priority Medium

md5: 14b6eab75b353f7c891561e8af05d8ea

Issue Description:

Build fails when following the "getting started" on Ubuntu 14.04

I got issue:

~/Desktop/Hello$ swift build
Linking Executable: .build/debug/Hello
/usr/bin/ld: cannot find -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
swift-build: exit(1): ["/home1/dtcang/Toolchains/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/swift-build-tool", "-f", "/home1/dtcang/Desktop/Hello/.build/debug/Hello.o/llbuild.yaml"]

[SR-154] Make Manifest file cleaner by using StringLiteralConvertible

Previous ID SR-154
Radar None
Original Reporter kkoval (JIRA User)
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels New Feature
Assignee jemmons (JIRA)
Priority Medium

md5: a793076b66877820565e291c3d101ce9

Issue Description:

Make Target.Dependency.Target conform to StringLiteralConvertible.
This way I could just specify "libA" as a target dependency
This makes Manifest file more clean.

Now:

let package = Package(
    name: "Example",
    targets: [
        Target(
            name: "top",
            dependencies: [.Target(name: "bottom")]),
        Target(
            name: "bottom")
    ]
)

After using StringLiteralConvertible:

let package = Package(
    name: "Example",
    targets: [
        Target(
            name: "top",
            dependencies: [ "bottom"]),
        Target(name: "bottom")
    ]
)

[SR-205] Can't build swiftpm Project in Xcode after installing new swift-2.2-SNAPSHOT-2015-12-10-a

Previous ID SR-205
Radar None
Original Reporter kkoval (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

MacOS version : 10.11.2 (15C50)
Xcode: Version 7.2 beta (7C62b)

Swift: https://swift.org/builds/xcode/swift-2.2-SNAPSHOT-2015-12-10-a/swift-2.2-SNAPSHOT-2015-12-10-a-osx.pkg

Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 501c84eb01eb6ed97f072067eb68c7c5

Issue Description:

The project was working fine. Then I've installed new Swift Toolchain and got an error.

Xcode ErrorLog:

CopySwiftLibs DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest
    cd /Users/konstantin/Work/apple/swiftpm/Support
    export CODESIGN_ALLOCATE=/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign - --scan-executable /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/MacOS/PackageDescription-tests --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/PlugIns --platform macosx --destination /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --strip-bitcode

/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: conditional binary operator expected
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: syntax error near `"$tool"'
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: `if [[ ! -fx "$tool" ]]; then'
Command /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool failed with exit code 2

Steps:

  1. Have installed previous SNAPSHOT and use swiftpm project
    https://swift.org/builds/xcode/swift-2.2-SNAPSHOT-2015-12-01-a/swift-2.2-SNAPSHOT-2015-12-01-a-osx.pkg

2. Install new Snapshot. https://swift.org/builds/xcode/swift-2.2-SNAPSHOT-2015-12-10-a/swift-2.2-SNAPSHOT-2015-12-10-a-osx.pkg

3. Open swiftmp Xcode project and try to compile.

[SR-70] Support TOML for package manifests

Previous ID SR-70
Radar None
Original Reporter Shrike (JIRA User)
Type New Feature
Status Closed
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels New Feature
Assignee Shrike (JIRA)
Priority Medium

md5: 3c4c18fef990c7eaf6a949c89e8bdd51

Issue Description:

TOML is used by projects such as: Rust's Cargo (package manager/buildsystem) and Hugo (static site generator).

TOML has a simple (INI-like) format/specification, is easy to parse and is in my opinion an excellent format for things such as package manifests.

[SR-235] The package manager fails to link C static libraries

Previous ID SR-235
Radar None
Original Reporter valentinradu (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

OS: OSX El Capitan
Toolchain: swift-2.2-SNAPSHOT-2015-12-01-a

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee valentinradu (JIRA)
Priority Medium

md5: 9e4f456ddc0b50ca3c704f851d707f05

Issue Description:

Out of the box, with no tweaks or workarounds, trying to link a C system module pointing to a static library fails. It works fine when the same library is dynamic.

An example module map:

module CFCGI [system] {
header "/usr/local/include/cfcgi/cfcgi.h"
link "cfcgi"
export *
}

And the output:

swift build --clean && swift build -v
Cloning into '/Users/valentinradu/Playgrounds/April/Packages/libcfcgi'...
warning: --depth is ignored in local clones; use file:// instead.
done.
/Library/Developer/Toolchains/swift-2.2-SNAPSHOT-2015-12-01-a.xctoolchain/usr/bin/swiftc -module-name April -incremental -emit-dependencies -emit-module -emit-module-path /Users/valentinradu/Playgrounds/April/.build/debug/April.swiftmodule -output-file-map /Users/valentinradu/Playgrounds/April/.build/debug/April.o/April/output-file-map.json -c /Users/valentinradu/Playgrounds/April/Sources/main.swift -I /Users/valentinradu/Playgrounds/April/.build/debug -j8 -Onone -g -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -Xcc -F-module-map=/Users/valentinradu/Playgrounds/April/Packages/libcfcgi-1.0.0/module.modulemap -I /Users/valentinradu/Playgrounds/April/Packages/libcfcgi-1.0.0 -I /usr/local/include
/Library/Developer/Toolchains/swift-2.2-SNAPSHOT-2015-12-01-a.xctoolchain/usr/bin/swiftc -o /Users/valentinradu/Playgrounds/April/.build/debug/April /Users/valentinradu/Playgrounds/April/.build/debug/April.o/Sources/main.swift.o -Xlinker -all_load -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -L/usr/local/lib
Undefined symbols for architecture x86_64:
"_cfcgi_create", referenced from:
_main in main.swift.o
"_cfcgi_free", referenced from:
_main in main.swift.o
"_cfcgi_start_and_wait", referenced from:
_main in main.swift.o
ld: symbol(s) not found for architecture x86_64
<unknown>:0: error: build had 1 command failures
swift-build: exit(1): ["/Library/Developer/Toolchains/swift-2.2-SNAPSHOT-2015-12-01-a.xctoolchain/usr/bin/swift-build-tool", "-v", "-f", "/Users/valentinradu/Playgrounds/April/.build/debug/April.o/llbuild.yaml"]

It looks like the linker ignores the `link cfcgi` part.

Additional info:

  • libcfcgi.a is in /usr/local/lib and it’s compiled for x86_64

  • libcfcgi.a contains the above mentioned symbols, tested it with nm and linked it in a small C program: it works.

[SR-725] swiftpm should allow me to specify swift files to ignore

Previous ID SR-725
Radar None
Original Reporter jaybuff (JIRA User)
Type Improvement
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Improvement
Assignee kkoval (JIRA)
Priority Medium

md5: 485598bdbb730205dc389cfe6ccfcbf9

Issue Description:

There are valid use-cases where I want to have a .swift file in a place where swift-pm doesn't want it.

cd $(mktemp -d)
mkdir Sources
echo "print("hello")" > Sources/main.swift
touch Package.swift
touch IgnoreThis.swift
swift build

This fails with:

[SR-441] Improve error massage for Missing tag in dependency.

Previous ID SR-441
Radar None
Original Reporter kkoval (JIRA User)
Type Improvement
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Improvement
Assignee kkoval (JIRA)
Priority Medium

md5: 440f16e95e67c5afa256a8d19d2b43e3

Issue Description:

Add better error message for "InvalidDependencyGraph"
I'm trying to specify a dependency without an existing tag.

Package.swift file
import PackageDescription

let package = Package(
    name: "Bar",
    dependencies: [
      .Package(url: "../A", versions: Version(0,0,0)...Version(1,0,0))
    ]
)

Error message:

The dependency graph could not be satisfied (/Users/konstantin/Work/spmExample/Task-1/A)

Better error should include steps I need to take to fix it, like add version to dependency

[SR-690] Building dependency chain A->B->C->D fails on B when D is a system module.

Previous ID SR-690
Radar None
Original Reporter vadim (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Ubuntu 15.10 4.2.0-25-generic #30-Ubuntu SMP Mon Jan 18 12:31:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority

md5: 3512370dae839a2e87ebdc81118db70f

Issue Description:

Building dependency chain A->B->C->D fails on B when D is a system module.

See the projects in the attachment, the projects are packageA, packageB, packageC, packageD.

packageD is a system module CJPEG with module map that uses header "/usr/include/jpeglib2.h" (jpeglib.h with include stdio.h), as described in https://github.com/apple/swift-package-manager/blob/master/Documentation/SystemModules.md .

packagesC provides module x that depends on packageD and imports CJPEG, as described in https://github.com/apple/swift-package-manager/blob/master/Documentation/SystemModules.md.

packageB provides module y that depends on packageC and imports x

packageA has main.swift that imports y and depends on packageB.

swift build fails on compiling packageB. Due to import x, CJPEG is going to be imported as well, however CJPEG is not found.

swift build output:

Cloning /home/vadime/swift-dev/PackageManager/defect1ToSubmit/defect1/packageB
Using version 0.0.1 of package packageB
Cloning /home/vadime/swift-dev/PackageManager/defect1ToSubmit/defect1/packageC
Using version 0.0.1 of package packageC
Cloning /home/vadime/swift-dev/PackageManager/defect1ToSubmit/defect1/packageD
Using version 0.0.1 of package packageD
Compiling Swift Module 'x' (1 sources)
Linking Library: .build/debug/x.a
Compiling Swift Module 'y' (1 sources)
/home/vadime/swift-dev/PackageManager/defect1ToSubmit/defect1/packageA/Packages/packageB-0.0.1/Sources/y/y.swift:17:8: error: missing required module 'CJPEG'
import x
^
<unknown>:0: error: build had 1 command failures
error: exit(1): ["/home/vadime/swift/swift-DEVELOPMENT-SNAPSHOT-2016-02-03-a-ubuntu15.10/usr/bin/swift-build-tool", "-f", "/home/vadime/swift-dev/PackageManager/defect1ToSubmit/defect1/packageA/.build/debug/packageB.o/llbuild.yaml"]

To recreate the defect - unzip the attached zip. Install libjpeg and add /usr/include/jpeglib2.h which is a copy of /usr/include/jpeglib.h with include stdio.h. Initialize git and add tags in packageB, packageC, packageD. Perform swift build in packageA.

[SR-750] Can't build swiftpm project

Previous ID SR-750
Radar None
Original Reporter kkoval (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 3e151ea6c18aa3d992c85ad304ac09b1

Issue Description:

1 - clone SwiftPM project
2 - build it ./Utilities/bootstrap

Res: Get an error:
NoSources("/Users/konstantin/Work/apple/swiftpm-old/Tests/dep")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.