Lazarus

Installation => General => Topic started by: nelson777 on May 20, 2008, 02:00:30 am

Title: Cross compile in Ubuntu for win32 - binutils
Post by: nelson777 on May 20, 2008, 02:00:30 am
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
Title: RE: Cross compile in Ubuntu for win32 - binutils
Post by: Leledumbo on May 21, 2008, 09:42:08 am
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...
Title: RE: Cross compile in Ubuntu for win32 - binutils
Post by: nelson777 on June 02, 2008, 07:16:11 pm
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_Linux

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
Title: RE: Cross compile in Ubuntu for win32 - binutils
Post by: nelson777 on June 02, 2008, 07:51:39 pm
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
Title: RE: Cross compile in Ubuntu for win32 - binutils
Post by: Leledumbo on June 03, 2008, 08:45:09 am
What about fpc units (both rtl and packages)? Have you compiled them for Win32?
Title: RE: Cross compile in Ubuntu for win32 - binutils
Post by: nelson777 on June 04, 2008, 01:21:10 am
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 ?
Title: RE: Cross compile in Ubuntu for win32 - binutils
Post by: Leledumbo on June 04, 2008, 12:02:30 pm
Quote
I used the buildcrossbinutils and buildcrosssnaphot scripts. After that I thought I just recompile Lazarus, isn't that it ?

Configure your fpc.cfg (http://wiki.lazarus.freepascal.org/Cross_compiling_for_Win32_under_Linux#Configure_your_fpc.cfg)?

buildcrosssnapshot script does the rtl and packages compilation. Perhaps it's really fpc.cfg problem.
Title: RE: Cross compile in Ubuntu for win32 - binutils
Post by: Vincent Snijders on June 04, 2008, 01:34:04 pm
Why don't you just install the crosswin32 package from our Ubuntu repository?
Title: RE: Cross compile in Ubuntu for win32 - binutils
Post by: nelson777 on June 06, 2008, 10:21:52 pm
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
Title: Cross compile in Ubuntu for win32 - binutils
Post by: tatamata on June 10, 2008, 06:33:23 pm
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!
Title: Cross compile in Ubuntu for win32 - binutils
Post by: b00 on July 12, 2008, 02:44:37 am
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.
Title: Cross compile in Ubuntu for win32 - binutils
Post by: b00 on July 12, 2008, 02:48:30 am
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.
TinyPortal © 2005-2018