All Questions
17
questions
0
votes
1
answer
955
views
How to update shared library file
I'm trying to add a .lo object file compiled through libtool with clang into a shared library file.
$ libtool --tag=CC --mode=compile clang -c newobject.c -shared
Is there an equivalent command to
$...
-1
votes
1
answer
164
views
Why does the linker complain “file was built for archive which is not the architecture being linked” when the architecture is correct?
When trying to build a binary (see MWE below) that links a static library using clang I am getting the following error message:
⟩⟩⟩ clang -o test bar.a test.o
ld: warning: ignoring file bar.a, file ...
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 ...
0
votes
1
answer
486
views
Visual Studio Android building assembly files into app
We've got a Visual Studio Android solution with (among others) a static library project that contains functionality implemented in assembly. Like:
my.S -> libMine.a -> libMyApp.so
Some hoops (...
1
vote
1
answer
78
views
How to detect library order for one pass linker?
Is there a tool that will analyze a large group of static archives, and order them for input to a one pass linker?
0
votes
0
answers
868
views
Generate library from ELF file
I'm trying to generate a static library from a compiled ELF file.
Previously, I've been able to generate the library by compiling my source code to object files, then passing those objects to avr-ar ...
0
votes
2
answers
215
views
FreeBSD-10/gcc48 ar command incredibly slow
I upgraded a server to FreeBSD-10/gcc48, and my project, which uses ar to put subprojects into static libraries, now links outrageously slowly.
10.0-RELEASE-p4 FreeBSD 10.0-RELEASE-p4 #0: Tue Jun 3 ...
11
votes
1
answer
9k
views
Override weak symbols in static library
I want to make a static .a library for my project from multiple sources, some of them define weak functions and others implements them. Let's say as example I have :
lib1.c :
void defaultHandler()
{
...
12
votes
2
answers
2k
views
OS X linker unable to find symbols from a C file which only contains variables
I am having problems with the linker when porting a C library from Linux (Ubuntu) to OS X. The C code is auto-generated from Matlab, so ideally I don't want to change the code itself.
The problem ...
4
votes
1
answer
2k
views
Detect whether static library is a thin archive
When linking a static library as a thin archive the .o-files are not copied into the archive, but rather they are referenced with their relative path from the .a file.
How can I check if a given .a ...
0
votes
1
answer
7k
views
How can I compile a library archive with a source code file with gcc?
TL;DR - I need to compile archive.a with test.o to make an executable.
Background - I am trying to call a function in a separate library from a software package I am modifying but the function (a ...
1
vote
1
answer
3k
views
Two ways of linking to static libraries
Here are a couple of ways to use functions from a static library, built with ar (i.e. libSOMTEHING.a):
ld -o result myapp.o -Lpath/to/library -lname
ld -o result myapp.o path/to/library/libname.a
...
2
votes
2
answers
2k
views
Extracting archive file in linker script
I am trying to deal with a problem like the following one:
Assume that I have a library libxyz.a created from:
/* main.c */
int main(void)
{
int a;
}
compiled and archived with:
gcc -c main.c -o ...
0
votes
1
answer
315
views
Memory overlapping with ld and ar commands
I have linked some texts files with this command:
ld -r -b binary -o resources1.o *.txt
And I get a file resources.o with this content:
nm resources1.o
00000018 D _binary_texto4_txt_end
...
0
votes
1
answer
241
views
Is it possible to mix different versions of gcc and ld?
My environment is arm-linux-androideabi (Android 2.2 on a Toshiba AC100). I have 2 sets of GCC compilers for my environment(installed at separate locations on the device):
4.4.3 (Android NDK on ...