0

I am trying to compile a library using a specific version of libstdc++.so, not the system one.

The compilation script uses waf.

I tried to export LD_LIBRARY_PATH=<path/to/directory/of/my/libstdc++.so>. Since I use fish, I have also tried with set --export LD_LIBRARY_PATH <path/to/directory/of/my/libstdc++.so> and LD_LIBRARY_PATH=<path/to/directory/of/my/libstdc++.so> waf

However, until now it still links against the system libstdc++.so

Anyone knows how to force the usage of my libstdc++.so?

fortea
  • 345
  • 4
  • 15

1 Answers1

0

You can set the standard library in clang using the -stdlib=<yours> flag. See here for more info: https://clang.llvm.org/docs/ClangCommandLineReference.html

EDIT: Leaving my past answer up there just so that it's a known edit, but you should be able to just use -nostdlib and optionally, -nostdinc, to compile your program. Then to supply your own standard library, just add it as a compiler argument. For example:

clang -nostdinc -nostdlib -I/custom/include/path foo.c /path/to/your/cstdlib.so

For more help configuring the linker, see this post.

Guy Marino
  • 429
  • 3
  • 6