Questions tagged [ld]

These questions are about ld: a dynamic linker/loader which combines object files, archive files and shared libraries before the final compilation of a program.

Filter by
Sorted by
Tagged with
77
votes
2answers
56k views

Getting “Not found” message when running a 32-bit binary on a 64-bit system

I have currently a strange problem on debian (wheezy/amd64). I have created a chroot to install a server (i can't give any more detail about it, sorry). Let's call its path /chr_path/. To make things ...
20
votes
4answers
44k views

Find out if library is in path

Assuming I want to test if a library is installed and usable by a program. I can use ldconfig -p | grep mylib to find out if it's installed on the system. but what if the library is only known via ...
17
votes
1answer
2k views

Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library?

I have a binary executable named "alpha" that requires a linked library (libz.so.1.2.7) which is placed at /home/username/myproduct/lib/libz.so.1.2.7 I export the same to my terminal instance before ...
16
votes
1answer
11k views

Is it normal that LD_LIBRARY_PATH variable is missing from an environment?

I have found by coincidence that on my Debian Jessie there is no LD_LIBRARY_PATH variable (to be exact printenv | grep LD shows nothing related to linker and echo "$LD_LIBRARY_PATH" shows also nothing)...
14
votes
3answers
63k views

ldd does not find path, How to add

I know this question isn't very new but it seems as if I didn't be able to fix my problem on myself. ldd generate the following output u123@PC-Ubuntu:~$ ldd /home/u123/Programme/TestPr/Debug/TestPr ...
13
votes
1answer
39k views

What is the default value of LD_LIBRARY_PATH? [duplicate]

In my case, it seems as if LD_LIBRARY_PATH is set to the empty string. But all standard system tools still work fine, so I guess the dynamic linker checks for that case and uses some default for ...
12
votes
1answer
15k views

Where to get “/etc/ld.so.nohwcap” file from? [duplicate]

When I run a command through strace utility I can see access errors such as access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) Now I've read somewhere that what's ...
9
votes
3answers
1k views

Making a process read a different file for the same filename

I have an application that reads a file. Let's call it processname and the file ~/.configuration. When processname runs it always reads ~/.configuration and can't be configured differently. There are ...
9
votes
1answer
3k views

Difference between 'ld' and 'ld.so'?

While both are called "linker" and are used to link binaries, I can't really figure out how they differ from each other. Can anyone tell me their differences?
9
votes
2answers
7k views

What is the difference between “LSB executable” (ET_EXEC) and “LSB shared object” (ET_DYN)?

With two files, one compiled and linked with gcc and the other manually with nasm and ld I get ELF 32-bit LSB shared object ... ELF 32-bit LSB executable ... What's the difference between these two ...
7
votes
4answers
3k views

Overwriting a running executable or .so

I have a question about overwriting a running executable, or overwriting a shared library (.so) file that's in use by one or more running programs. Back in the day, for the obvious reasons, ...
6
votes
1answer
3k views

Fedora 27 /usr/bin/ld: cannot find -lstdc++

