Cross compile in Ubuntu for win32 - binutils lazarus / 3-General ---------------------------------------------------------------------- nelson777 · 2008-05-20 00:00 I´m trying for days the compilation of binutils so I can do cross compiling. It always fails and in mingw32 log says "multiple definition of main" among other errors. Anyone has succeding in cross compillation ? what distro was used ? what gcc version ? any special command line flags ? I´m trying to compile using buildcrossbinutils script as the guide said. Do I have to do any modifications ? Where is the fpc-cross package ? no Ubuntu repository has it, and I can´t find any project site. I´m using Ubuntu 8.04 which has gcc 4.2.3 and binutils 2.18 any help is appreciated -Nelson ---------------------------------------------------------------------- Leledumbo · 2008-05-21 07:42 I've recently (and finally) succeeded in compiling crossbinutils. There's nothing wrong with the script, it's the binutils distribution, I think. First, try to compile normally (configure,make). When you get that "multiple definition of main", go to edit Makefile under ld directory. Find EMULATION_O* (or somthing similar, I forgot) variables assigned with deffilep.o ei386pe.o and pe-dll.o. Make the assignments empty. Try make again. With this, I can make it compiled. However, it's not tested and I'm curious about dll making as those files seems related to it... ---------------------------------------------------------------------- nelson777 · 2008-06-02 17:16 Thanx Leledumbo, with your post I could compile binutils. Yet after that I came across 2 other problems in the road to crosscompiling in Linux. First, I try to cross compile Lazarus from the IDE as instructed in http://wiki.lazarus.freepascal.org/Cross_compiling_for_Win32_under_Lin ux But although I had correctly configured fpc.cfg (at least I think so) it can't find system.ppu unit, so I tried the command line way. And I got the following error: Compiling cleandirdlg.pas Compiling compatibilityrestrictions.pas Compiling restrictionbrowser.pas Compiling projectwizarddlg.pas lazarus.pp(114,1) Error: resource compiler not found, switching to external mode lazarus.pp(114,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted make[2]: ** [lazarus.exe] Erro 1 make[2]: Saindo do diretório `/home/nelson/des/lazarus/lazarus- src/lazarus/ide' make[1]: ** [ide] Erro 2 make[1]: Saindo do diretório `/home/nelson/des/lazarus/lazarus- src/lazarus/ide' make: ** [ide] Erro 2 What and where is this resource compiler ? is it windres ? if it is where can I find it ? I am in Ubuntu trying to make a win32 cross compile. I got a windres.exe in my path, but I think it's a windows executable. Also how can I know if the paths I put in fpc.cfg are correct ? How do I know exactly where Lazarus is looking for files ? Thnx in advance -Nelson ---------------------------------------------------------------------- nelson777 · 2008-06-02 17:51 OK OK... I could find windres... it was in binutils bin dir under the name i686-mingw32-windres, but now I got other issue: /bin/rm -f units/i386-win32/alllclunits.ppu /usr/local/bin/ppcross386 -Twin32 -Pi386 -XPi386-win32- -Xr -gl -Fu. -Fuforms -Fuwidgetset -Fiinclude -FE. -FUunits/i386-win32 -Flinclude -Fl/etc/ld.so.conf.d/*.conf -di386  alllclunits.pp Free Pascal Compiler version 2.2.0 [2008/05/27] for i386 Copyright (c) 1993-2007 by Florian Klaempfl Target OS: Win32 for i386 Compiling alllclunits.pp alllclunits.pp(31,1) Fatal: Can't find unit System used by AllLCLUnits Fatal: Compilation aborted make[1]: ** [alllclunits.ppu] Erro 1 make[1]: Saindo do diretório `/home/nelson/des/lazarus/lazarus- src/lazarus/lcl' make: ** [lcl] Erro 2 And I still don't know what went wrong with the paths in fpc.cfg ---------------------------------------------------------------------- Leledumbo · 2008-06-03 06:45 What about fpc units (both rtl and packages)? Have you compiled them for Win32? ---------------------------------------------------------------------- nelson777 · 2008-06-03 23:21 Well, I'm following the guidelines I referenced above. I used the buildcrossbinutils and buildcrosssnaphot scripts. After that I thought I just recompile Lazarus, isn't that it ? I see that fpc-src dir has a rtl and a package sub-dirs. After I run buildcrosssnaphot script can I do a make there ? how would I do it ? ---------------------------------------------------------------------- Leledumbo · 2008-06-04 10:02 QuoteI used the buildcrossbinutils and buildcrosssnaphot scripts. After that I thought I just recompile Lazarus, isn't that it ? Configure your fpc.cfg? buildcrosssnapshot script does the rtl and packages compilation. Perhaps it's really fpc.cfg problem. ---------------------------------------------------------------------- Vincent Snijders · 2008-06-04 11:34 Why don't you just install the crosswin32 package from our Ubuntu repository? ---------------------------------------------------------------------- nelson777 · 2008-06-06 20:21 Because I can´t find it. Where is it ? I configured synaptic for http://www.hu.freepascal.org/lazarus/lazarus-stable and http://www.hu.freepascal.org/lazarus/lazarus-testing and there is no package with that name. Or at least there isn´t one for Ununtu 64Bits ---------------------------------------------------------------------- tatamata · 2008-06-10 16:33 Cross-compiling in Lazarus sucks! It works only in theory... I think that  true cross-platform programming in Lazarus could be accomplished only in two ways: 1. By using OpenLina virtual machine (www.openlina.org) 2. By using Wine emulator (www.winehq.org) Choosing from these two, I would choose Wine, since it is very mature and proven. But, there are some annoying issues. Using windres in Wine is problematic, for example. Therefore, you can't install new components without switching off windres....If this problem solved, this could be a killing combination: Linux (or FreeBSD) + Wine + Windows Lazarus package. I beg, if there is a guy comfortable with both Wine and Lazarus, please, solve this problem with windres and Wine. True cross platform executable....currently, only a dream! ---------------------------------------------------------------------- b00 · 2008-07-12 00:44 Hm.... maybe I missed something, but my apps work just fine (until now, at least). I have equal Lazarus installs on Windows ans Linux, and they successfully compile my project (same units), and I can run them on both OSes. ---------------------------------------------------------------------- b00 · 2008-07-12 00:48 Oh... please disregard my post. I just have figured out, you are talking about cross-compiling, i.e. compiling Win32 apps under Linux and vica versa.