The ld (linker or loader) program combines object files, archive files and (references from) shared libraries, relocates their data and addresses together with symbol references. Linking is usually the final step of compiling a program.
Questions tagged [ld]
2795 questions
1
vote
1 answer
ld: How this ld script works?
In his article about understanding the Linux Kernel Initcall Mechanism, Trevor created a userspace program that simulates the mechanism for calling the init_module() of linux drivers.
#include
typedef int (*initcall_t)(void);
extern…

Baroudi Safwen
- 803
- 6
- 17
1
vote
1 answer
ld cannot find -luuid
Attempting to cross-compile with Cmake using a toolchain file I've written for a mips processor. At 22% I get this error:
/usr/local/mipsisa32r2el/r23/bin/ld: cannot find -luuid
Is it LD that is missing a library? Is it possible to rectify when…

Kagemand Andersen
- 1,470
- 2
- 16
- 30
1
vote
1 answer
Cannot install autotest-fsevent or rs-fsevent; getting ld error but xcode is installed
Here's what I'm getting:
$ sudo gem install autotest-fsevent
Password: Building native extensions.
This could take a while... ERROR:
Error installing autotest-fsevent:
ERROR: Failed to build gem native
…

Ross R
- 387
- 1
- 5
- 21
1
vote
2 answers
Why does changing the linking order fix some linking errors on one system?
So I had this strange behavior with GitLab CI. I got it working but now I am wondering why it works.
First of all I was starting with GitLab CI. I got a local runner with docker on my machine (Arch Linux), so that I can test without pushing and…

Phillipp Mevenkamp
- 110
- 7
1
vote
2 answers
When creating a shared library, how to tell the linker that a symbol is in the executable?
I'm creating a an apache module which is basically a shared library (not in C, but in rust, so I can't use the usual apache tooling that hides all this stuff).
When I go to link, ld is telling me there's a bunch of undefined symbols. These symbols…

marathon
- 7,881
- 17
- 74
- 137
1
vote
1 answer
ld cannot find library even though ldconfig does (rust-sciter)
I'm attempting to run the rust-sciter minimal example however the run command cargo run --example minimal is telling me the library -lsciter-gtk-64 cannot be found.
However when I check ldconfig -p | grep sciter it returns just fine…

Liam Martens
- 731
- 7
- 22
1
vote
1 answer
Linker can't find mathgl library
I try to make mathgl work, but the linker can't find the library. I installed it through the user repository from arch linux.
I just copied the example program:
#include
int main()
{
mglGraph gr;
gr.FPlot("sin(pi*x)");
…

Natjo
- 2,005
- 29
- 75
1
vote
1 answer
How to set up a mature building process for my C program that uses a third-party library (APR - Apache Portability Runtime)
I have written a C program that consists of a number of files, and uses APR (http://apr.apache.org) - it includes its headers and I would prefer dynamic linking of its libraries.
My problem is that currently I hard-code both the paths to APR headers…

Armen Michaeli
- 8,625
- 8
- 58
- 95
1
vote
1 answer
How to make fake proxy Import library
I remember finding *.a library that doesn't contain any object but instead a list libraries (as a plain text?), something like: -liconv -lm
So that when gcc encounter it, both library will be searched for linking.
Is there such trick? pretty sure it…

olddog55
- 13
- 2
1
vote
1 answer
Which data bus is used after physical remap to RAM in STM32F4?
STM32F4 controllers (with ARM Cortex M4 CPU) allow a so called physical remap of the lowest addresses in the memory space (0x00000000 to 0x03FFFFFF) using the SYSCFG_MEMRMP register. What I do understand is that the register selects which memory…

Alexander
- 1,068
- 6
- 22
1
vote
1 answer
How do I fix an undefined reference to `nettle_sha256_digest`?
TL;DR
I'm attempting to build a go project that uses this dependency: https://github.com/mqu/openldap, which in turn externally links lldap and llber libraries, which in turn uses lgnutls, which uses lnettle, which is where I'm stuck.
The go build…

erstaples
- 1,986
- 16
- 31
1
vote
0 answers
make fails when trying to compile libmtp
I have tried to install a newer version of libmtp on my kubuntu.
But I did not succeed with these versions: 1.1.12, 1.1.13, 1.1.14.
I have downloaded the sources from here:
https://sourceforge.net/projects/libmtp/files/libmtp/
Then:
- unpack
-…

Leon
- 67
- 1
- 9
1
vote
1 answer
riscv/gcc/ld - "Undefined reference to printf" using own script to link
Currently, I'm learning RISC-V, use the RISC-V toolchain, and edit a new ld script for my embedded. I write a example, and compile to watch the opcode.
Example:
#include //float.c
int main()
{
float a=1.04;
printf("a=%f\n",a);
return…

Owen
- 41
- 7
1
vote
2 answers
LD_PRELOAD and linkage
I have this small testcode atfork_demo.c:
#include
#include
void hello_from_fork_prepare() {
printf("Hello from atfork prepare.\n");
fflush(stdout);
}
void register_hello_from_fork_prepare() {
…

Albert
- 65,406
- 61
- 242
- 386
1
vote
2 answers
ld cannot load library despite symlink existing
I am trying to compile a program that requires SFML 2.41+. Ubuntu 16.04's repos don't have a new enough version so I installed SFML 2.4.2 by following the (somewhat sparse) instructions on this page. Specifically I dowloaded the Linux version from…

Ryan1729
- 940
- 7
- 25