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
0 votes
1 answer
17 views

Linker cannot find libpthread

I am trying to build 32bit versions of two programs, and both shows the same error message /usr/bin/ld: cannot find /media/34GB/Arquivos-de-Programas-Linux/Glibc-2.17-32bit/lib/libpthread.so.0 I ...
0 votes
0 answers
85 views

Building python from source with --includedir and -libdir

I'm trying to build python from source. I got the error home/jmsh/Python-3.10.5/Modules/_ctypes/_ctypes.c:107:10: fatal error: ffi.h: No such file or directory Since I'm not a sudoer on the machine, ...
0 votes
0 answers
3k views

/usr/bin/ld: cannot find -latomic: No such file or directory

I am trying to compile some code using gcc. The following error is thrown: /usr/bin/ld: cannot find -latomic: No such file or directory collect2: error: ld returned 1 exit status make[1]: *** [...
2 votes
1 answer
281 views

ELF symbol: GLOBAL+HIDDEN

Based on eg. this Oracle description: STB_GLOBAL Global symbols. These symbols are visible to all object files being combined. One file's definition of a global symbol will satisfy another file's ...
0 votes
1 answer
46 views

How to link using -lfoo when there are versioned names of libfoo but no libfoo.so

Suppose /usr/lib/x86_64-linux-gnu/ contains libfoo: libfoo.so.2 -> libfoo.so.2.0.0 (symbolic link) libfoo.so.2.0.0 Notably missing is libfoo.so. Suppose there is a program /usr/local/bin/...
  • 2,134
0 votes
1 answer
666 views

32bit program on 64bit: cannot execute binary file: Exec format error

I'm linking an application consisting out of two libraries in clang under WSL. The command I use looks as follows (simplified): clang -m32 -fsanitize=address -L _build/ -l:lib1.lib -l:lib2.lib -o test ...
1 vote
1 answer
77 views

Which component of linux remove filter environment variables on executing setuid program?

It's observed that when running a program having setuid bit set, it won't receive some environment variables set on the shell (bash etc.). Several environment variables which get removed this way are ...
0 votes
0 answers
21 views

Why I can execute files without execution permission if I use ld-2.31.so? [duplicate]

I am a bit shocked about this discover. If I don't have execution permission on a file, say, foo... I can still execute it with: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ./foo (ld-linux-x86-64.so.2 ...
  • 221
1 vote
2 answers
523 views

ImportError /usr/lib64/libQt5Core.so.5 - in several software packages

Working with Fedora 35: I want to run a few different software packages that share a dependency, seemingly Qt. In the shell, I get this response, from Cadence and other software: ImportError: /...
  • 1,465
7 votes
3 answers
1k views

LD_PRELOAD for setuid binary

I'm trying to override malloc/free functions for the program, that requires setuid/setgid permissions. I use the LD_PRELOAD variable for this purpose. According to the ld documentation, I need to put ...
  • 107
0 votes
0 answers
26 views

Failed to Build Code in Container

I have a codebase successfully built in Linux SUSE with CUDA 11.4. The same codebase failed to build as it was bound to a container (image built with singularity) with a different Linux distribution (...
  • 167
1 vote
1 answer
148 views

Linker error by g++ when compiling to stdout

Let's say I have a C++ file called dummy.cpp, and I need to compile it with g++ in such a way that it's being from stdin and g++ spits the compiled binary out to stdout. If only the stdin part is ...
  • 113
1 vote
0 answers
45 views

How to run multiple versions of sudo?

My machine runs a patched version of Sudo version 1.8.21p2 and I need to also have the unpatched version. After getting the code from Github (the unpatched one), running ./configure, and then make I ...
  • 279
0 votes
0 answers
185 views

Shared library fetching fails if LD_LIBRARY_PATH isn't exported

By looking at /etc/ld.so.conf.d there is a libc.conf file that point to /usr/local/lib that contains the .so file necessary to run my application correctly. Even running ldconfig -v it is showed that ...
1 vote
0 answers
139 views

Why pgrep hangs when clang AddressSanitizer library is preloaded using LD_PRELOAD?

I noticed that when I set LD_PRELOAD env. variable to libclang_rt.asan-x86_64.so pgrep hangs. Why is this happening and how to avoid this? senx:/$ time pgrep anything real 0m0,022s user 0m0,...
  • 141
0 votes
1 answer
135 views

Weird linking issue with libldap using cmake

I am trying to build SimGear from the FlightGear project using the download_an_compile.sh script (which uses CMake to build the binaries). The build went fine so far, but when the script tried linking ...
0 votes
0 answers
100 views

Project links during compile but ldd shows library not found. why?

When i run through the compile process of a project, quite often i need to use a custom library compiled and stored somewhere that is not in the path. At the start of the compile, I can specify the ...
0 votes
0 answers
175 views

What is the difference between link and ld command in linux ..?

First, let tell what do I think about them:- ld ld is a GNU linker according to man page. I think, It takes an object file as input and return an executable output file. ld combines a number of object ...
0 votes
2 answers
1k views

'LD' can't find library to link, even though 'ldconfig -v' lists the file

I'm trying to install KIWI on my RaspBerry Pi. When I attempt a pip install kiwi I get a linking failure, with /usr/lib64/gcc/aarch64-suse-linux/10/../../../../aarch64-suse-linux/bin/ld: cannot find -...
  • 103
2 votes
0 answers
784 views

Which library is producing this error: undefined reference to `TIFFTileRowSize@LIBTIFF_4.0'?

I'm building Ignition (https://ignitionrobotics.org/home) from source on Ubuntu 18.04.5 with gcc-10.1.0, and it seems that some dependencies are missing or have wrong versions. Here are linker errors ...
1 vote
0 answers
66 views

Linking an assembly program

I'm trying to compile and link an assembly program. assembly file (main.asm): .section .text .global main main: mov $msg, %rdi call printf xor %rax, %rax mov $80, %rdi syscall ...
  • 203
1 vote
1 answer
4k views

CentOS 8 - /usr/bin/ld: cannot find -lnsl

I am working on a new CentOS 8 server to replace an aging CentOS 6 server. Most everything is working and I am having the primary users test out everything they use the server for. Many errors have ...
-1 votes
1 answer
140 views

Trying to compile X Window System and getting errors that I don't know

I have double-checked that I have every dependency to build X and that they are all at the latest version. I'm not even sure where to begin with these errors, so I was hoping someone here could help ...
  • 33
3 votes
1 answer
716 views

Is it possible to use lazy dynamic linking on Linux?

On UNIX, I may use a commandline like: cc -o executable *.o -zlazyload -lsomelib with the result that the libraries listed to the right of -zlazyload are marked with the LAZYLOAD ELF tag in the ...
  • 18.3k
-4 votes
2 answers
1k views

What is the linker and what is the loader in dynamic linking?

CSAPP (3ed) says in p733 that 7.9 Loading Executable Object Files To run an executable object file prog, we can type its name to the Linux shell’s command line: linux> ./prog Since prog does not ...
  • 92.7k
0 votes
1 answer
580 views

Does `dlopen()` performs dynamic linking by invoking dynamic linker `ld-linux.so`?

CSAPP says Linux systems provide a simple interface to the dynamic linker that allows application programs to load and link shared libraries at run time. #include <dlfcn.h> void *dlopen(const ...
  • 92.7k
0 votes
1 answer
1k views

dnf broken by installation - how does /usr/lib64 get on the search path and why isn't it earlier?

After installing the an RPM on centos8 I found that the package manager dnf - inexplicably stopped working with a cryptic error: Traceback (most recent call last): File "/usr/lib64/python3.6/site-...
1 vote
1 answer
70 views

pyspotify compilation ld error

I'm trying to install mopidy-spotify on my freebox delta that allow me to install vm and is arm64 based After many problems, i've manage to get most of the dependencies working and to get rid of most ...
  • 13
2 votes
1 answer
889 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
2 answers
217 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 ...
3 votes
1 answer
417 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 /...
  • 33
1 vote
1 answer
226 views

ldconfig creating links with strange names after patching libraries with patchelf?

I am patching several libraries on my development server to remove unneeded dependencies using the patchelf tool. These get packaged into an RPM and installed on my runtime system. After the install, ...
  • 111
0 votes
0 answers
3k views

Why gdb can't find my shared object library?

Please IGNORE my post. I must have been the 1000000th person to discover that gdb resets LD_LIBRARY_PATH. Sorry if you have wasted some of your time! For the record, the solution is not to say ...
0 votes
2 answers
463 views

Operation not permitted - libwine.so.1

I run Fedora 30 on my laptop. Yesterday I tried to install wine using the following commands: $ sudo dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/30/winehq.repo $ sudo dnf -...
0 votes
1 answer
972 views

Cannot execute ld : error 126

I have f30 installed 3 weeks and I keep seeing this error when I try to compile C++ of maybe fortran code. It is an error connected to ld : error: ld returned 126 exit status I've tried to look into ...
  • 435
1 vote
1 answer
6k 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
0 answers
162 views

ld can't find MKL library after adding it to ld.so.conf.d

I'm trying to link a a library, libmkl_rt.so, while compiling Julia in Fedora 30. The library is located in /opt/intel/compilers_and_libraries_2019.4.243/linux/mkl/lib/intel64_lin/. Running ld -...
  • 184
5 votes
3 answers
1k 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 ...
's user avatar
0 votes
1 answer
398 views

Is loader for a particular "executable format" configurable in Linux?

This question is in continuation of How does compiler lay out code in memory, which is posted at stack-overflow. I have few questions with respect to ld (GNU) utility available in Linux. Whenever ...
17 votes
1 answer
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 ...
0 votes
0 answers
205 views

GNU Linker Colorization

Compiling code with GCC or Clang can result in some colorful error outputs. Linking code, however, doesn't enjoy the same luxury. It seems like the GNU Linker doesn't support colorized error output ...
  • 9
1 vote
1 answer
699 views

How to install libpq.so.4.x on Debian 9

I try to compil from source PHP5.3.29 on Debian 9. The make command stopped in error at this step LDFLAGS="-Wl,-rpath=/opt/OpenSSL/openssl-1.0.1u/lib,-rpath=/opt/CURL/curl-7.26.0/lib" make .../... (...
  • 1,340
2 votes
1 answer
323 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-...
  • 21
2 votes
2 answers
1k 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 ...
6 votes
1 answer
2k 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 ...
0 votes
1 answer
1k views

Linking with GCC doesn't detect -fPIC flag

I am trying to link some files. Here is my command: gcc -T linker.ld -o Stack\ Berry.bin -ffreestanding -O2 -nostlib kernel.o boot.o -fPIC -lgcc How ever, I get this error: /usr/bin/ld: boot.o: ...
5 votes
2 answers
21k 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 ...
  • 489
2 votes
0 answers
293 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/...
  • 121
0 votes
1 answer
887 views

Filter out command line options before passing to a program

I am running cmake and it is passing a flag to my linker that is unrecognized (-rdynamic), and it's causing an error. I cannot figure out where it is getting this flag from, so I want to just filter ...
  • 103
2 votes
1 answer
3k 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/...
  • 4,049