Awk error when building tools on Mingw64

Ryan Long ral051 at oarcorp.com
Thu Mar 17 19:08:25 UTC 2022


Hey Frank,

Good catch! Thank you. I got the command to run just by replacing $i 
with \$i.

On 3/17/2022 12:14 PM, Frank Kühndel wrote:
> Hello Ryan,
>
> I believe I have a different error than yours on a "Fedora Linux 35
> Container" but my error is exactly at the same place as yours.
>
> But to your problem:
>
> It looks like the `$i` has been replaced nothing by substitution.
> Compare the output:
>
> At the top: `[...]match($i,\".*lpython.*\")[...]`
> In the error message below: `[...]match(,".*lpython.*")[...]`
>
> It looks like `awk` gets the command line without `$i`.
>
> The problem is likely in file source-builder/config/gdb-common-1.cfg
> line 111 and line 117. May I suggest to try to comment out line 117 and
> 118 with an `#` (or replace them somehow). Then the gdb should build.
>
> The question is why the `$i` disappears? I have seen such things in
> Makefiles. There, you would need to write `$$i` to prevent substitution.
> Does "Mingw64" use an unusual `sh`? Maybe replacing all `sh` with a link
> to `bash` solves this?
>
> Greetings,
> fk
>
>
> On 3/17/22 15:55, Ryan Long wrote:
>> Subject:
>> Awk error when building tools on Mingw64
>> From:
>> Ryan Long <ral051 at oarcorp.com>
>> Date:
>> 3/17/22, 15:55
>>
>> To:
>> devel at rtems.org
>>
>>
>> Hello,
>>
>> I'm trying to build the Aarch64 tools on Mingw64. When building gdb, I
>> am getting the following error.
>>
>> config: tools/rtems-gdb-10.cfg
>> error: shell macro failed: sh -c "/mingw64/bin/python2-config --ldflags
>> | awk 'BEGIN{FS=\"
>> \"}/python/{for(i=1;i<NF;++i)if(match($i,\".*lpython.*\")) print
>> \"lib\"substr($i,3)\"*\";}'": 1: awk: cmd. line:1: BEGIN{FS="
>> "}/python/{for(i=1;i<NF;++i)if(match(,".*lpython.*")) print
>> "lib"substr(,3)"*";}
>> awk: cmd. line:1: ^ syntax error
>> awk: cmd. line:1: BEGIN{FS="
>> "}/python/{for(i=1;i<NF;++i)if(match(,".*lpython.*")) print
>> "lib"substr(,3)"*";}
>> awk: cmd. line:1: ^ 1 is invalid as number of arguments for match
>>
>> I made a file to store this command like so
>>
>>    BEGIN {FS=" "}
>>
>>    /python/ {
>> for(i=1;i<NF;++i)
>> if(match($i,".*lpython.*"))
>>          print "lib"substr($i,3)"*"
>>    }
>>
>> and ran it with the command "python2-config --ldflags | awk -f
>> test.awk". It produces "libpython2.7*" as the output. The only
>> difference between the two is I took out the "\"s since it's not being
>> run on the command line.
>>
>> Does anyone have any ideas what might be going on? And how do we go
>> about fixing this when the solution is found?
>>
>> Thanks,
>>
>> Ryan
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list