You are not logged in.

#1 2023-03-21 03:42:42

Phaserblast
Member
Registered: 2023-03-21
Posts: 6

Where are the system library search paths defined?

Hey all, I'm coming over from Debian and am trying to understand some of the fundamental differences between Arch and Debian. For example, systemwide libraries are stored in different places. When moving binaries between distros, I'd like to know how the linker on Arch knows where to look for system-installed libs. Where are the actual paths to /lib and /lib64 stored that the dynamic linker uses for its search? Any help is appreciated!

Offline

#2 2023-03-21 04:11:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Where are the system library search paths defined?

Phaserblast wrote:

When moving binaries between distros...

Ah, what?  Don't do that.

Phaserblast wrote:

Where are the actual paths to /lib and /lib64 stored that the dynamic linker uses for its search?

Both are links to /usr/lib/

Last edited by Trilby (2023-03-21 04:12:22)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2023-03-21 04:18:10

Phaserblast
Member
Registered: 2023-03-21
Posts: 6

Re: Where are the system library search paths defined?

Trilby wrote:

Both are links to /usr/lib/

Right, I get that. But the dynamic linker needs to know what the paths are. This can be overridden with LD_LIBRARY_PATH, but I would like to know where the default paths are stored. In other words, what text file on the system contains the default paths?

Offline

#4 2023-03-21 04:23:33

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,461

Re: Where are the system library search paths defined?

inside the linker itself.

Offline

#5 2023-03-21 04:24:45

Phaserblast
Member
Registered: 2023-03-21
Posts: 6

Re: Where are the system library search paths defined?

Scimmia wrote:

inside the linker itself.

Oh, really? The library paths are hard-coded into the linker? Is there a way of getting it to print its default paths?

Offline

#6 2023-03-21 04:37:43

Phaserblast
Member
Registered: 2023-03-21
Posts: 6

Re: Where are the system library search paths defined?

I think I figured it out:

# Print 32 bit lib paths
/lib/ld-linux.so.2 --help

# Print 64 bit lib paths
/lib/ld-linux-x86-64.so.2 --help

Compiling with gcc with -m64 outputs a binary that links with /usr/lib/libc.so.6. Doing the same using -m32 links with /usr/lib32/libc.so.6.
That's what I needed to know!

Last edited by Phaserblast (2023-03-21 04:45:40)

Offline

Board footer

Powered by FluxBB