Skip to main content

All Questions

Tagged with
0 votes
1 answer
728 views

problem with ar, linking and undefined reference

I have a software package consisting of some 500+ fortran .f files. It is rather well organized into various subfolders, and there is one high level compile script which calls the various Makefile's ...
ron's user avatar
  • 967
1 vote
1 answer
1k views

How to create one static library from several others static libraries in C on Linux? [duplicate]

For example, we have three following libraries: 1.1.......................lib_A.a 1.2.......................lib_B.a 1.3.......................lib_C.a Now I want to create one library ...
Amish Sharma's user avatar
6 votes
1 answer
6k views

Multiple definition within static library

I have a question that is very closely related to Linker does not emit multiple definition error when same symbol coexists in object file and static library, but concerns a slightly different ...
DerAuenlaender's user avatar
0 votes
0 answers
256 views

Different ways to generate a shared library

I have a source code which depends on some boost libraries like filesystem, system, datetime. I want to create a shared library(libapi.so). Since this so will be given to clients, I don't want a ...
Dinesh Gowda's user avatar
  • 1,104
0 votes
1 answer
2k views

How to split large .a static library?

Is there a possibility to split large .a files into multiple smaller ones? I'm currently having an issue with a .a file being multiple GiB large and GCC raises an error even with the flag -mcmodel=...
defoe's user avatar
  • 369
5 votes
2 answers
4k views

CMake append objects from different CMakeLists.txt into one library

I would like to create a single library from objects from multiple sub-directories, each one containing their own CMakeLists.txt with OBJECT library trick to have multiple targets with different ...
Rakib's user avatar
  • 801
3 votes
1 answer
3k views

How to take only required object files inside a single (.a) archive

Just a simple question but I couldn’t found the answer anywhere. When putting all object files in archive, how to instruct clang++ to only take required objects file for linking in order to avoid ...
user2284570's user avatar
  • 3,013
45 votes
1 answer
17k views

what is the difference between ranlib, ar, and ld for making libraries

To make libraries in c++/unix from *.o files, I have noticed two different ways in my project (legacy code): ar qc libgraphics.a *.o ranlib libgraphics.a and ld -r -o libgraphics.a *.o What is the ...
R71's user avatar
  • 4,453
2 votes
1 answer
1k views

ar on MSYS2 shell receives truncated paths when called from Makefile?

I'm using git-bash.exe from a PortableGit install, with environment variables from a different MinGW. So I have: WORKGROUP+user@AD-X MINGW32 /z/user/Downloads $ which ar //WORKGROUP.EX.COM/Users/user/...
sdaau's user avatar
  • 38.2k
3 votes
1 answer
688 views

Object files not properly added to archive on mac

I am trying to build an archive from a collection of object files. I am doing this with ar -rs my_archive.a foo.o bar.o other_object_files.o. On a linux machine everything is fine but when I try the ...
Manfredo's user avatar
  • 1,730
2 votes
1 answer
1k views

gcc archives not considered when linking?

Should it make a difference whether a gcc linker links archive files or object files (or both)? Background: In an embedded project, an ISR (which is of course not referenced by any other source code)...
mic's user avatar
  • 235
0 votes
1 answer
370 views

link a library I wrote with pthread library

This is actually part of an assignment. Basically, we need to write a library, which will be linked against test programs the professor writes, like so: gcc -o libexample.o -c libexample.c ar rvs ...
Einheri's user avatar
  • 977
7 votes
2 answers
5k views

Do I need "ranlib" / "ar -s" for static linking?

I did not find any proper information if and why I need ranlib / ar -s for static linking. Assume I have an application that consists of multiple modules. Each module has its code files in its own ...
Kijewski's user avatar
  • 25.8k
2 votes
1 answer
1k views

basic use of C archives (libraries) with clang linker

I have a main program: #include <stdio.h> extern int a; int main (int argc, char ** argv) { int i; printf ("Hello %p, %p\n", & i, & a); return 0; } and a separate file, foo....
Reb.Cabin's user avatar
  • 5,517
1 vote
1 answer
427 views

trouble compiling against static library

I have created a static library, libstuff.a, with gcc and ar. I've installed the library in /custom/lib/dir/ and the header files in /custom/include/dir/. When I try to compile another application ...
Josh's user avatar
  • 1,674

15 30 50 per page