Recent

Author Topic: [SOLVED] Error while linking during rebuilding the IDE Lazarus 1.6.4+FPC 3.0.2  (Read 22711 times)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 668
    • My games in Pascal
SOLVED. Confirmed working flawlessly in 1.6.4 RC2.

Debian Jessie, x64. Installing from *.deb packages.
Start-up checks go fine.
Try "Tools>Build Lazarus..." (no modifications, just clean Lazarus):

Quote
/usr/bin/ld: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
make[2]: *** [lazarus] Error 1
make[1]: *** [idepkg] Error 2
make: *** [idepkg] Error 2
/usr/share/lazarus/1.6.4/ide/lazarus.pp(154,1) Error: (9013) Error while linking
/usr/share/lazarus/1.6.4/ide/lazarus.pp(154,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
Makefile:4004: recipe for target 'lazarus' failed
make[2]: Leaving directory '/usr/share/lazarus/1.6.4/ide'
Makefile:4430: recipe for target 'idepkg' failed
make[1]: Leaving directory '/usr/share/lazarus/1.6.4/ide'
Makefile:3074: recipe for target 'idepkg' failed
make: Leaving directory '/usr/share/lazarus/1.6.4'

Identical error in "normal IDE" and "debug IDE" modes.
Also negative result for Lazarus 1.6.2+ FPC3.0.2.
Still Lazarus 1.6.2 + FPC3.0.0 works fine.
Lazarus-project 1.6.4 can't install with FPC3.0.0 due to dependency on FPC 3.0.2.
Looks like it depends on some external packages (like LibFreeType6). While it was very easy to solve at a work PC with Internet access: I've just (re)installed everything I had on my "compile.txt" list - it turned out to be a much more complex problem for my home PC without Internet access which already had all that list installed previously.
However, today I couldn't rebuild Lazarus again at work (I remember it was linking correctly Thursday or Wednesday).
« Last Edit: June 14, 2017, 09:49:26 am by Eugene Loza »
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11421
  • FPC developer.
Try assembling cprt0.o with the assembler on your system.   (as cprt0.as -o cprt0.o or so)

Maybe the prepared version uses a newer binutils then you are using on debian stable.

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
« Last Edit: March 06, 2017, 02:25:15 pm by cpicanco »
Be mindful and excellent with each other.
https://github.com/cpicanco/

Eugene Loza

  • Hero Member
  • *****
  • Posts: 668
    • My games in Pascal
as cprt0.as -o cprt0.o
Sorry for a stupid question... where do I find cprt0.as? It's not in the path. Search at my PC finds ~23 cprt0.as files in /usr/share/fpcsrc/3.0.2/rtl/ most of them have different size. And no folder /linux/amd64/ which is my architecture.
And the next relative question - where should I store the output?
I have /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o and no cprt0.so.
« Last Edit: March 06, 2017, 02:25:16 pm by Eugene Loza »
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Quote
rafael@rafael:~$ objdump -r /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o

/usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o:     file format elf64-x86-64

RELOCATION RECORDS FOR [.text]:BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341
BFD: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: invalid relocation type 42
BFD: BFD (GNU Binutils for Debian) 2.25 assertion fail ../../bfd/elf64-x86-64.c:341

OFFSET           TYPE              VALUE
000000000000000d R_X86_64_NONE     operatingsystem_parameter_argc-0x0000000000000004
0000000000000017 R_X86_64_NONE     operatingsystem_parameter_argv-0x0000000000000004
000000000000002c R_X86_64_NONE     operatingsystem_parameter_envp-0x0000000000000004
000000000000003c R_X86_64_NONE     __libc_csu_init-0x0000000000000004
0000000000000043 R_X86_64_NONE     __libc_csu_fini-0x0000000000000004
000000000000004a R_X86_64_NONE     main_stub-0x0000000000000004
000000000000004f R_X86_64_PLT32    __libc_start_main-0x0000000000000004
0000000000000059 R_X86_64_NONE     ___fpc_ret_rbp-0x0000000000000004
0000000000000063 R_X86_64_NONE     ___fpc_ret-0x0000000000000004
000000000000006e R_X86_64_NONE     __stkptr-0x0000000000000004
0000000000000079 R_X86_64_PLT32    PASCALMAIN-0x0000000000000004
0000000000000081 R_X86_64_NONE     operatingsystem_result-0x0000000000000004
000000000000008b R_X86_64_NONE     ___fpc_ret_rbp-0x0000000000000004
0000000000000095 R_X86_64_NONE     ___fpc_ret-0x0000000000000004


rafael@rafael:~$


I have found the "*.o" file.
« Last Edit: March 06, 2017, 02:31:20 pm by cpicanco »
Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Be mindful and excellent with each other.
https://github.com/cpicanco/

jma_sp

  • Full Member
  • ***
  • Posts: 150
  • El conocimiento si ocupa lugar.
Look at the xterm user solution. ;D by the moment. It´s not the same but you can try it. If it can help to locate the issue.

Devuan Beowulf 3.0( JWM/ROX/iDesk) - Puppy Linux,  Haiku OS,.ReactOS 0.4.xx  - FreeDos .

ruewa

  • Newbie
  • Posts: 2
Same problem here with Mint LMDE 2. The fpc_3.0.2-170225_amd64.deb package seems to be broken.

I could fix it by installing the tar-Version (https://sourceforge.net/projects/freepascal/files/Linux/3.0.2/fpc-3.0.2.x86_64-linux.tar/download) outside the package manager via shell script. Then I installed the Sources and Lazarus 1.6.4 deb files the normal way.

See also http://bugs.freepascal.org/view.php?id=31482
_________________________

Edit: I tried to reproduce my fix on a clean Mint 18 x86-64 machine. It turned out to be a bit more complicated (I tried a while back and forth jumping to simplified conclusions, sorry). But this should work:
  • Install fpc_3.0.2-170225_amd64.deb via package manager
  • Install fpc_3.0.2.x86_64-linux.tar via shell (unzip and run sh install.sh). Install into /usr directory, so it overwrites the existing installation
  • Install the deb sources via package manager
  • Install lazarus-project_1.6.4-0_amd64.deb via package manager
Now recompilation of IDE and compilation of projects worked also on the second computer.
« Last Edit: March 06, 2017, 11:08:34 pm by ruewa »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11421
  • FPC developer.
I would try to view the lazarus deb, and make sure all requirements except fpc binaries are met by installing them manually. 

If the fpc-src deb has no dependency on binary fpc you can also install it manually.

Then install FPC tar

Then install the lazarus deb on the commandline ignoring dependencies.

This avoids having had two installations of the fpc and potential issues coming from that in Ruewa' post.


Eugene Loza

  • Hero Member
  • *****
  • Posts: 668
    • My games in Pascal
Sorry for the delay, the problem is that if I would have been able to install FPC 3.0.2. from sources I'd have done it long ago :) But I lack the knowledge on which folders to install into (which has been a disaster recently when I was installing Android-related stuff - it took me 4 days just to figure out by trial-and-error which folder will "catch" the compiled cross-compiler). I know there should be some symbolic links and some specific platform-defined settings where to place the code, but I could not find any guidelines for Debian (they're using different default folders often, which is a case for fpc.cfg for example AFAIR).
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

guest58172

  • Guest
Wouldn't be FPC be affected by the recent move to PIE (position independant executable) ?
I've read that other compilers were affected (when they linked with devel libraries).

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Any news about that? Error persists in 1.8.0 RC1 (FPC 3.0.3)

https://bugs.freepascal.org/view.php?id=31490
« Last Edit: May 22, 2017, 05:34:37 am by cpicanco »
Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
The following fixed the issue for me.

Code: Bash  [Select][+][-]
  1. cd /usr/share/fpcsrc/3.0.3
  2. sudo make clean all OS_TARGET=linux CPU_TARGET=x86_64
  3. sudo make install OS_TARGET=linux CPU_TARGET=x86_64 INSTALL_PREFIX=/usr
  4.  
Be mindful and excellent with each other.
https://github.com/cpicanco/

macmike

  • Jr. Member
  • **
  • Posts: 85
    • Soft-Practice
The following fixed the issue for me.

Code: Bash  [Select][+][-]
  1. cd /usr/share/fpcsrc/3.0.3
  2. sudo make clean all OS_TARGET=linux CPU_TARGET=x86_64
  3. sudo make install OS_TARGET=linux CPU_TARGET=x86_64 INSTALL_PREFIX=/usr
  4.  

thanks,  that worked for me, with the slight tweak of 3.0.2 instead of 3.0.3

Gizmo

  • Hero Member
  • *****
  • Posts: 831
Quote
The following fixed the issue for me.

Code: Bash  [Select]
cd /usr/share/fpcsrc/3.0.3
sudo make clean all OS_TARGET=linux CPU_TARGET=x86_64
sudo make install OS_TARGET=linux CPU_TARGET=x86_64 INSTALL_PREFIX=/usr

...and me too!! In my case, the IDE was working fine after an upgrade from 1.6.2 to 1.6.4. But a project that I new to be fine (having just compiled OK on Windows) reported the same linking error. I did the above, also substituting 3.0.3 for 3.0.2, relaunched Lazartus, and opened my project, hit F9, and up came my compiled program. 

 

TinyPortal © 2005-2018