Recent

Author Topic: "realloc: Assertion" in GUI app crosscompiled for RPi  (Read 3064 times)

barlone

  • New Member
  • *
  • Posts: 46
"realloc: Assertion" in GUI app crosscompiled for RPi
« on: November 04, 2014, 02:24:17 pm »
Good day for all!

I`ve seccessfully setup crosscompilation from Win32 to RaspberryPi. Console programs works fine (if does not use module cmem). But GUI apps (gtk2 widgetset) does not want to run:

Inconsistency detected by ld.so: dl-minimal.c: 136: realloc: Assertion `ptr == alloc_last_block' failed!

Has anyone encountered a similar problem?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9463
  • FPC developer.
Re: "realloc: Assertion" in GUI app crosscompiled for RPi
« Reply #1 on: November 04, 2014, 02:34:04 pm »
Did you copy all .o files from the /usr/lib dir on rpi to the win32 machine and put them in a directory where the compiler and linker can find them?

barlone

  • New Member
  • *
  • Posts: 46
Re: "realloc: Assertion" in GUI app crosscompiled for RPi
« Reply #2 on: November 04, 2014, 02:44:44 pm »
Did you copy all .o files from the /usr/lib dir on rpi to the win32 machine and put them in a directory where the compiler and linker can find them?

Not all, only necessary to compilation. Some from /lib/arm-linux-gnueabihf, some from /usr/lib/arm-linux-gnueabihf. I think that it is not in the absence of the library. exactly the same situation arises for console applications with the included module cmem.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9463
  • FPC developer.
Re: "realloc: Assertion" in GUI app crosscompiled for RPi
« Reply #3 on: November 04, 2014, 03:26:12 pm »
Cmem also uses libc, and the additional .o files are needed for libc linking.

The reason I said that is because IIRC I ran into a problem once where I only copied the files after the linker step failed, and after coping ran the ppas script to create the binary. Turned out that failed because the compiler skipped some binaries that it couldn't find. So rerunning a the linker reused the faulty link.res

barlone

  • New Member
  • *
  • Posts: 46
Re: "realloc: Assertion" in GUI app crosscompiled for RPi
« Reply #4 on: November 04, 2014, 03:45:30 pm »
Really, file link.res contains

GROUP(
-lc
)

but this work of compiler, look to t_linux.pas:

             Add('GROUP(');
             ...
             if linklibc and not reorder then
               Add('-lc');
             Add(')');


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9463
  • FPC developer.
Re: "realloc: Assertion" in GUI app crosscompiled for RPi
« Reply #5 on: November 04, 2014, 04:33:02 pm »
Strange, I would also expect a bunch of .o files like crtbegin.o crti.o crtend.o crtn.o etc.

Maybe compare the link.res natively on RPI (or any linux) with the one on windows?

barlone

  • New Member
  • *
  • Posts: 46
Re: "realloc: Assertion" in GUI app crosscompiled for RPi
« Reply #6 on: November 04, 2014, 05:32:44 pm »
I make dirty hack and remove adding "-lc" in compiller. And then I try build test app:

D:\lazarus\fpc\2.7.X\bin\armhf-linux\arm-linux-gnueabihf-ld.exe: D:\lazarus\fpc\2.7.X\units\arm-linux\rtl\cwstring.o: undefined reference to symbol 'setlocale@@GLIBC_2.4'

LibC used by RTL at least in module cwstring and many other if defined FPC_USE_LIBC. Unfortunately I can not find where this constant is determined for ARM(HF)-Linux. If I understand correctly, I need to try compile RTL without reference to the LibC. Right?
« Last Edit: November 04, 2014, 05:37:21 pm by barlone »

 

TinyPortal © 2005-2018