Questions tagged [linker]
The linker is part of the toolchain for producing executables from source code written in compiled programming languages. It takes compiled object code in multiple files and produces a single, "linked", executable file from them.
13,284
questions
0
votes
0
answers
7
views
Has anyone tried to statically link the Postgres client libs into a project?
I'm using Embarcadero® C++Builder 11 Version 28.0.44940.9541. Windows 11.
I am building a 32 bit client, using FireDac, for a customer that is using Postgres. I've tried dropping the actual PG 32 ...
0
votes
0
answers
14
views
RISC-V linker allows multiple definitions
I am trying to replicate the behavior of the GNU linker with the PROVIDE keyword mentioned here.
The compiler I'm using is riscv32-unknown-elf-gcc version 11.1.0.
I created a little project that is ...
0
votes
0
answers
5
views
Is it necessary to include linker commands in CodeChecher?
Previously, I asked and received advice on invoking Clang Static Analyzer for doing cross-translation-unit analysis. But this is now a separate issue.
What I want to ask here, do I need to include ...
1
vote
1
answer
21
views
patchelf set interpreter to a path relative to executable
I have tried to do this:
patchelf --set-interpreter ../lib/ld-linux-x86-64.so.2 "${APPDIR}/usr/bin/myapp"
so I have this:
readelf -l AppDir/usr/bin/myapp
...
[Requesting program interpreter:...
1
vote
1
answer
30
views
Setting RPATH of Static Library in Executable
I have the following setup for my CMake project:
add_executable(exeA ${SOURCES})
target_link_libraries(exeA PRIVATE libB)
libB is a static library built separately in a different project and depends ...
0
votes
0
answers
8
views
GCC Linker unexpectedly moves location counter backwards
I am developing new RTEMS BSP and I am modifying linker scripts
I modified this linker script file
.rwbarrier : ALIGN_WITH_INPUT {
. = ALIGN (bsp_section_rwbarrier_align);
} > ...
0
votes
1
answer
17
views
Compiler can't find SDL2 classes. How to properly include and link them?
I just started venturing into C++. I download this simple helicopter game and I'm trying to compile it, but I don't know how to properly include and link the SDL2 dependencies.
My first approach was ...
0
votes
1
answer
43
views
VS2022 "lld-link : error : could not open 'oldnames.lib': no such file or directory"
Just installed Windows 10 and VS2022, created an empty project, set compiler to Clang, compiled and I get these errors:
1>lld-link : error : could not open 'msvcrtd.lib': no such file or directory
...
0
votes
1
answer
16
views
Windows linking to libxml2.lib file, but cant find external symbols
I have built libxml2.dll with the latest 2.9.14 source. I was successful in creating the .dll and .lib files. I have linked the .lib file to my project, but when it comes to compile time, it doesn't ...
1
vote
1
answer
33
views
Can scan-build or Clang static analyzer discover problems at link time?
While revisiting some codes I've written, I noticed that the build commands in the test scripts did not correctly invoke the scan-build command. The formation of a revision is ready, but I have some ...
0
votes
0
answers
23
views
ffmpeg Undefined referance to several swr functions [duplicate]
I'm trying to staticly link ffmpeg to my project, i downloaded the ffmpeg source files from a github repo because it had pre writen cmake files, which i needed for this exact problem but it changed ...
0
votes
1
answer
29
views
ARM Linker error message "no source files - nothing to do", does not find existing symbols in library?
I am using a TMSp320F2888D from TI which feature an ARM Cortex processor. For some reason I am unable to build my project in Eclipse anymore even after resetting my code to an earlier commit.
When I ...
1
vote
3
answers
46
views
How would one implement a standard library for a language they've developed?
So for example I have a brand spanking new compiled language in my hands and no standard library. I want to implement a malloc function for this language. An approach that came to my mind is to write ...
0
votes
1
answer
33
views
ld finds library when run stand along but cant find when building executable
I am trying to build a program that requires the linking of libndctl. However, ld fails to find the library, and the build errors out at the linking stage stating (this used to build without error ...
0
votes
2
answers
35
views
C++ Linking error using libraries libsumo, libtraci, undefined reference to libtraci::Simulation::init()
I have a question regarding correctly linking libraries libsumocpp and libtracicpp in Windows.
I'm trying to connect to a sumo server using libsumo in C++ and have the following code:
#include <...
1
vote
1
answer
24
views
Binding a plain binary file in to an excecutable
The following question isn't related to an actual problem but what I just was curious about:
How can I link a whole file with an executable and get the starting address and size of that block at ...
1
vote
1
answer
34
views
How to link a subfolder with gcc in C?
I have the below tree:
├── cminpack
│ ├── hybrd.c
│ ├── hybrd.o
│ ├── hybrj1.c
│ ├── hybrj1.o
│ ├── hybrj.c
│ ├── hybrj.o
│ ├── libminpack.a
│ ├── Makefile
│ ├── minpack.h
│ ├── ...
0
votes
1
answer
28
views
Cannot compile and link on MacOS, code is without error - only including stdio.h & "my_header.h"
I am a bit new to programming. I started following this tutorial which has this code to complete some sudoku puzzle. I am using vim and YCM which displays most errors and problems in the code - of ...
1
vote
0
answers
29
views
clang support for fat-lto-objects
I have a project where I use -flto=thin for my main targets, but I don't want to apply LTO to my tests since it slows compilation down (full context: lld runs LTO even if -fno-lto is passed).
As it is ...
0
votes
0
answers
28
views
libxl Library VS Code Setup
I've tried to use libxl library but there is no installation document for vs code even if I try to add header files there is an error message "no such file or directory"
I also set settings ...
-2
votes
0
answers
24
views
How to includue multiple .cpp files into one main file [duplicate]
now in real world when building projects we use hunderends of .cpp files and we link them into one main.cpp file.
Main.cpp
#include <iostream>
#include <function>
int main()
{
print(&...
0
votes
0
answers
7
views
Cross-Compiling Library for Android with OpenSSL Dependencies
I'm working on a project, where I have a lot of C code that is supposed to run in Android.
My code depends on three libraries: AMCL, OpenSSL, and IBMTSS.
I was able to compile AMCL and OpenSSL to ...
0
votes
1
answer
80
views
Windows 10 error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
I am struggling to fix error: linking with 'x86_64-w64-mingw32-gcc; failed: exit code: 1, I have installed TDM-GCC-64 and Cygwin and added them to PATH as well as updating the c++ 2019 redistributable....
0
votes
2
answers
54
views
How can I make sure `iostream` is available to the linker?
I have the following C++ code in a file called helloworld.cpp:
#include<iostream>
int main()
{
std::cout << "Hello, World!\n";
}
I would like to compile this manually so I ...
0
votes
0
answers
15
views
Using a Win32 DLL in a UWP App - linking issue
I followed Using a Win32 DLL in a UWP App recipe, but I'm getting linking errors, like:
LNK2019 unresolved external symbol "public: int __cdecl Giraffe::GetID(void)" (?GetID@Giraffe@@QEAAHXZ)...
0
votes
0
answers
26
views
"undefined reference to" compile error for class implementation [duplicate]
I have implementation for two classes in four different files (separate .cpp/.cu and .h for each). The problem is that when I compile the code using this command:
$ nvcc -lcuda -lineinfo -o test -I ...
0
votes
1
answer
15
views
calls to syslog() replaced with __syslog_chk()?
I am trying to use LD_PRELOAD to intercept calls to syslog(). I could successfully try that on one of my program and it worked.
When I tried it on a pre-built application (came via a Debian package), ...
-1
votes
0
answers
19
views
Why my variable rise link error? C++ LINK2005 [duplicate]
ini.h
#pragma once
extern int w = 800;
main.cpp
#include "ini.h"
int main()
{
cout<<w;
}
Error: LNK2005 "int w" (?w@@3HA) уже определен в main.obj
what is problem?
0
votes
1
answer
27
views
SDL mingw static lib linking errors
I'm trying to compile a simple SDL program using Mingw w64. Here is my code:
test.c
#include "SDL2/SDL.h"
#include <stdio.h>
int main( int argc, char* args[] )
{
SDL_Window *...
0
votes
0
answers
34
views
Linker causing seemingly random crashes?
EDIT: After some more trying and testing, it seems to set down to changing stack size everytime I change code and I want the program to run. If I don't change the stack size, the program seems to ...
2
votes
1
answer
104
views
What is the best way to solve multiple definitions introduced by a 3rd party library? [ELF and Mach-O]
Background
Imagine the situation: static library libR.a is written rust and it depends on libCXX0.a. Binary X depends on both libR.a and libCXX0.a and it is written in C++. Now we want to try ...
1
vote
1
answer
75
views
ELF file variable addresses of C structure in debug info
I have .elf file. I am trying to learn symbol address. I could find main variable addresses with many ways. I used pyelftools, nm.exe, objdump.exe, readelf.exe. But all of these ways i can't reach ...
0
votes
0
answers
40
views
Why can't this executable find this shared library? [duplicate]
I am compiling an executable on linux through conan, meson and gcc. I am inspecting the final binary:
readelf -d uproject | head -20
Dynamic section at offset 0xd4b00 contains 36 entries:
Tag ...
0
votes
1
answer
24
views
Can you relink/modify relative shared library look up paths?
I am running into the following situation. Project A has libraries A1, A2, A3... That follow their own directory structure. For example:
Libaries/
|
|--Dir1/
| |
| |--A1.so
| |--A2.so
|
|--Dir2/
| ...
0
votes
0
answers
41
views
Can I change the default linker script/flags of ld?
I am using a software, which modifies some bytes in an executable. I don't know what it does exactly, but I use it for license protection of the already built binary. To not overcomplicate things, I'm ...
0
votes
0
answers
11
views
Alexa account linking with Auth0
I’m building a vuejs SPA with an express js backend API protected by Auth0. Now I need to build an Alexa skill that accesses my protected API.
How can I configure the Alexa account linking with Auth0? ...
1
vote
1
answer
25
views
How to run an i386 .so library on an armhf system?
I need to implement a system with a third party device using a Raspberry Pi.
The device is connected using USB, and the manufacturer has provided a few software implementation demos, and the driver ...
0
votes
1
answer
22
views
LD linker script, get current position of LOAD address
In linker scripts, I can get the LMA of a section like this
.got : ALIGN(4)
{
__global_offset_table_flash_start__ = LOADADDR(.got) ;
...
} >SRAM_DTC AT>PROGRAM_FLASH
When I use
.got : ...
0
votes
1
answer
36
views
Linking C++ code to a dylib library in MacOS
I was able to setup BlockSci on MacOS High Sierra 10.13.6. The setup installed header files in /usr/local/include and a libblocksci.dylib in /usr/local/lib. The C++ code I am trying to compile is:
#...
1
vote
1
answer
50
views
How to create a portable C/C++ program on linux using additional libraries?
I need to create a portable linux program that uses a lot of additional libraries defined from yum (CentOS).
It is forbidden to install new packages on portable machines. There are no necessary ...
0
votes
1
answer
40
views
Are homebrew packages static libraries or dynamic?
I was using the SDL2 library I installed with homebrew. I was just wondering if the libraries I linked were statistic or dynamic and how to tell with these package managers.
0
votes
0
answers
36
views
How to find out how an object was linked?
I have an object file, say "a.out" compiled with gcc long time ago. How can I determine how this object file was linked? In particular, I want to know whether it was a static or dynamic ...
0
votes
0
answers
39
views
Get start and end of a section
Foreword
There already exist questions like this one, but the ones I have found so far were either specific to a given toolchain (this solution works with GCC, but not with Clang), or specific to a ...
0
votes
1
answer
19
views
g++ creates shared object with dynamic dependency even though I gave it a static archive in the inputs
I have a source file, mything.cpp, and a library that was provided to me as notmine.h and notmine.a.
I need to produce a shared object that has all my stuff from mything.cpp and all the stuff from ...
0
votes
0
answers
23
views
Static library able to link with any other object, regardless of C++ runtime used by that object
I am trying to determine if it is possible at all to create a static library that:
Internally uses Microsoft/STL, static release runtime (/MT)
Can be linked to objects not using /MT (e.g., Dynamic ...
0
votes
1
answer
33
views
gprbuild fails to include a file needed for gnatcoll
I tried to build something with GnatColl from GPS Community 2021 on Fedora 35. The linker failed, saying
ld: /path/to/common/Ada/Quoter/obj/gnatcoll-refcount.o: in function `...
1
vote
0
answers
38
views
Probleme to link my stub with newlib with arm-none-eabi-gcc
I'm trying to compile a small proof of work tath run lua code on the rasperry pi zero bare-metal.
All my object file and lua's have been compiled with similar options. I tried with and without the -...
1
vote
2
answers
98
views
How is an 'undefined symbol' error possible if shared dependencies provide that symbol?
I'm trying to compile GTK 3.24.33 from source. At some point in the build process I got the following error
Cannot load module /home/felix/apps/src/libraries/gtk-3.24.33/modules/input/im-wayland.la: /...
0
votes
1
answer
54
views
Address of a constexpr in a template parameter
Can someone solve the mystery of why do I get linking errors if I take the address of a variable that should go in a template parameter only if I make the variable const, constexpr or static, but not ...
0
votes
1
answer
30
views
Linker fails to find library - with correct searchpath
I have encountered a mysterious problem.
While having to compile some libraries for use on an Android Device, I met some linking problems between my code and OpenSSL.
I first compiled OpenSSL to ...