Hi Lianbo and Luc,

I rolled back my patch and tried to cross-compile, and got the following result:
    $ make CROSS_COMPILE=aarch64-linux-gnu- extensions

    gcc -Wall -g -shared -rdynamic -o dminfo.so dminfo.c -fPIC -DARM64
 -DGDB_16_2
    gcc -Wall -g -shared -rdynamic -o echo.so echo.c -fPIC -DARM64  -DGDB_16_2
    Cloning into 'eppic'...
    remote: Enumerating objects: 700, done.
    remote: Counting objects: 100% (219/219), done.
    remote: Compressing objects: 100% (90/90), done.
    remote: Total 700 (delta 156), reused 170 (delta 127), pack-reused
481 (from 1)
    Receiving objects: 100% (700/700), 317.20 KiB | 202.00 KiB/s, done.
    Resolving deltas: 100% (378/378), done.
    cd eppic/libeppic && make
    bison -peppic -v -t -d eppic.y
    eppic.y: warning: 135 shift/reduce conflicts [-Wconflicts-sr]
    eppic.y: warning: 22 reduce/reduce conflicts [-Wconflicts-rr]
    eppic.y: note: rerun with option '-Wcounterexamples' to generate
conflict counterexamples
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_util.o eppic_util.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_node.o eppic_node.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_var.o eppic_var.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_func.o eppic_func.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_str.o eppic_str.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_op.o eppic_op.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_num.o eppic_num.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_stat.o eppic_stat.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_builtin.o
eppic_builtin.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_type.o eppic_type.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_case.o eppic_case.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_api.o eppic_api.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_member.o
eppic_member.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_alloc.o eppic_alloc.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_define.o
eppic_define.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_input.o eppic_input.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_print.o eppic_print.c
    bison -peppicpp -v -t -d eppicpp.y
    eppicpp.y: warning: 23 shift/reduce conflicts [-Wconflicts-sr]
    eppicpp.y: note: rerun with option '-Wcounterexamples' to generate
conflict counterexamples
    cc -g -O0 -fno-omit-frame-pointer -fPIC -c eppicpp.tab.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC -c eppic.tab.c
    flex -L -Peppic -t eppic.l > lex.eppic.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC -c lex.eppic.c
    flex -Peppicpp -t eppicpp.l  > lex.eppicpp.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC -c lex.eppicpp.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC -o mkbaseop mkbaseop.c
    ./mkbaseop > baseops.c
    cc -g -O0 -fno-omit-frame-pointer -fPIC -c baseops.c
    ar cur libeppic.a eppic_util.o eppic_node.o eppic_var.o
eppic_func.o eppic_str.o eppic_op.o eppic_num.o eppic_stat.o
eppic_builtin.o eppic_type.o eppic_case.o eppic_api.o eppic_member.o
eppic_alloc.o eppic_define.o eppic_input.o eppic_print.o eppicpp.tab.o
eppic.tab.o lex.eppic.o lex.eppicpp.o baseops.o
    ar: `u' modifier ignored since `D' is the default (see `U')
    gcc -g -O0 -Ieppic/libeppic -I.. -nostartfiles -shared -rdynamic
-o eppic.so eppic/applications/crash/eppic.c -fPIC -DARM64 -DGDB_16_2
-Leppic/libeppic -leppic
    gcc -Wall -g -I. -shared -rdynamic -o snap.so snap.c -fPIC -DARM64
 -DGDB_16_2

It succeeded, but that's not cross-compiling. It still uses gcc to
compile all extensions.
When I applied my patch, I passed $(CC) to the extensions Makefile
from the top Makefile. This caused the eppic extension to actually use
aarch64-linux-gnu-gcc for cross-compilation. However, it doesn't seem
to support cross-compilation.
If I understand correctly, I think we can fix this error by changing
the call of $(CC) in the eppic extension to gcc. If you agree with
this proposal, I will submit a patch to the eppic repository to fix
it.

Thanks
Jianyun

