Adding .o files path to ld default (crtbeginS.o, not .so files)
Asked Answered
E

1

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.

Ectoblast answered 21/5, 2015 at 22:58 Comment(0)
R
-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.

Raina answered 7/10, 2020 at 9:42 Comment(1)
thats for the runtime or dynamic linker not linker as in the step to link all the .o objects togetherThetos

© 2022 - 2024 — McMap. All rights reserved.