[Toybox] [PATCH] patch: avoid upsetting the compiler.

Rob Landley rob at landley.net
Fri Feb 28 05:17:43 PST 2020


On 2/28/20 6:35 AM, Rob Landley wrote:
> On 2/27/20 11:59 PM, enh via Toybox wrote:
>>   external/toybox/toys/posix/patch.c:129:45: error: pointer type mismatch
>>       ('int (*)(char *, char *)' and 'void *')
>>   int (*lcmp)(char *aa, char *bb) = FLAG(l) ? loosecmp : (void *)strcmp;
>>                                             ^ ~~~~~~~~   ~~~~~~~~~~~~~~
> 
> This is what the void * typecast is for? (Is it because I didn't (void *) both
> of them? I can do that.)

I wanted to confirm typecasting them both to the same void * would fix your
mismatch, so I pulled up AOSP and did a repo update to get the newest compiler.
(Then I did a repo pull. Then I checked my blog to figure out it's "repo sync".)

And then I did:

$ cd ~/toybox/toybox
$ mkdir clang
$ cd clang
$ for i in
/home/landley/android/aosp/prebuilts/clang/host/linux-x86/clang-r377782b/bin/llvm-*;
do ln -s $i $(basename $i); done
$ ln -s
/home/landley/android/aosp/prebuilts/clang/host/linux-x86/clang-r377782b/bin/clang
llvm-cc
$ cd ..
$ CROSS_COMPILE=$PWD/clang/llvm- LDFLAGS=--static make distclean defconfig toybox
...
Make generated/config.h from .config.
generated/flags.h Traceback (most recent call last):
  File "/home/landley/toybox/toybox/clang/llvm-cc", line 192, in <module>
    main(sys.argv)
  File "/home/landley/toybox/toybox/clang/llvm-cc", line 188, in main
    cw.invoke_compiler()
  File "/home/landley/toybox/toybox/clang/llvm-cc", line 162, in invoke_compiler
    os.execv(self.argv0, self.execargs)
OSError: [Errno 2] No such file or directory

Which is how I learned "clang" is now a python wrapper.

Anyway, the compilers I have lying around like it?

Rob



More information about the Toybox mailing list