File format issue with crtbegin.o for crosscompiler lazarus / 1-Linux ---------------------------------------------------------------------- Ocye · 2015-11-27 15:27 I just updated fpc to 3.0.0 and had to recreate crosscompiler for i386 and arm. I'm pretty sure that it was a piece of cake with 2.6.4. But today the compilers complain about "/usr/lib/gcc/x86_64-unknown-linux- gnu/5.2.0/crtbegin.o: file not recognized: File format not recognized". I use to do "make clean crosszipinstall CPU_TARGET=i386" and extract units and ppc to the right directory. As before. The same for arm with OPT="-dARMEL". And finally I created symlinks for ppcarm and ppci386 at /usr/bin to the ppcross* at /usr/lib/fpc. My arm binutils reside in /usr/local/arm/, /usr/lib32 is valid too - both are referenced in fpc.cfg Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i #ifdef cpui386-Xd-Fl/usr/lib32#endif#ifdef cpuarm-Xd -Fl/usr/local/arm/lib- Fl/usr/local/arm/libc/usr/lib-Parm #endif"ppcarm -vt b" returns Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [ht@Venus ~]$ ppcarm -vt bConfigfile search: /home/ht/.fpc.cfgReading options from file /home/ht/.fpc.cfgHint: End of reading config file /home/ht/.fpc.cfgFree Pascal Compiler version 3.0.0 [2015/11/27] for armCopyright (c) 1993-2015 by Florian Klaempfl and othersSearching file /lib/ld-linux.so.3... not foundSearching file /lib/ld- uClibc.so.0... not foundCompiler: /usr/lib/fpc/3.0.0/ppcrossarmTarget OS: Linux for ARMELUsing executable path: /usr/lib/fpc/3.0.0/Using unit path: /usr/lib/fpc/3.0.0/Using library path: /usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/Using library path: /usr/local/arm/libc/usr/lib/ I'm sure to never have added binprefix. And playing around with these options didn't help. But to me it's poking in the dark. Any idea what's wrong here? PS: A simple "program Test; begin writeln('Hello World'); end." works on all targets. ---------------------------------------------------------------------- marcov · 2015-11-27 16:02 Well, arm target has been split, and is now ARMEL it seems? Probably you need to adjust the ifdef in fpc.cfg accordingly (probably cpuarmel, see what is defined with -a) ---------------------------------------------------------------------- Ocye · 2015-11-27 16:15 Simply change it to #ifdef cpuarmel doesn't have any effect. ppcarm -i (no -a option) tells me Supported targets (targets marked with '{*}' are under development):   Linux: Linux for ARMEL   WinCE: WinCE for ARM   gba: GameBoy Advance   PalmOS: PalmOS   nds: Nintendo DS   embedded: Embedded   Symbian: Symbian OS for ARM   Darwin: Darwin for ARM   Android: Android for ARMEL Args, while writing this down I found the reason - or something like. I tried RC1 some time ago and got warnings. As recommended in https://www.mail-archive.com/fpc- pascal@lists.freepascal.org/msg39959.html it was solved by Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i #ifdef VER3_0-Fl/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0#ENDIF which is not good obviously. Without this line the compilation works but with warnings Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Warning: (9034) "crtbegin.o" not found, this will probably cause a linking failureWarning: (9034) "crtend.o" not found, this will probably cause a linking failure The same when I compile for i386 ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread ... Is it worth a new thread? ---------------------------------------------------------------------- ykot · 2015-11-27 20:09 From what it looks like, i386 cross-compiler can't find the appropriate libraries (it finds 64-bit ones, which are not compatible). I had this problem on Linux for quite some time and it seems to be solved by properly editing "fpc.cfg". In my case, I had to edit these lines (there could be more): Code: [Select]# path to the gcclib #ifdef cpui386 -Fl/usr/lib/gcc/x86_64-linux-gnu/4.9/32 #endif #ifdef cpux86_64 -Fl/usr/lib/gcc/x86_64-linux-gnu/4.9 #endif In the end of "fpc.cfg", I've added: Code: [Select]#IFDEF CPUI386 -Fl/usr/lib32 -Fl/usr/lib/i386-linux-gnu #ENDIF In case you find it useful, I've added my "fpc-prepare-x32.sh" script, which installs missing libraries (when building SVN trunk from scratch for i386 cross-compilation) and "fpc.cfg". In my config, I cross- compile from Linux x86_64 to Linux/i386, Linux/ARM-HF, Windows i386/x86_64, Android/ARMEL, Android/i386, Embedded/ARM and Embedded/AVR. However, I haven't tried seeding with 3.x though. ---------------------------------------------------------------------- Ocye · 2015-11-28 00:11 Quote from: ykot on November 27, 2015, 09:09:43 pmFrom what it looks like, i386 cross-compiler can't find the appropriate libraries... Thanks. In my case it was the fix definition to avoid warnings - as I wrote in my first reply. With a "normal" fpc.cfg I can build i386 and arm code but still get warnings.