swift build linking / Ubuntu


(Matt Kolb) #1

Hello!

I was very excited over the open-sourcing of swift today, and immediately
downloaded the distribution for Ubuntu. In following:

mak@nibbler ~/Documents/github/mkolb/Hello
% tree
.
├── Package.swift
└── Sources
       └── main.swift

1 directory, 2 files
mak@nibbler ~/Documents/github/mkolb/Hello % cat Sources/main.swift
print("Hello, jabrone!")
mak@nibbler ~/Documents/github/mkolb/Hello %

However, upon attempting to build the package, I receive the following
error during linking:

mak@nibbler ~/Documents/github/mkolb/Hello
% swift build -v
/home/mak/Documents/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swiftc
-o /home/mak/Documents/github/mkolb/Hello/.build/debug/Hello
/home/mak/Documents/github/mkolb/Hello/.build/debug/Hello.o/Sources/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/mak/Documents/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swift-build-tool",
"-v", "-f",
"/home/mak/Documents/github/mkolb/Hello/.build/debug/Hello.o/llbuild.yaml"]

Being brand new to this toolchain, and being as the archives are empty, I
figured I'd post this question. Thanks for any help!

mak


(Dmitri Gribenko) #2

Hi Matt,

Please install the dependencies and try again:

$ sudo apt-get install git cmake ninja-build clang uuid-dev libicu-dev
icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig
libpython-dev libncurses5-dev pkg-config

Dmitri

···

On Thu, Dec 3, 2015 at 11:33 AM, Matt Kolb <kolb722@gmail.com> wrote:

mak@nibbler ~/Documents/github/mkolb/Hello
% swift build -v
/home/mak/Documents/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swiftc -o /home/mak/Documents/github/mkolb/Hello/.build/debug/Hello /home/mak/Documents/github/mkolb/Hello/.build/debug/Hello.o/Sources/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/mak/Documents/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swift-build-tool", "-v", "-f", "/home/mak/Documents/github/mkolb/Hello/.build/debug/Hello.o/llbuild.yaml"]

Being brand new to this toolchain, and being as the archives are empty, I figured I'd post this question. Thanks for any help!

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/


(Matt Kolb) #3

That did the trick! Thank you so much for your quick reply.

mak

···

On Thu, Dec 3, 2015 at 2:40 PM Dmitri Gribenko <gribozavr@gmail.com> wrote:

On Thu, Dec 3, 2015 at 11:33 AM, Matt Kolb <kolb722@gmail.com> wrote:
> mak@nibbler ~/Documents/github/mkolb/Hello
> % swift build -v
>
/home/mak/Documents/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swiftc
-o /home/mak/Documents/github/mkolb/Hello/.build/debug/Hello
/home/mak/Documents/github/mkolb/Hello/.build/debug/Hello.o/Sources/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/mak/Documents/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swift-build-tool",
"-v", "-f",
"/home/mak/Documents/github/mkolb/Hello/.build/debug/Hello.o/llbuild.yaml"]
>
> Being brand new to this toolchain, and being as the archives are empty,
I figured I'd post this question. Thanks for any help!

Hi Matt,

Please install the dependencies and try again:

$ sudo apt-get install git cmake ninja-build clang uuid-dev libicu-dev
icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig
libpython-dev libncurses5-dev pkg-config

Dmitri

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/


(Daniel Dunbar) #4

To clarify, the only additional dependency which you should need for simply *using* the package manager is to "sudo apt-get install clang" (swiftc uses "clang++" to perform the actual link).

The full list of dependencies Dmitri gave is only needed if you are also trying to build the Swift compiler from source.

We documented this requirement here:
  https://swift.org/download/#linux
(step 6) but it may need additional clarification.

Cheers,
- Daniel

···

On Dec 3, 2015, at 11:43 AM, Matt Kolb <kolb722@gmail.com> wrote:

That did the trick! Thank you so much for your quick reply.

mak

On Thu, Dec 3, 2015 at 2:40 PM Dmitri Gribenko <gribozavr@gmail.com <mailto:gribozavr@gmail.com>> wrote:
On Thu, Dec 3, 2015 at 11:33 AM, Matt Kolb <kolb722@gmail.com <mailto:kolb722@gmail.com>> wrote:
> mak@nibbler ~/Documents/github/mkolb/Hello
> % swift build -v
> /home/mak/Documents/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swiftc -o /home/mak/Documents/github/mkolb/Hello/.build/debug/Hello /home/mak/Documents/github/mkolb/Hello/.build/debug/Hello.o/Sources/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/mak/Documents/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu15.10/usr/bin/swift-build-tool", "-v", "-f", "/home/mak/Documents/github/mkolb/Hello/.build/debug/Hello.o/llbuild.yaml"]
>
> Being brand new to this toolchain, and being as the archives are empty, I figured I'd post this question. Thanks for any help!

Hi Matt,

Please install the dependencies and try again:

$ sudo apt-get install git cmake ninja-build clang uuid-dev libicu-dev
icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig
libpython-dev libncurses5-dev pkg-config

Dmitri

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com <mailto:gribozavr@gmail.com>>*/
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users