On Fri, Oct 10, 2025 at 11:33 AM lijiang <[email protected]> wrote:
>
> Hi, Jianyun
> Thank you for the patch.
>
> On Fri, Sep 26, 2025 at 7:27 AM <[email protected]> 
> wrote:
>>
>> Date: Tue, 23 Sep 2025 21:43:38 +0800
>> From: 高建云 <[email protected]>
>> Subject: [Crash-utility] [PATCH] Optimize extensions's compiler from
>>         gcc to $(CC)
>> To: [email protected]
>> Message-ID:
>>         <cahp3+4czqdnh5lv5dgy0hlfb_mqpqau0pzozztfk9kfvz+b...@mail.gmail.com>
>> Content-Type: multipart/alternative;
>>         boundary="00000000000043dcaa063f782098"
>>
>> --00000000000043dcaa063f782098
>> Content-Type: text/plain; charset="UTF-8"
>>
>> Change the default compiler of the extensions from the fixed gcc
>> to $(CC) passed in by the upper layer Makefile,
>> to facilitate cross_compile.
>>
>> Signed-off-by: jianyun.gao <[email protected]>
>> ---
>>  Makefile            |  2 +-
>>  extensions/Makefile | 10 +++++-----
>>  2 files changed, 6 insertions(+), 6 deletions(-)
>>
>
> I tried the patch, and this caused the following failure, can you help double 
> check?
>
> $ make CROSS_COMPILE=aarch64-linux-gnu-  extensions
> aarch64-linux-gnu-gcc -Wall -g -shared -rdynamic -o dminfo.so dminfo.c -fPIC 
> -DARM64  -DGDB_16_2
> aarch64-linux-gnu-gcc -Wall -g -shared -rdynamic -o echo.so echo.c -fPIC 
> -DARM64  -DGDB_16_2
> Cloning into 'eppic'...
> remote: Enumerating objects: 691, done.
> remote: Counting objects: 100% (210/210), done.
> remote: Compressing objects: 100% (84/84), done.
> remote: Total 691 (delta 150), reused 165 (delta 124), pack-reused 481 (from 
> 1)
> Receiving objects: 100% (691/691), 318.81 KiB | 312.00 KiB/s, done.
> Resolving deltas: 100% (372/372), done.
> cd eppic/libeppic && make
> bison -peppic -v -t -d eppic.y
> eppic.y: warning: 135 shift/reduce conflicts [-Wconflicts-sr]
> eppic.y: warning: 22 reduce/reduce conflicts [-Wconflicts-rr]
> eppic.y: note: rerun with option '-Wcounterexamples' to generate conflict 
> counterexamples
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_util.o eppic_util.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_node.o eppic_node.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_var.o eppic_var.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_func.o eppic_func.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_str.o eppic_str.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o eppic_op.o 
> eppic_op.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_num.o eppic_num.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_stat.o eppic_stat.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_builtin.o eppic_builtin.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_type.o eppic_type.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_case.o eppic_case.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_api.o eppic_api.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_member.o eppic_member.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_alloc.o eppic_alloc.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_define.o eppic_define.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_input.o eppic_input.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC   -c -o 
> eppic_print.o eppic_print.c
> bison -peppicpp -v -t -d eppicpp.y
> eppicpp.y: warning: 23 shift/reduce conflicts [-Wconflicts-sr]
> eppicpp.y: note: rerun with option '-Wcounterexamples' to generate conflict 
> counterexamples
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC -c eppicpp.tab.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC -c eppic.tab.c
> flex -L -Peppic -t eppic.l > lex.eppic.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC -c lex.eppic.c
> flex -Peppicpp -t eppicpp.l  > lex.eppicpp.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC -c lex.eppicpp.c
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC -o mkbaseop 
> mkbaseop.c
> ./mkbaseop > baseops.c
> /bin/sh: 1: ./mkbaseop: Exec format error
> make[5]: [Makefile:71: baseops.o] Error 126 (ignored)
> aarch64-linux-gnu-gcc -g -O0 -fno-omit-frame-pointer -fPIC -c baseops.c
> ar cur libeppic.a eppic_util.o eppic_node.o eppic_var.o eppic_func.o 
> eppic_str.o eppic_op.o eppic_num.o eppic_stat.o eppic_builtin.o eppic_type.o 
> eppic_case.o eppic_api.o eppic_member.o eppic_alloc.o eppic_define.o 
> eppic_input.o eppic_print.o eppicpp.tab.o eppic.tab.o lex.eppic.o 
> lex.eppicpp.o baseops.o
> ar: `u' modifier ignored since `D' is the default (see `U')
> gcc -g -O0 -Ieppic/libeppic -I.. -nostartfiles -shared -rdynamic -o eppic.so 
> eppic/applications/crash/eppic.c -fPIC -DARM64 -DGDB_16_2 -Leppic/libeppic 
> -leppic
> /usr/bin/ld: skipping incompatible eppic/libeppic/libeppic.a when searching 
> for -leppic
> /usr/bin/ld: cannot find -leppic: No such file or directory
> collect2: error: ld returned 1 exit status
> make[4]: [eppic.mk:71: eppic.so] Error 1 (ignored)
> gcc -Wall -g -I. -shared -rdynamic -o snap.so snap.c -fPIC -DARM64  -DGDB_16_2
>
> But for the trace and gcore, etc. It can work.
>
> Thanks
> Lianbo
>
>>
>> diff --git a/Makefile b/Makefile
>> index b277129..58b1326 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -727,7 +727,7 @@ extensions: make_configure
>>     @$(MAKE) do_extensions
>>
>>  do_extensions:
>> -   @$(MAKE) -C extensions -i TARGET=$(TARGET) TARGET_CFLAGS="$(CFLAGS)
>> $(TARGET_CFLAGS)" GDB=$(GDB) GDB_FLAGS=$(GDB_FLAGS)
>> +   @$(MAKE) -C extensions -i CC=$(CC) TARGET=$(TARGET)
>> TARGET_CFLAGS="$(CFLAGS) $(TARGET_CFLAGS)" GDB=$(GDB) GDB_FLAGS=$(GDB_FLAGS)
>>
>>  memory_driver: make_configure
>>     @$(MAKE) -C memory_driver -i
>> diff --git a/extensions/Makefile b/extensions/Makefile
>> index e4c68c3..67d3839 100644
>> --- a/extensions/Makefile
>> +++ b/extensions/Makefile
>> @@ -23,7 +23,7 @@
>>  # suffice, create a .mk file with the same prefix as the .c file,
>>  # and that makefile will be invoked.
>>  #
>> -
>> +CC ?= gcc
>>  CONTRIB_SO := $(patsubst %.c,%.so,$(wildcard *.c))
>>
>>  all: link_defs $(CONTRIB_SO)
>> @@ -37,11 +37,11 @@ $(CONTRIB_SO): %.so: %.c defs.h
>>         $(MAKE) -f $*.mk; \
>>     else \
>>         grep -q '((constructor))' $*.c && { \
>> -           echo "gcc -Wall -g -shared -rdynamic -o $@ $*.c -fPIC
>> -D$(TARGET) $(TARGET_CFLAGS) $(GDB_FLAGS)"; \
>> -           gcc -Wall -g -shared -rdynamic -o $@ $*.c -fPIC -D$(TARGET)
>> $(TARGET_CFLAGS) $(GDB_FLAGS); \
>> +           echo "$(CC) -Wall -g -shared -rdynamic -o $@ $*.c -fPIC
>> -D$(TARGET) $(TARGET_CFLAGS) $(GDB_FLAGS)"; \
>> +           $(CC) -Wall -g -shared -rdynamic -o $@ $*.c -fPIC -D$(TARGET)
>> $(TARGET_CFLAGS) $(GDB_FLAGS); \
>>         } || { \
>> -           echo "gcc -Wall -g -nostartfiles -shared -rdynamic -o $@ $*.c
>> -fPIC -D$(TARGET) $(TARGET_CFLAGS) $(GDB_FLAGS)"; \
>> -           gcc -Wall -g -nostartfiles -shared -rdynamic -o $@ $*.c -fPIC
>> -D$(TARGET) $(TARGET_CFLAGS) $(GDB_FLAGS); \
>> +           echo "$(CC) -Wall -g -nostartfiles -shared -rdynamic -o $@ $*.c
>> -fPIC -D$(TARGET) $(TARGET_CFLAGS) $(GDB_FLAGS)"; \
>> +           $(CC) -Wall -g -nostartfiles -shared -rdynamic -o $@ $*.c -fPIC
>> -D$(TARGET) $(TARGET_CFLAGS) $(GDB_FLAGS); \
>>         }; \
>>     fi
>>
>> --
>> 2.34.1
>>
--
Crash-utility mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to