Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8750671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:54:27+00:00 2026-06-13T12:54:27+00:00

Short question : How does llvm-ld locate libstdc++ ? Details : I am getting

  • 0

Short question:
How does llvm-ld locate libstdc++?

Details:

I am getting the following error message:

llvm-ld: error: Cannot find library 'stdc++'

while running llvm-ld. I am trying to understand how llvm-ld searches for libstdc++.

I am setting up a new system and following compilation steps that work on a different system. Eventually I noticed a difference with the LD_LIBRARY_PATH that was set in my .bashrc on the old system that included a large number of directories including for Cadence and other miscellaneous software. I don’t want to use the LD_LIBRARY_PATH, I want to be able to link against libstdc++ by supplying the appropriate command line parameters to llvm-ld.

The command I am running is:

llvm-ld -disable-internalize -native -o foo foo.bc4 -L/usr/lib/x86_64-linux-gnu -lpthread -lrt  -lstdc++ -lm -v

which results in the following output:

  Linking bitcode file 'foo.bc4'
  Linked in file 'foo.bc4'
  Linking archive file '/usr/lib/x86_64-linux-gnu/libpthread.a'
  Linking archive file '/usr/lib/x86_64-linux-gnu/librt.a'
llvm-ld: error: Cannot find library 'stdc++'

However running ls -l /usr/lib/x86_64-linux-gnu/libstdc++* results in:

lrwxrwxrwx 1 root root     19 Apr 15 16:34 /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ->    libstdc++.so.6.0.16
-rw-r--r-- 1 root root 962656 Apr 15 16:36 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16

So I don’t understand why llvm-ld is not finding this file? Especially since when I compile with with the LD_LIBRARY_PATH set and then run ldd on the resulting executable I get the following output:

linux-vdso.so.1 =>  (0x00007ffff7ffe000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffff7dc1000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ffff7ac0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffff77c6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ffff75b0000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff71f0000)
/lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

Which seems to indicate that the version of libstdc++ that I want is /usr/lib/x86_64-linux-gnu/libstdc++.so.6 but I can’t figure out why llvm-ld is not locating it with the search path -L/usr/lib/x86_64-linux-gnu.

For reference: uname -a results in: Linux FOO 3.2.0-30-generic #48-Ubuntu SMP Fri Aug 24 16:52:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

And llvm-ld --version:

LLVM (http://llvm.org/):
  LLVM version 3.1svn
  Optimized build.
  Built Sep 14 2012 (13:22:38).
  Default target: x86_64-unknown-linux-gnu
  Host CPU: core2
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:54:28+00:00Added an answer on June 13, 2026 at 12:54 pm

    It looks like llvm-ld isn’t looking for .so.#. According to the man page:

    When looking for a library specified with the -l option, llvm-ld first attempts to load a file with that name from the current directory. If that fails, it looks for liblibrary.bc, liblibrary.a, or liblibrary.shared library extension, in that order, in each directory added to the library search path with the -L option. These directories are searched in the order they are specified. If the library cannot
    be located, then llvm-ld looks in the directory specified by the LLVM_LIB_SEARCH_PATH environment variable. If it does not find a library there, it fails.

    You can make this work by creating a symlink /usr/lib/x86_64-linux-gnu/libstdc++.so -> libstdc++.so.6.

    I usually link with clang directly, since it understands searching for C++ library things better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short question, is the following ok: struct X { A& x; A y; X()
Short question, if this works (and it does): eval(new + generator.className + ( +
The short question is: if I hg rollback , how does Peter get my
Short question, why does Assert.AreEqual(1.0, double.NaN, 1.0) pass? Whereas Assert.AreEqual(1.0, double.NaN) fails. Is it
Simple and short question but it seems that I can't find the answer anywhere.
I have a short question. Why does OpenGL come with its own datatypes for
Short question: How does IIS know if a request is webforms or MVC?
Short version of the question: What is wrong with the following Kiwi/iOS mock expectation?
Short question :) Does anyone have a method for creating a Inner glow effect
Short question: What does an exception's sourceID refer to, and how can I link

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.