Questions tagged [unix-ar]

The Unix archiver utility, used primarily for maintaining static libraries. For questions about augmented reality, use [augmented-reality], not this tag.

This tag is for questions about the Unix archiver utility, commonly known as "ar". It is used to maintain groups of files as a single file, known as an archive. Today, it is primarily used to create and maintain static libraries in conjunction with a linker.

For more information on ar, see Wikipedia.

NOTE: Do not use this tag for questions about augmented reality! The tag should be used instead.

181 questions
0
votes
1 answer

How should I include variable defined with extern in c file

I am having trouble compiling the demonstration code for the STM32F4-Discovery using the arm-none-eabi toolchain. The error is occuring in linking and this is the [first] error I'm receiving. template/obj/stm32f4xx_it.o: In function…
user2027202827
  • 1,234
  • 11
  • 29
0
votes
1 answer

How to force archiver (ar) to produce archive that behaves identically to object file?

I use a rather involved approach to object allocation using a "catalog" approach. The code generates a catalog object (global static map) which is populated by base pointers, which point to derived objects. This is all blasphemous, but not the point…
doc07b5
  • 600
  • 1
  • 7
  • 18
0
votes
1 answer

How can I avoid undefined symbols when linking libraries against each other with arm-none-eabi-ar

I'm using the arm-none-eabi-gcc toolchain onlinux and am having trouble creating archives that link to other archives. As a specific example, the base archive (libstm32f4_hal.a) should have a function HAL_SPI_GetState and using nm, it seems that it…
user2027202827
  • 1,234
  • 11
  • 29
0
votes
1 answer

How can i see that ar -s works correctly?

I have some generated object files, from which I create a static library using: ar -r libmine.a *.o Afterwards I'm adding the index through: ar -s libmine.a How can compare first command with second command and what additional functions gives…
Ice
  • 1,783
  • 4
  • 26
  • 52
0
votes
1 answer

Does ar not support 64 bit on solaris x86?

My build failed with 64 bit boost on solaris x86. The reason is the ar command could not pack *.o to 64 bit static libary. Who can help it? Your comments are appreciated Below is my test: % ar rc test.a date_generators.o greg_month.o greg_weekday.o…
cathrine
  • 49
  • 1
  • 1
  • 4
0
votes
0 answers

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 to successfully create my library. In order to…
lberezy
  • 450
  • 5
  • 19
0
votes
1 answer

When installing a library is it one of `ar`, `libtool`, `ranlib`, or other which decides if it's 32 or 64bit?

Snippet from Recompiling libiconv, gettext undefined symbols occurring after an already successful install ; thought to make it its own question. Trying to use libiconv in a simple .c file: #include // works: gcc -m32…
ŽaMan
  • 396
  • 5
  • 17
0
votes
1 answer

Separately typing each library compiles, but a single static library archive fails

I'm trying to build a single library so that it can be linked easily by a single -l switch. Basically If I compile an executable and type out all the libraries my project needs like so: g++ ncorr_test.cpp -o ncorr_test -I../include…
JustinBlaber
  • 4,629
  • 2
  • 36
  • 57
0
votes
1 answer

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 libexample.a libexample.o #later gcc -o test test.c…
Einheri
  • 957
  • 1
  • 9
  • 22
0
votes
0 answers

Why is object file empty after archiving when building in parallel with GNU Make?

I have a problem with the archiver not seeming to archive the object files fully correctly every time when building in parallel. I have built the project with make -j32 If I investigate the archive: ar x mylib.a ls -l myFile.o -rw-rw-r-- 1 tester…
Euklides
  • 564
  • 1
  • 10
  • 35
0
votes
1 answer

Static lib created with ar has timestamp with resolution 1 s

I create a static lib from a single object file. The generated .a file has a timestamp with a resolution of one second (truncated to the earlier second), while the .o file does not. In effect, it makes the .a file look like it is older than the .o…
Gauthier
  • 40,309
  • 11
  • 63
  • 97
0
votes
2 answers

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 13:14:57 UTC 2014 …
JimB
  • 971
  • 8
  • 20
0
votes
0 answers

archive ffmpeg all objs into one lib, feasible?

I've build ffmpeg static libraries, generated: libavformat.a, libavcodec.a, libavutil.a, ... in their source directories, all necessary objs (*.o) generated. I use 'ar' to archive all these objs into one libffmpeg.a. command: ar rc libffmpeg.a…
yql
  • 1
  • 1
0
votes
0 answers

Msbuild for copying assemblies to a few folders of applications?

I have a VS solution that contains a few applications and public APIs to be published along with shared libraries. I have some shallow experience in crafting msbuild file like this one.
ZZZ
  • 2,752
  • 2
  • 25
  • 37
0
votes
1 answer

Function declaration in static library in C

I've a problem when I try to compile my program with my static library. I create the object file of my .c files whith gcc -c ft_putstr.c. Then I execute ar -rcs libft.a ft_putstr.o and then I make gcc main.c -L. -lft and I've warning: implicit…
sebasthug
  • 81
  • 1
  • 7