Error while installing glib - 2.70. 4

27 views
Skip to first unread message

Billa Surendra

unread,
Mar 17, 2022, 8:26:00 AM3/17/22
to RISC-V SW Dev
Dear all,

I am getting an error while installing the glib-2.70.4 package on the RISC-V environment.

Error:

[1/511] Generating test_resources.o with a custom command
FAILED: gio/tests/test_resources.o
/usr/bin/ld -r -b binary gio/tests/test5.gresource -o gio/tests/test_resources.o
/usr/bin/ld: --relax and -r may not be used together
[10/511] Compiling C object gio/tests/inet-address.p/inet-address.c.o
ninja: build stopped: subcommand failed.

Can anyone please tell me what is the reason for the above error?.

Thanks
Billa

Khem Raj

unread,
Mar 17, 2022, 12:05:39 PM3/17/22
to Billa Surendra, RISC-V SW Dev


On 3/17/22 5:24 AM, Billa Surendra wrote:
> Dear all,
>
> I am getting an error while installing the glib-2.70.4 package on the
> RISC-V environment.
>
> Error:
>
> [1/511] Generating test_resources.o with a custom command
> FAILED: gio/tests/test_resources.o
> /usr/bin/ld -r -b binary gio/tests/test5.gresource -o
> gio/tests/test_resources.o
> /usr/bin/ld: --relax and -r may not be used together

linker is telling clearly whats going on. perhaps check where these
flags are coming from. try adding -mno-relax to linker flags and see
if that helps.

> [10/511] Compiling C object gio/tests/inet-address.p/inet-address.c.o
> ninja: build stopped: subcommand failed.
>
> Can anyone please tell me what is the reason for the above error?.
>
> Thanks
> Billa
>
> --
> You received this message because you are subscribed to the Google
> Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sw-dev+un...@groups.riscv.org
> <mailto:sw-dev+un...@groups.riscv.org>.
> To view this discussion on the web visit
> https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CAKBF_5rUyZA_4cNHoJJ64Nd-181H-q3W0fRqzxu70ib9E_KgfQ%40mail.gmail.com
> <https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CAKBF_5rUyZA_4cNHoJJ64Nd-181H-q3W0fRqzxu70ib9E_KgfQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Jim Wilson

unread,
Mar 19, 2022, 5:48:39 PM3/19/22
to Billa Surendra, RISC-V SW Dev
On Thu, Mar 17, 2022 at 5:25 AM Billa Surendra <billa.i...@gmail.com> wrote:
/usr/bin/ld -r -b binary gio/tests/test5.gresource -o gio/tests/test_resources.o
/usr/bin/ld: --relax and -r may not be used together

Do you maybe have old or modified GNU ld sources?

In  ld/emultempl/riscvelf.em, in the function riscv_elf_before_allocation, we have
  if (!bfd_link_relocatable (&link_info))
    {
      /* We always need at least some relaxation to handle code alignment.  */
      if (RELAXATION_DISABLED_BY_USER)
        TARGET_ENABLE_RELAXATION;
      else
        ENABLE_RELAXATION;
    }
so relaxation is only enabled if this is not a relocatable (-r) link.  Maybe relaxation is being enabled someplace else?  Or maybe this code is broken in your copy?  Or maybe /usr/bin/ld is a shell script that is invoking the regular linker with extra options?

Or alternatively, maybe relaxation is being run when it shouldn't be.  Try looking at the function that prints the error message, which is bfd/reloc.c in the function bfd_generic_relax_section.  Run the linker under gdb, putting a breakpoint there, and try to figure out why you reached the code when you should not.

Jim

Reply all
Reply to author
Forward
0 new messages