8

When using GCC to compile most things, I get this error:

/..//bin/ld: cannot find crtbeginS.o: No such file or directory

crtbeginS.o exists at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/crtbeginS.o (Installed from GCC trunk, 6.0.0-trunk)

I added that directory to ldconfig and ran ldconfig, but it didn't pick up any additional directories. (I'm thinking since it's a .o rather than .so)

As a temporary fix, I tried making a symlink to /usr/local/lib64/crtbeginS.o - but that gives the same error.

What can I do, so the /usr/local/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/ directory is always looked at to find the library?

If I run gcc -print-search-dirs|grep "/usr/local/lib/gcc/x86_64-unknown-linux-gnu/6.0.0", it shows libraries: =/usr/local/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/:... But, this is of course gcc not ld.

If I run ld --verbose | grep SEARCH_DIR, I see /usr/local/lib/gcc_x86_64-unknown-linux-gnu/6.0.0 is NOT included.

I'd really like to do this as a system-wide default, so I don't have to give -L to everything. I'm fine building bintools from source, if that's necessary.

user1902689
  • 1,655
  • 2
  • 22
  • 33

1 Answers1

-1

What can I do, so the /usr/local/lib/gcc/x86_64-unknown-linux-gnu/6.0.0/ directory is always looked at to find the library?

You have to change the ld configuration.

Depending on your system, ld.so is configurable with a file in /etc/, and possibly with files under '/etc/ld.so.conf.d or /etc/ld.so.d. The manual pages for ld.so and ldconfig are a good place to start reading on how to change the configuration for ld.

Zig Razor
  • 3,381
  • 2
  • 15
  • 35