I have Fedora 27. I am building something from source. (It is https://github.com/xmrig/xmrig-nvidia if that matters). Make gets to linking and then fails with this message: /usr/bin/ld: cannot find -...
6
votes
2answers
11k views

Is it OK to sort /etc/ld.so.conf

I am wondering if I can keep the entries in /etc/ld.so.conf sorted. My ld.so.conf looks now like this: /usr/X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/lib64/Xaw3d /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /...
6
votes
3answers
6k views

How can I find out what linker flags are needed to use a given C library function?

Running example C code is a painful exercise unless it comes with a makefile. I often find myself with a C file containing code that supposedly does something very cool, but for which a first basic ...
5
votes
2answers
1k views

stdbuf supposed behavior for subprocesses

I didn't exactly find something about the following in the man-page. How is the supposed behavior in subprocesses spawned by a process which was itself spawned by stdbuf? E.g.: stdbuf -oL myprog ...
4
votes
1answer
2k views

Are there any circumstances in which ld ignores LD_LIBRARY_PATH?

I've just come across a little problem with ld which I just can't explain. Let's say I have compiled a library in my home directory and installed it all under ~/root. The shared library file can be ...
4
votes
1answer
952 views

How to prevent a process from writing to the systemd journal?

I am using a third party .NET Core application (a binary distribution used by a VS Code extension) that unfortunately has diagnostic logging enabled with no apparent way to disable it (I did already ...
4
votes
3answers
711 views

Compile program in GNU GuixSD with cmake

I am trying to compile Xash3D on GuixSD v1.0.0 and gcc 8.3.0. As is shown below, ld (GNU Linker) is giving me errors, that ctr1.o and ctri.o are missing. These files exist elsewhere under multiple ...
4
votes
1answer
1k views

undefined reference, even when the linked library does exist

I'm trying to compile VTK from source and I received the following error. I'm running Fedora 27, kernel version 4.14.11-300.fc27.x86_64 /usr/lib64/libSM.so: undefined reference to `uuid_generate@...
4
votes
0answers
249 views

How to Run ld in Script with A Smaller Memory Footprint?

I'm trying to build Swift 3 on FreeBSD. The last thing I need to do is run the build-script. My problem is that at some point the script runs: Linking CXX executable bin/llvm-lto Which ...
4
votes
0answers
462 views

Why ldd doesn't show filename paths for dependencies?

I'm experimenting with ELF RUNPATH variable for dynamic dependencies. Along the way I got a copy of bash binary with changed RUNPATH, running ldd on it returns: $ ldd ./bash linux-vdso.so.1 =>...
3
votes
2answers
15k views

How to link to a shared library with a relative path?

In the man page for ld.so(8), it says that When resolving library dependencies, the dynamic linker first inspects each dependency string to see if it contains a slash (this can occur if a library ...
3
votes
1answer
217 views

ld linker ignores LD_LIBRARY_PATH

I'm having trouble linking the Intel MKL libraries to use in building Julia with MKL support. I've had this problem with other projects as well, but here I'll focus on Julia. I have MKL installed in /...
3
votes
1answer
2k views

Automatically start an application with a modifed LD_PRELOAD?

I have an application that needs a modified LD_PRELOAD. I want to start the application using the originally provided rc script, so I can benefit from an automatically updated rc script on an update ...
3
votes
1answer
2k views

What are difference between the ELF symbol visibility levels?

The NASM docs on "elf Extensions to the GLOBAL Directive" say, Optionally, you can control the ELF visibility of the symbol. Just add one of the visibility keywords: default, internal, hidden, or ...
3
votes
1answer
7k views

ld can't find .so

I installed zeromq 3.2.5 from source $ wget http://download.zeromq.org/zeromq-3.2.5.tar.gz $ tar xf zeromq-3.2.5.tar.gz $ cd zeromq-3.2.5 $ ./configure && make -j4 $ sudo make install This ...
3
votes
3answers
738 views

redirect application listening on localhost to listening on external interface / alternative to bindp ( libindp.so )

imagine a server application that listens on localhost only, that has no settings to listen on other interfaces one wants to force make it listen on other interfaces such as eth0 bindp (libindp.so) ...
3
votes
1answer
1k views

Error while building snipersim: “relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC”

I know that snipersim isn't a very typical "project" but this is more a linux/linking problem than anything else, so I think it goes here. I have also contacted the developers, but have yet ...
3
votes
2answers
2k views

Cannot find shared object file even though it's in library path

I am trying to install plexmediaplayer from source. This involves compiling libmpv.so.1 which I've done and installed under /usr/local/lib When I run plexmediaplayer, I get the following error: $ ...
3
votes
0answers
2k views

ld cannot find existing library

I'm trying to build a large application, yet for some reason linking fails and ld responds /usr/bin/ld: cannot find -l/usr/lib/x86_64-linux-gnu/libX11.so Steps I've tried: libx11-dev is correctly ...
2
votes
1answer
3k views

GNU Linker differences between the different 32bit emulation modes?

What is the difference between the 386 and 32 bit options in ld -V? elf32_x86_64 elf_i386 i386linux i386pep i386pe And, where can I find the documentation on these "emulation modes"
2
votes
2answers
726 views

Different standards of ELF (SysV vs TIS) and Linux?

There are at least two standards of Executable and Linkable Format (ELF), one of them System V Application Binary Interface AMD64 Architecture Processor Supplement (With LP64 and ILP32 Programming ...
2
votes
1answer
2k views

What does “unused direct dependencies” mean?

When using the ldd command there is an option, -u, to print unused direct dependencies as stated in the on-line help. For example: ldd -u /bin/gcc Unused direct dependencies: /lib64/...
2
votes
2answers
2k views

How to investigate and fix missing libraries and/or skipping incompatible library?

I have one secret library built for CentOS 6.5 as a package. I can't build package for CentOS 7.4, make install fails on this line: $ gcc -static -O3 -Wno-long-long -funroll-loops -Wall -g -DLINUX ...
2
votes
2answers
2k views

ldconfig cannot link to specific files

I installed ATLAS (with Netlib LAPACK) in a Docker image, and now every time I run ldconfig, I get the following errors: ldconfig: Can't link /usr/local/lib//usr/local/lib/libtatlas.so to libtatlas....
2
votes
1answer
4k views

Compile shared library from asm code with current sources

I just did some basic functions in asm that I compile in a shared library. Like : BITS 64 global foo section .text foo: mov rax, 1 ret I compiled with ...
2
votes
2answers
2k views

Using gcc compile flags

I am trying to understand how to properly setup gcc to find stuff in my environmental variables. Currently I compiled some code, SDL and I added it to my .bashrc and sourced that .bashrc as well. ...
2
votes
1answer
1k views

building code from source and adding them to your path

Typically on Debian when you install things from the repository, they just work. It sets up things just fine and life is good. This is great for things that are up to date in the repository. I am ...
2
votes
1answer
862 views

De-prioritize ld.conf.so.d library path resolution

From a separate question, and other articles on the subject, it appears that additional library paths defined by ld.so.conf.d will always be resolved (i.e. in the case of a name clash, such as when ...
2
votes
1answer
281 views

Can’t run the ownCloud client on Linux Mint 19 Tara (Qt issues)

I have a problem running the ownCloud client on Linux Mint 19 Tara. It doesn’t start. If run from the command line, it gives me these errors: pavel@lenovo ~ $ owncloud owncloud: /usr/lib/x86_64-linux-...
2
votes
0answers
219 views

Charm crypto library - unit tests failing with undefined symbol: BN_is_negative

I'm trying to build and test the python Charm crypto library from source. It compiles and installs ok, but I get 91 cases of undefined symbol: BN_is_negative when running sudo make test: /charm/charm/...
2
votes
1answer
4k views

How to Resolve undefined reference to 'RAND_egd'

Debian 8 Jessie, OpenSSL version 1.1.0, cURL version: 7.50.2 I am trying to build curl on a Linux Debian system. All stages go well up until trying to build with make command. The linking stage fails ...
1
vote
1answer
254 views

What mandates the _start entrypoint (kernel, ld-linux.so, etc.)?

I know that ELF executable files need to have a visible _start subroutine where the execution begins. However, from what I can understand, the Kernel actually calls in ld-linux.so (or some other ...
1
vote
1answer
141 views

LD option for deterministic loading of program and shared objects?

I'm working on an unusual problem on a BeagleBone Black. The "unusual" part is stepping under the debug causes a SIGILL that was not formerly present. Addresses are moving around between runs due to ...
1
vote
2answers
37 views

How to use gcc dynamic linker

test.c: #include <stdio.h> int main(){ return printf("helloworld %d",a); } lib.c: int a=0; test.c is using the variable a from lib.c. I turned it into the shared library lib.so. gcc ...
1
vote
1answer
4k views

Make error: DSO missing from command line

I am attempting to install rejoystick, and when I run make, I get this: Making all in src make[1]: Entering directory '/home/chrx/Downloads/joystick/rejoystick-0.8.1/src' make[2]: Entering directory '...
1
vote
1answer
531 views

Cannot chroot bash after setting RUNPATH in ld-linux-x86-64.so.2 with patchelf 0.6 and 0.8

I am testing how dynamic linking works with RUNPATH variable, and trying to run bash in a minimal chroot directory: $ find dir_chroot/ -type f dir_chroot/bin/bash dir_chroot/lib/x86_64-linux-gnu/libc....
1
vote
1answer
7k views

How can I build my shared library (.so) so that symbols from a different shared library are also included? [closed]

My shared library libnew.so uses some symbols form an already built third-party shared library libold.so. I would like to build an executable binary file that should be only linked against libnew.so. ...
1
vote
1answer
1k views

configure: error: LDFLAGS

I am trying to install LTTng. I was installing lttng-tools-2.6.0 and got the following error: configure: error: Cannot find libuuid uuid_generate nor libc uuid_create. Use LDFLAGS=-Ldir to specify ...
1
vote
1answer
723 views

Failed make when installing madplay source

I am attempting to get madplay installed on my shared host I've run: ./configure --prefix=$HOME CPPFLAGS="-I /home/dir/include" LDFLAGS="-L /home/dir/lib" and then "make", but on that on run into ...