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-35] Cannot find -lstdc++ #5404

Closed
swift-ci opened this issue Dec 4, 2015 · 5 comments
Closed

[SR-35] Cannot find -lstdc++ #5404

swift-ci opened this issue Dec 4, 2015 · 5 comments

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Dec 4, 2015

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"]

@ddunbar
Copy link
Member

ddunbar commented Dec 4, 2015

I am unable to reproduce. Can you run:
swift build -v
and then copy/paste the last line (which should be an invocation of swiftc, to link), and rerun it while also adding "-v"?

Also, what is the output of:
dpkg -l | grep -i stdc

@swift-ci
Copy link
Contributor Author

swift-ci commented Dec 7, 2015

Comment by Huynh Huu Nghia (JIRA)

I am try re-run with command
/Desktop/Hello$ swift build -v
/home1/dtcang/Toolchains/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/swiftc -o /home1/dtcang/Desktop/Hello/.build/debug/Hello /home1/dtcang/Desktop/Hello/.build/debug/Hello.o/Sources/main.swift.o /home1/dtcang/Desktop/Hello/.build/debug/Hello.o/Sources/Greeter.swift.o -L/usr/local/lib
/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", "-v", "-f", "/home1/dtcang/Desktop/Hello/.build/debug/Hello.o/llbuild.yaml"]

Hello$ dpkg -l | grep -i stdc
ii libstdc+-4.8-dev:amd64 4.8.4-2ubuntu1~14.04 amd64 GNU Standard C+ Library v3 (development files)
ii libstdc+6:amd64 4.8.4-2ubuntu1~14.04 amd64 GNU Standard C+ Library v3

@ddunbar
Copy link
Member

ddunbar commented Dec 7, 2015

Can you run:

/home1/dtcang/Toolchains/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin/swiftc -o /home1/dtcang/Desktop/Hello/.build/debug/Hello /home1/dtcang/Desktop/Hello/.build/debug/Hello.o/Sources/main.swift.o /home1/dtcang/Desktop/Hello/.build/debug/Hello.o/Sources/Greeter.swift.o -L/usr/local/lib -v

and paste the output? It should show the invocation of clang++ it is using to try to link.

Can you also try:

clang++ -shared -x c /dev/null -o /dev/null -lstdc++

which should succeed and verify that your system clang++ is capable of linking. If that doesn't work, this isn't a Swift specific issue...

@mxcl
Copy link
Contributor

mxcl commented Dec 24, 2015

bump.

@mxcl
Copy link
Contributor

mxcl commented Feb 19, 2016

Closing due to age. Hopefully this has resolved itself due to the copious number of bug fixes that have landed.

@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
Projects
None yet
Development

No branches or pull requests

3 participants