* Plus character ('+') in archive name, can't run ar in MRI mode
@ 2022-03-26 16:12 jyhgekyfbkjsyebf
2022-03-27 21:10 ` Fangrui Song
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jyhgekyfbkjsyebf @ 2022-03-26 16:12 UTC (permalink / raw)
To: binutils
Hello list,
problem: I need to combine multiple static libraries into one. Internet said that I can use ar MRI script. However, it doesn't work with archives that have a '+' character in their name, for example, script:
CREATE libfull.a
ADDLIB /usr/local/lib/libgrpc.a
ADDLIB /usr/local/lib/libgrpc++.a
SAVE
END
results in:
❯ ar -M < ../link_line
ar: /usr/local/lib/libgrpc: No such file or directory
++%
Looks like it chokes on '+' there. What do you suggest to do?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Plus character ('+') in archive name, can't run ar in MRI mode
2022-03-26 16:12 Plus character ('+') in archive name, can't run ar in MRI mode jyhgekyfbkjsyebf
@ 2022-03-27 21:10 ` Fangrui Song
[not found] ` <MWHPR1201MB0110B3A00DC640E708E9C348CB1C9@MWHPR1201MB0110.namprd12.prod.outlook.com>
2022-03-31 14:41 ` Nick Clifton
2 siblings, 0 replies; 4+ messages in thread
From: Fangrui Song @ 2022-03-27 21:10 UTC (permalink / raw)
To: jyhgekyfbkjsyebf; +Cc: binutils
On Sat, Mar 26, 2022, 09:12 jyhgekyfbkjsyebf via Binutils <
binutils@sourceware.org> wrote:
> Hello list,
>
> problem: I need to combine multiple static libraries into one. Internet
> said that I can use ar MRI script. However, it doesn't work with archives
> that have a '+' character in their name, for example, script:
>
> CREATE libfull.a
> ADDLIB /usr/local/lib/libgrpc.a
> ADDLIB /usr/local/lib/libgrpc++.a
> SAVE
> END
>
> results in:
>
> ❯ ar -M < ../link_line
> ar: /usr/local/lib/libgrpc: No such file or directory
> ++%
>
> Looks like it chokes on '+' there. What do you suggest to do?
>
Seems that + should be accepted.
Also hope someone can implement L modifier to combine archives
https://sourceware.org/bugzilla/show_bug.cgi?id=28851
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Plus character ('+') in archive name, can't run ar in MRI mode
[not found] ` <MWHPR1201MB0110B3A00DC640E708E9C348CB1C9@MWHPR1201MB0110.namprd12.prod.outlook.com>
@ 2022-03-28 8:27 ` jyhgekyfbkjsyebf
0 siblings, 0 replies; 4+ messages in thread
From: jyhgekyfbkjsyebf @ 2022-03-28 8:27 UTC (permalink / raw)
To: Fangrui Song; +Cc: binutils
On Sunday, March 27th, 2022 at 11:10 PM, Fangrui Song <i@maskray.me> wrote:
> On Sat, Mar 26, 2022, 09:12 jyhgekyfbkjsyebf via Binutils <binutils@sourceware.org> wrote:
>
> > Hello list,
> >
> > problem: I need to combine multiple static libraries into one. Internet said that I can use ar MRI script. However, it doesn't work with archives that have a '+' character in their name, for example, script:
> >
> > CREATE libfull.a
> >
> > ADDLIB /usr/local/lib/libgrpc.a
> >
> > ADDLIB /usr/local/lib/libgrpc++.a
> >
> > SAVE
> >
> > END
> >
> > results in:
> >
> > ❯ ar -M < ../link_line
> >
> > ar: /usr/local/lib/libgrpc: No such file or directory
> >
> > ++%
> >
> > Looks like it chokes on '+' there. What do you suggest to do?
>
> Seems that + should be accepted.
By that you mean that it is a problem on my side and I'm doing something wrong, or that it is supposed to work, but is a[n] [un]known bug?
> Also hope someone can implement L modifier to combine archives https://sourceware.org/bugzilla/show_bug.cgi?id=28851
Workaround for search engine: create a thin library via cqT: ar cqT result.a a1.a a2.a ... ; then convert thin to normal in MRI:
CREATE result.a
ADDLIB result.a
SAVE
END
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Plus character ('+') in archive name, can't run ar in MRI mode
2022-03-26 16:12 Plus character ('+') in archive name, can't run ar in MRI mode jyhgekyfbkjsyebf
2022-03-27 21:10 ` Fangrui Song
[not found] ` <MWHPR1201MB0110B3A00DC640E708E9C348CB1C9@MWHPR1201MB0110.namprd12.prod.outlook.com>
@ 2022-03-31 14:41 ` Nick Clifton
2 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2022-03-31 14:41 UTC (permalink / raw)
To: jyhgekyfbkjsyebf, binutils
[-- Attachment #1: Type: text/plain, Size: 980 bytes --]
Hi jyhgekyfbkjsyebf,
> problem: I need to combine multiple static libraries into one.
Do you know about thin archives ? They might suffice for your needs.
eg:
ar crvT libfull.a /usr/local/lib/libgrpc.a /usr/local/lib/libgrpc++.a
Alternatively you could extract the object files from both libraries into
a temporary directory and then build a new library using all of them. eg:
% mkdir delme
% cd delme
% ar x /usr/local/lib/libgrpc.a
% ar x /usr/local/lib/libgrpc++.a
% ar cr libfull.a *.o
% mv libfull.a ..
% cd ..
% rm -fr delme
This could of course be done by a script.
> ❯ ar -M < ../link_line
> ar: /usr/local/lib/libgrpc: No such file or directory
> ++%
This is a bug. :-( Fortunately there is an easy fix. Please apply the
attached patch to the binutils sources and then build a new copy of the
binutils. Or alternatively ask the maintainer of whichever distribution
you use to apply this patch to their sources.
Cheers
Nick
[-- Attachment #2: arlex.l.patch --]
[-- Type: text/x-patch, Size: 383 bytes --]
diff --git a/binutils/arlex.l b/binutils/arlex.l
index a43a6214b3d..145b9e16773 100644
--- a/binutils/arlex.l
+++ b/binutils/arlex.l
@@ -78,7 +78,7 @@ int linenumber;
"(" { return '('; }
")" { return ')'; }
"," { return ','; }
-[A-Za-z0-9/\\$:.\-\_]+ {
+[A-Za-z0-9/\\$:.\-\_\+]+ {
yylval.name = xstrdup (yytext);
return FILENAME;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-31 14:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-26 16:12 Plus character ('+') in archive name, can't run ar in MRI mode jyhgekyfbkjsyebf
2022-03-27 21:10 ` Fangrui Song
[not found] ` <MWHPR1201MB0110B3A00DC640E708E9C348CB1C9@MWHPR1201MB0110.namprd12.prod.outlook.com>
2022-03-28 8:27 ` jyhgekyfbkjsyebf
2022-03-31 14:41 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).