NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Linux ar command: Busybox ar or gcc-ar with arg list too long issues?

Solved!
Go to solution

My makefile uses Linux "ar" and I can't get it to work.

If I use the default ar (Busybox)

/usr/bin/ar x86_64-obj/libxos.a x86_64-obj/DirApi.o

/usr/bin/ar: invalid option -- '8'

BusyBox v1.22.1 (2015-05-14 16:32:23 CDT) multi-call binary.

Usage: ar [-o] [-v] [-p] [-t] [-x] ARCHIVE FILES

Extract or list FILES from an ar archive

        -o      Preserve original dates

        -p      Extract to stdout

        -t      List

        -x      Extract

        -v      Verbose

I am trying to create the archive (not my makefile but that looks right to me) not extract or list files.

If I symlink to gcc-ar (found two ar commands using ls /usr/bin/*ar )

gcc-ar: error trying to exec 'ar': execvp: Argument list too long

One doesn't make archives, the other has issues.

How should I make a .a file?

0 Kudos
Message 1 of 5
(6,157 Views)

Try running

     ar cr x86_64-obj/libxos.a x86_64-obj/DirApi.o

0 Kudos
Message 2 of 5
(5,297 Views)

Apparently there is no "r" nor a "c" option on my machine. Is it possible that I do not have right version of "ar" installed?

0 Kudos
Message 3 of 5
(5,297 Views)
Solution
Accepted by topic author tpc1095

/usr/bin/arm-nilrt-linux-gnueabi-ar has it on my machine. Verify that /usr/bin/ar points to it or run it using the full path.

0 Kudos
Message 4 of 5
(5,297 Views)

Thanks, that pointed the way. I succeeded in building my .a file.

I did something just like this for the 9033 which is Intel (not ARM)

/usr/bin/ar -> /usr/x86_64-nilrt-linux/bin/ar

It also helped to hunt down the "ar" command in the makefile. the one I inherited is replete with pointless indirection and redefinition. I ended up using

make  MAKE_VERVBOSE=1  SHELL="/bin/bash -x" -d  target

to prove that it was getting the right switches (it wasn't)

There are a handful of other commands in that x86 directory. I'll keep those in mind in case something else isn't working.

0 Kudos
Message 5 of 5
(5,297 Views)