Questions tagged [static-linking]

A static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, producing an object file and a stand-alone executable. This executable and the process of compiling it are both known as a static build of the program.

1772 questions
0
votes
1 answer

Is it possible to artificially induce object file extraction for a given static library?

I was recently reading this answer and noticed that it seems inconvenient for users to have to link static libraries in the correct order. Is there some flag or #pragma I can pass to gcc when compiling my library so that my library's object files…
merlin2011
  • 71,677
  • 44
  • 195
  • 329
0
votes
1 answer

Segmentation Fault program compiled into shared library but not static

This may be a somewhat meta question as I think my issue stems from a lack of knowledge about shared vs static libraries. I'm working on a server/client system using infiniband as a learning exercise/prepping for an upcoming work program. Originally…
0
votes
0 answers

Static Compilation with gcc openmp

I am attempting to compile me@e:~/Dir$ gcc -O4 -o new new.c -Wall -pedantic -std=gnu11 -lm -fopenmp -static which gives a warning /usr/lib/gcc/x86_64-linux-gnu/5/libgomp.a(target.o): In function `gomp_target_init': (.text+0xba): warning: Using…
con
  • 5,767
  • 8
  • 33
  • 62
0
votes
1 answer

Linking error: templated friend operator overload

I am having a strange linking error. I followed instructions presented here to avoid this kind of problems, but I can't figure out how to split headers and implementation files. Here's my test file: #include #include #include…
Rizo
  • 3,003
  • 5
  • 34
  • 49
0
votes
2 answers

How to have static linkage in a shared library in Qt Creator?

The question says all the thing. I am using Qt Creator, which uses QMake and I want to build a .so shared library file that has all its dependencies statically linked. Like libstdc++, and etc. But when I use CONFIG += static it also changes the…
Matin Lotfaliee
  • 1,745
  • 2
  • 21
  • 43
0
votes
1 answer

g++ link an .a file and its dependencies into a static .so

I have a libSomelib.a that can be linked to an executable by the following command: g++ -L. -lsomeLib -lpcrecpp -lpcre -lpthread main.cpp -o main But how could I link a shared object from it, that contains all depentencies? I want to achieve the…
deadbeef
  • 33
  • 1
  • 9
0
votes
0 answers

Preventing gcc from stripping off useful libraries

I'm using boost 1.60 and noticed a weird thing while compiling my project.. I compiled boost statically and used it into my static slib project. The static library uses boost::log for debugging all over. Then I included and linked this slib into an…
TesterPen
  • 1
  • 1
0
votes
1 answer

Failed to create a custom TCL interpreter with TclPro1.4: undefined reference to `__ctype_b'

I am trying to create a custom TCL interpreter with TclPro according instructions at TclPro User's Guide Chapter 7, but it fails with linking error undefined reference to __ctype_b. I have downloaded and installed TclPro 1.4 at…
Vahagn
  • 4,670
  • 9
  • 43
  • 72
0
votes
1 answer

How do I statically link SDL on Windows with MinGW?

See title. I'm using Code::Blocks. Googling results in info involving the sdl-config sh script, which I obviously can't use on Windows.
Dataflashsabot
  • 1,369
  • 5
  • 19
  • 24
0
votes
1 answer

The enums does not get passed to TCL when we have SWIG TCL Static Linking

In continuation to question how to pass enum values from TCL script to C++ class using Swig I have following code 1) File : example.i %module example %{ /* Put header files here or function declarations like below */ #include…
TechEnthusiast
  • 273
  • 4
  • 18
0
votes
0 answers

Static linking Qt - linux - standalone app

I was searching about this for a couple of days and have not found the way to do it right. I want to make standalone app on linux. It seems that static linking is the best solution, but how to make Qt static? If there is any link how to do it step…
iTwo
  • 45
  • 1
  • 7
0
votes
1 answer

Calling read syscall from assembly (x86/64) yields segmentation fault (compiler construction)

I am building a compiler for a C-like language, and i'm trying to link a basic "void readString(int, char*)" function implemented in assembly, with assembly generated by my compiler. The compiled c-like file is void main () { char t[20]; …
0
votes
1 answer

Strange 'missing import symbols' in static lib when using std::unique_ptr

Feel free to edit the title: I honestly dont know what is the important info for this question... I am seeing some very strange missing symbols when linking an app (built against gRPC and Kinect10 SDK, ptr type is defined in gRPC static lib if that…
FrozenKiwi
  • 1,362
  • 13
  • 26
0
votes
1 answer

How can I compile SDL2 and GLEW applications statically on Linux?

I am attempting to compile an OpenGl application that uses SDL2 and GLEW in such a way that it will run on any version of Linux it may find itself -- not just where it was originally compiled. To do this, I have tried several things none of which…
john01dav
  • 1,842
  • 1
  • 21
  • 40
0
votes
1 answer

Linking error when linking static libraries of QtCore.a

I have a file 1) File myStubs.cpp #include #include void* qMalloc(size_t sz) {return malloc(sz);} void qFree(void* ptr) {free(ptr);} void* qRealloc(void* ptr, size_t sz) {return…
TechEnthusiast
  • 273
  • 4
  • 18
1 2 3
99
100