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
0 answers

CMake execute archiver for each object separately

I want to create a library with a archiver (from arduino, esp8266) in cmake. add_library(arduino_core STATIC ${CORE_ASM_ITEMS} ${CORE_C_ITEMS} ${CORE_CXX_ITEMS}) These options I have set, specially the CMAKE_AR set(CMAKE_C_COMPILER…
A. Berisha
  • 148
  • 4
0
votes
0 answers

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 dependency on the boost to be carried by the…
Dinesh Gowda
  • 1,044
  • 3
  • 13
  • 29
0
votes
1 answer

Unable to identify issue GNU archiver. Compiling with *.o works but libname.a dosen't

I'm trying to make a static library (.a) but facing issues that I'm unable to understand. So in brief compiling with *.o succeeds but archiving them using ar and then using the .a file to compile gives me an undefined reference to 'symbol' error. So…
Joe Men
  • 3
  • 1
0
votes
0 answers

While building rocket-tools dir (in Rocket Chip setup), getting "ar: illegal option combination" Error

I am new to Rocket chip and trying to install rocket chip and execute simulation but while Creating rocket tool dir in Rocket chip setup as per README.md file, I am getting following error: ar: illegal option combination for -r usage: ar -d…
0
votes
0 answers

When I compiling llvm, /usr/local/bin/ar has too many threads, taking up too much memory

My computer: 4G memory + 4G swap My cmake parameter: cmake -G "Ninja" \ -DCMAKE_C_COMPILER=/usr/local/bin/gcc-8.3.0 \ -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-8.3.0 \ -DCMAKE_INSTALL_PREFIX=/usr/local/llvm-7.0.1…
RivenNero
  • 1
  • 3
0
votes
1 answer

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=medium.
defoe
  • 369
  • 2
  • 14
0
votes
1 answer

Can compile and link use different compilers when cross-compile?

I'd like to know if I can use different compilers for compile and link. For example ,I have two files ,a.c and b.c, I use clang to compile a.c and b.c: clang -c a.c -o a.o clang -c b.c -o b.o and then use gcc to link the two .o file as a so…
Harlan Chen
  • 321
  • 5
  • 20
0
votes
0 answers

Cygwin ar requires elevation

I am using Eclipse Oxygen.2 Release (4.7.2) x64, Cygwin 2.9.0 x64 on Windows 7 Enterprise x64 (I'm at work). When trying to compile a simple hello-world project all works fine, so having verified that the Cygwin toolchain is working, I deleted the…
nurchi
  • 770
  • 11
  • 24
0
votes
1 answer

"ar" tool allows creation of an empty library

The classical "ar" tool from Binutils does not fail if some library specified in the command line does not exist. It shows only the message "ar: <_library_name_>.a: No such file or directory", but the return code is zero. This makes sometimes very…
Alexander Samoylov
  • 2,358
  • 2
  • 25
  • 28
0
votes
1 answer

Does the dash prefix have any effect on the behavior of `ar`?

In the man page for the ar utility, I see the following line. If you wish, you may begin the first command-line argument with a dash. However, there is no further mention of the dash anywhere else in the man page. Since I have seen ar commands…
merlin2011
  • 71,677
  • 44
  • 195
  • 329
0
votes
1 answer

What's the difference between these two ar commands

What's the difference between: ar -x liba.a ar -x libb.a ar rcs libab.a *.o and ar rcs libab.a liba.a libb.a Are they really doing the same task?
user6098939
0
votes
1 answer

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 (below) have already been jumped through, to get it to…
zyndor
  • 1,418
  • 3
  • 20
  • 36
0
votes
0 answers

using "ar" put .o files into static library

The platform is mac osx, and the library's platform is arm64. I have a static library which name is arm64.a. Using ar -x arm64.a, I got some .o files. And then I used ar rcs libarm64.a *.o, trying put all .o files into libarm64.a. However, arm64.a…
Scy
  • 488
  • 3
  • 11
0
votes
0 answers

OSX Fatal error when compiling open source libraries

I get the following error on two different open source projects that I'm attempting to compile on OSX (Happens whether I target iOS or OSX). The error isn't very helpful and doesn't appear to exist any more information about it. ./configure runs…
Josh Mackey
  • 233
  • 2
  • 10
0
votes
1 answer

How do I tell `gar` or `ar` to output `elf32-i386` output?

When I look at the help output from gar -h, it tells me: [...] gar: supported targets: elf64-x86-64 elf32-i386 a.out-i386-linux [...] How can I instruct gar to create an elf32-i386 output?
Ross Rogers
  • 23,523
  • 27
  • 108
  • 164