Recent

Author Topic: Crosscompile dynlibs.pas error  (Read 8243 times)

viroroi

  • Newbie
  • Posts: 2
Crosscompile dynlibs.pas error
« on: November 09, 2011, 09:04:57 am »
I install in Ubuntu 11.10 Lazarus 0.9.31 with FPC 2.5.1 crosscompile for Android.

When I compile a project with dynlibs.pas if I link libpthread.so, libc.so and libdl.so to "arm-linux-gnueabi" forder:
sudo ln -sf /usr/arm-linux-gnueabi/lib/libpthread-2.13.so libpthread.so
sudo ln -sf /usr/arm-linux-gnueabi/lib/libc-2.13.so libc.so
sudo ln -sf /usr/arm-linux-gnueabi/lib/libdl-2.13.so libdl.so
These are the compiler errors:
/usr/lib/fpc/2.7.1/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
/usr/lib/fpc/2.7.1/units/arm-linux/rtl/cprt0.o: In function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'
androidlcltest.lpr(23) Error: Error while linking
androidlcltest.lpr(23) Fatal: There were 1 errors compiling module, stopping

If I link libc.so and libdl.so to ndk android forder (platforms android 5) errors are similar.

I have read another thread about a similar problem but I can not found the solution.

How can I solve this problem?

« Last Edit: November 09, 2011, 09:06:53 am by viroroi »

Rustam Asmandiarov

  • New member
  • *
  • Posts: 46
Re: Crosscompile dynlibs.pas error
« Reply #1 on: November 17, 2011, 11:17:31 am »
That would not produce branches think there will be fine!
So the problem! I am creating a clean design and installed in the options OS (-T) Linux, CPU (-P) Arm, LCLWidgetType-Android, name of the executable file project1.so. Compilation and run the project going.
Now add in the module uses dynlibs and compile, an error occurs:

/usr/local/bin/arm-linux-ld: warning: link.res contains output sections; did you forget -T?
/usr/local/bin/arm-linux-ld: skipping incompatible /usr/lib/crti.o when searching for /usr/lib/crti.o
/usr/local/bin/arm-linux-ld: cannot find /usr/lib/crti.o
project1.lpr(22) Error: Error while linking
project1.lpr(22) Fatal: There were 1 errors compiling module, stopping

Moreover, substitution usr / lib / crti.o and usr / lib / crtn.o desired result does not give, because there were new bugs!
OS Ubuntu 10.10-10.04

Что бы не плодить веток думаю здесь будет нормально!
Итак суть проблемы! Я создаю чистый проект и установливаю в опциях OS(-T)Linux, CPU(-P)Arm, LCLWidgetType -Android, Имя исполняемого файла project1.so. Запускаю компиляцию и проект собирается.
Теперь добавляю в uses модуль dynlibs и компилирую, появляется ошибка :
----
Причем подмена usr/lib/crti.o и usr/lib/crtn.o желаемого результата не давала, так как появлялись новые ошибки!


felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Crosscompile dynlibs.pas error
« Reply #2 on: November 17, 2011, 01:06:33 pm »
where the source code of a minimal project which reproduces the problem?

Rustam Asmandiarov

  • New member
  • *
  • Posts: 46
Re: Crosscompile dynlibs.pas error
« Reply #3 on: November 17, 2011, 01:17:43 pm »
Here

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Crosscompile dynlibs.pas error
« Reply #4 on: November 17, 2011, 01:22:09 pm »
Ah, that's an LCL application ... I am rewriting the LCL Android widgetset. I don' t recommend trying to use it until I finish the rewrite.

Rustam Asmandiarov

  • New member
  • *
  • Posts: 46
Re: Crosscompile dynlibs.pas error
« Reply #5 on: November 17, 2011, 01:31:36 pm »
Thank you very much! I'll wait!

viroroi

  • Newbie
  • Posts: 2
Re: Crosscompile dynlibs.pas error
« Reply #6 on: December 13, 2011, 02:39:16 pm »
Hi, my project is not a LCL application. I want to make a application service with sockets. And when I add dynlibs to the project, I can not compile it.

zeljko

  • Hero Member
  • *****
  • Posts: 1050
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Crosscompile dynlibs.pas error
« Reply #7 on: December 28, 2011, 04:40:38 pm »
same problem here (but compiling for meego (nokia n9 arm7)) - fpc-2.4.5.
Pure fpc app works on device, but as soon as I include dynlibs or cthreads or clocale or cwstring
linking is impossible (eg. simple qtlcl app).

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Crosscompile dynlibs.pas error
« Reply #8 on: December 28, 2011, 06:58:50 pm »
dynlibs is plain broken for Android, but I think that maybe it works in fpc trunk for standard arm-linux (never tried, so can't say for sure).

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7216
Re: Crosscompile dynlibs.pas error
« Reply #9 on: December 28, 2011, 09:58:46 pm »
dynlibs is plain broken for Android, but I think that maybe it works in fpc trunk for standard arm-linux (never tried, so can't say for sure).

Afaik it works fine.