Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-07

Building a i686-pc-mingw32 crosscompiler from i686-darwin

14 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adriaan van Os

Has anyone tried to build a Free Pascal Windows crosscompiler on an Intel Mac ? Is this supported ?

First I built and mingw binutils and then I tried

[p17:~/fpc-win32/fpc] adriaan% make all OS_TARGET=win32 CROSSBINDIR=/usr/bin BINUTILSPREFIX=i686-ming32- INSTALL_PREFIX=/usr/local make compiler_cycle RELEASE=1
make -C compiler cycle
make OS_TARGET=darwin CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl make -C /Users/adriaan/fpc-win32/fpc/rtl clean
/bin/rm -f fpcmade.i386-darwin Package.fpc ppas.sh script.res link.res /bin/rm -f *.s *_ppas.sh
make -C darwin clean

.....

/bin/mkdir -p i386/units/i386-win32
/Users/adriaan/fpc-win32/fpc/compiler/ppcross386 -Twin32 -XPi686-ming32- -Xc -Xr -Ur -Xs -O2 -n -Fui386 -Fusystems -Fu/Users/adriaan/fpc-win32/fpc/rtl/units/i386-win32 -Fii386 -FD/usr/bin -FE. -FUi386/units/i386-win32 -dRELEASE -di386 -dGDB -dBROWSERLOG -Fux86 pp.pas Fatal: Can't find unit System used by pp
Fatal: Compilation aborted
make[3]: *** [ppc386.exe] Error 1
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.i386-win32] Error 2

Regards,

Adriaan van Os

Reply by email

Daniël Mantione
to Adriaan van Os

Op Mon, 16 Jul 2007, schreef Adriaan van Os:

Has anyone tried to build a Free Pascal Windows crosscompiler on an Intel Mac ? Is this supported ?

Yes, you don't need a cross-compiler to cross-compile to different operating systems. With FPC 2.1.4+ you don't need binutils either to cross-compile to Win32.

Simply make the rtl:

cd /path/to/fpc/rtl/win32
make

Then simply compile your program:

fpc -Fu/path/to/fpc/rtl/units/i386-win32 -Twin32 myprogram.pas

Happy crosscompiling!

Daniël

Reply by email

Adriaan van Os
to Daniël Mantione
Daniël Mantione wrote 9 lines
Op Mon, 16 Jul 2007, schreef Adriaan van Os: > Has anyone tried to build a Free Pascal Windows crosscompiler on an Intel Mac > ? Is this supported ? Yes, you don't need a cross-compiler to cross-compile to different operating systems. With FPC 2.1.4+ you don't need binutils either to cross-compile to Win32.

Ah, thanks for your reply.

Simply make the rtl: cd /path/to/fpc/rtl/win32 make

I did that and it works. However, it doesn't seem to copy any files to usr/local/lib/fpc/2.3.1/units/i386-win32/. I tried

[p17:fpc/rtl/win32] adriaan% sudo make install
Password:
/usr/bin/install -m 755 -d /usr/local/lib/fpc/2.3.1/units/i386-win32/rtl /usr/bin/install -c -m 644 ../../rtl/units/i386-win32/system.ppu ../../rtl/units/i386-win32/objpas.ppu ../../rtl/units/i386-win32/macpas.ppu ../../rtl/units/i386-win32/buildrtl.ppu ../../rtl/units/i386-win32/sysinitpas.ppu ../../rtl/units/i386-win32/sysinitcyg.ppu ../../rtl/units/i386-win32/sysinitgprof.ppu ../../rtl/units/i386-win32/ctypes.ppu ../../rtl/units/i386-win32/strings.ppu ../../rtl/units/i386-win32/lineinfo.ppu ../../rtl/units/i386-win32/lnfodwrf.ppu ../../rtl/units/i386-win32/heaptrc.ppu ../../rtl/units/i386-win32/matrix.ppu ../../rtl/units/i386-win32/windows.ppu ../../rtl/units/i386-win32/winsock.ppu ../../rtl/units/i386-win32/winsock2.ppu ../../rtl/units/i386-win32/initc.ppu ../../rtl/units/i386-win32/cmem.ppu ../../rtl/units/i386-win32/dynlibs.ppu ../../rtl/units/i386-win32/signals.ppu ../../rtl/units/i386-win32/dos.ppu ../../rtl/units/i386-win32/crt.ppu ../../rtl/units/i386-win32/objects.ppu ../../rtl/units/i386-win32/messages.ppu ../../rtl/units/i386-win32/rtlconsts.ppu ../../rtl/units/i386-win32/sysconst.ppu ../../rtl/units/i386-win32/sysutils.ppu ../../rtl/units/i386-win32/math.ppu ../../rtl/units/i386-win32/types.ppu ../../rtl/units/i386-win32/strutils.ppu ../../rtl/units/i386-win32/dateutils.ppu ../../rtl/units/i386-win32/varutils.ppu ../../rtl/units/i386-win32/variants.ppu ../../rtl/units/i386-win32/typinfo.ppu ../../rtl/units/i386-win32/fgl.ppu ../../rtl/units/i386-win32/classes.ppu ../../rtl/units/i386-win32/convutils.ppu ../../rtl/units/i386-win32/stdconvs.ppu ../../rtl/units/i386-win32/cpu.ppu ../../rtl/units/i386-win32/mmx.ppu ../../rtl/units/i386-win32/charset.ppu ../../rtl/units/i386-win32/ucomplex.ppu ../../rtl/units/i386-win32/getopts.ppu ../../rtl/units/i386-win32/winevent.ppu ../../rtl/units/i386-win32/sockets.ppu ../../rtl/units/i386-win32/printer.ppu ../../rtl/units/i386-win32/video.ppu ../../rtl/units/i386-win32/mouse.ppu ../../rtl/units/i386-win32/keyboard.ppu ../../rtl/units/i386-win32/fmtbcd.ppu ../../rtl/units/i386-win32/winsysut.ppu ../../rtl/units/i386-win32/sharemem.ppu /usr/local/lib/fpc/2.3.1/units/i386-win32/rtl install: ../../rtl/units/i386-win32/rtlconsts.ppu: No such file or directory make: *** [fpc_install] Error 71

Show quoted text 5 lines
Then simply compile your program: fpc -Fu/path/to/fpc/rtl/units/i386-win32 -Twin32 myprogram.pas Happy crosscompiling!

When I copy some of the .o and .ppu files by hand to /usr/local/lib/fpc/2.3.1/units/i386-win32, crosscompiling hello.pas works.

[p17:~/fpc/testfpc] adriaan% fpc -Fu/path/to/fpc/rtl/units/i386-win32 -Twin32 hello.pas Free Pascal Compiler version 2.3.1 [2007/07/14] for i386 Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling hello.pas
Linking hello.exe
9 lines compiled, 0.1 sec, 27504 bytes code, 1144 bytes data

and hello.exe actually runs at the other side of the fence.

Regards,

Adriaan van Os

Reply by email

Daniël Mantione
to Adriaan van Os

Op Mon, 16 Jul 2007, schreef Adriaan van Os:

/usr/local/lib/fpc/2.3.1/units/i386-win32/rtl install: ../../rtl/units/i386-win32/rtlconsts.ppu: No such file or directory make: *** [fpc_install] Error 71

Most of the win32 rtl is built by a build unit called buildrtl.pp in the directory rtl/win32. rtlconsts is listed in this unit and should have been compiled. Could you check wether the compiler does the actual compilation of rtlconsts? If yes, where did it place the rtlconsts.ppu?

Daniël

Reply by email

Adriaan van Os
to Daniël Mantione
Daniël Mantione wrote 10 lines
Op Mon, 16 Jul 2007, schreef Adriaan van Os: > /usr/local/lib/fpc/2.3.1/units/i386-win32/rtl > install: ../../rtl/units/i386-win32/rtlconsts.ppu: No such file or directory > make: *** [fpc_install] Error 71 Most of the win32 rtl is built by a build unit called buildrtl.pp in the directory rtl/win32. rtlconsts is listed in this unit and should have been compiled. Could you check wether the compiler does the actual compilation of rtlconsts? If yes, where did it place the rtlconsts.ppu?

There was a /rtlconsts.ppu in objpas, which caused the problem. I think this was the result of my various experiments this morning. After checking out clean sources, "sudo make install worked" and also the crosscompiler.

[p17:~/fpc/testfpc] adriaan% fpc -Twin32 hello.pas Free Pascal Compiler version 2.3.1 [2007/07/16] for i386 Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling hello.pas
Linking hello.exe
9 lines compiled, 0.4 sec, 27504 bytes code, 1144 bytes data

Thanks,

Adriaan van Os

Reply by email

Daniël Mantione
to Adriaan van Os: Ah, thanks for your reply. I did that and it works. However, it doesn't seem to copy any…

Op Mon, 16 Jul 2007, schreef Adriaan van Os:

and hello.exe actually runs at the other side of the fence.

Note that you can install Wine (I'm not sure though how the Darwin port hasprogressed) to do testing. With Wine you can do the full development without a Windows computer and you only need to do some final compatibility testing on Win32.

Daniël

Reply by email

Vincent Snijders
to Daniël Mantione
Daniël Mantione wrote 9 lines
Op Mon, 16 Jul 2007, schreef Adriaan van Os: > and hello.exe actually runs at the other side of the fence. Note that you can install Wine (I'm not sure though how the Darwin port hasprogressed) to do testing. With Wine you can do the full development without a Windows computer and you only need to do some final compatibility testing on Win32.

Does wine run on intelmacs too? I didn't know that.

Vincent

Reply by email

Daniël Mantione
to Vincent Snijders

Op Mon, 16 Jul 2007, schreef Vincent Snijders:

Show quoted text 12 lines
Daniël Mantione schreef: > > Op Mon, 16 Jul 2007, schreef Adriaan van Os: > > > and hello.exe actually runs at the other side of the fence. > > Note that you can install Wine (I'm not sure though how the Darwin port > hasprogressed) to do testing. With Wine you can do the full development > without a Windows computer and you only need to do some final > compatibility testing on Win32. Does wine run on intelmacs too? I didn't know that.

Well, I see articles like this http://tweakers.net/nieuws/44225 , so people are definately working on it.

Daniël

Reply by email

Felipe Monteiro de Carvalho
to Vincent Snijders: Does wine run on intelmacs too? I didn't know that. Vincent

Since we are on the topic, I've been using Parallels Desktop for Mac with a lot of success. It's pretty cheap, and you have 2 weeks to see if you want to buy it. They have some bugs when running Linux, but their Windows support is incredible. Windows seams to actually work better and faster then in my PC Notebook =) Really

One downside is having to buy a Windows license only for this, but this wasn't a problem for me as my University gives me free MS products througth the Microsoft Academic Alliance.

Felipe Monteiro de Carvalho

Reply by email

Adriaan van Os
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 5 lines
Since we are on the topic, I've been using Parallels Desktop for Mac with a lot of success. It's pretty cheap, and you have 2 weeks to see if you want to buy it. They have some bugs when running Linux, but their Windows support is incredible. Windows seams to actually work better and faster then in my PC Notebook =) Really

Yes, I am running Parallels Desktop for Mac for that purpose also. I tried CrossOver some time ago and weren't impressed. Maybe things have improved since.

Regards,

Adriaan van Os

Reply by email

Adriaan van Os
to Daniël Mantione: Op Mon, 16 Jul 2007, schreef Adriaan van Os: Yes, you don't need a cross-compiler to…
Daniël Mantione wrote 5 lines
Then simply compile your program: fpc -Fu/path/to/fpc/rtl/units/i386-win32 -Twin32 myprogram.pas Happy crosscompiling!

This is how far I got with the crosscompiler:

[p17:~/fpc/svn/lazarus] adriaan% make OS_TARGET=win32

....

Free Pascal Compiler version 2.3.1 [2007/07/16] for i386 Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling lazarus.pp
lazarus.pp(118,1) Error: resource compiler not found, switching to external mode Linking ../lazarus.exe
lazarus.pp(118,1) Error: Can't open object file: ../units/i386-win32/fpc-res.or lazarus.pp(118,1) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted
make[2]: *** [lazarus.exe] Error 1
make[1]: *** [ide] Error 2
make: *** [ide] Error 2

[p17:~/fpc/svn/lazarus] adriaan% which fpcres
/usr/bin/fpcres

[p17:~/fpc/svn/lazarus] adriaan% which windres
/usr/bin/windres

[p17:~/fpc/svn/lazarus] adriaan% pushd units/i386-win32/ ~/fpc/svn/lazarus/units/i386-win32 ~/fpc/svn/lazarus

[p17:lazarus/units/i386-win32] adriaan% windres --output-format coff --target=pe-i386 fpc-res.res fpc-res.or

[p17:lazarus/units/i386-win32] adriaan% popd
~/fpc/svn/lazarus

[p17:~/fpc/svn/lazarus] adriaan% make OS_TARGET=win32

....

make -C ide ide
../tools/svn2revisioninc .. revision.inc
Retrieved revision with svnversion.
Created revision.inc for revision: 11524
make lazarus.res
make[2]: `lazarus.res' is up to date.
make --assume-new=lazarus.pp lazarus.exe OPT=' -WG ' /usr/bin/ppc386 -Twin32 -XPi386-win32- -Xr -gl -Fu../lcl/units/i386-win32 -Fu../lcl/units/i386-win32/win32 -Fu../components/codetools/units/i386-win32 -Fu../components/synedit/units/i386-win32 -Fu../components/custom -Fu../components/mpaslex -Fu../ideintf/units/i386-win32 -Fu../designer -Fu../designer/jitform/units/i386-win32 -Fu../debugger -Fu../converter -Fu../packager -Fu../packager/units/i386-win32 -Fu../units/i386-win32 -Fu. -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/hash -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/paszlib -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/netdb -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/regexpr -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/pasjpeg -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/ibase -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/postgres -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/mysql -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/odbc
-Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/oracle -Fu/usr/local/lib/fpc/2.3.1/units/i386-win32/sqlite -Fiinclude -Fiinclude/win32 -Fi../images -FE.. -FU../units/i386-win32 -WG -di386 lazarus.pp
Free Pascal Compiler version 2.3.1 [2007/07/16] for i386 Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling lazarus.pp
lazarus.pp(118,1) Error: resource compiler not found, switching to external mode Linking ../lazarus.exe
lazarus.pp(118,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
make[2]: *** [lazarus.exe] Error 1
make[1]: *** [ide] Error 2
make: *** [ide] Error 2

But maybe this is something to ask on the Lazarus mailing list.

Regards,

Adriaan van Os

Reply by email

Daniël Mantione
to Adriaan van Os

Op Tue, 17 Jul 2007, schreef Adriaan van Os:

lazarus.pp(118,1) Error: resource compiler not found, switching to external mode

Can you try -vt to see if and in what directories the compiler tries to search windres?

It could very well be that the compiler searches for windres.exe, this would be a bug.

Daniël

Reply by email

Adriaan van Os
to Daniël Mantione
Daniël Mantione wrote 11 lines
Op Tue, 17 Jul 2007, schreef Adriaan van Os: > lazarus.pp(118,1) Error: resource compiler not found, switching to external > mode Can you try -vt to see if and in what directories the compiler tries to search windres? It could very well be that the compiler searches for windres.exe, this would be a bug.

Ah, yes, it was looking for "i386-win32-windres"

Searching file i386-win32-windres... not found
Searching file /usr/bin/i386-win32-windres... not found Searching file /bin/i386-win32-windres... not found Searching file /sbin/i386-win32-windres... not found Searching file /usr/bin/i386-win32-windres... not found Searching file /usr/sbin/i386-win32-windres... not found Searching file /usr/local/bin/i386-win32-windres... not found lazarus.pp(118,1) Error: resource compiler not found, switching to external mode

[p17:~/fpc/svn/lazarus] adriaan% ls -l /usr/bin/windres* lrwxr-xr-x 1 root wheel 23 Jul 16 16:11 /usr/bin/windres -> i686-pc-mingw32-windres

On my mac, /usr/bin/windres is actually a symbolic link to i686-pc-mingw32-windres, but after adding the i386-win32-windres symbolic link, lazarus cross-builds with success !

[[p17:~/fpc/svn/lazarus] adriaan% ls -l
total 189448
drwxr-xr-x 6 root adriaan 204 Jul 16 16:44 C:lazarus -rw-r--r-- 1 adriaan adriaan 1447 Jun 17 2006 COPYING -rw-r--r-- 1 adriaan adriaan 18088 Jun 17 2006 COPYING.GPL -rw-r--r-- 1 adriaan adriaan 25275 Jun 17 2006 COPYING.LGPL -rw-r--r-- 1 adriaan adriaan 1259 Jun 17 2006 COPYING.modifiedLGPL -rw-r--r-- 1 adriaan adriaan 114993 Jun 7 11:24 Makefile -rw-r--r-- 1 adriaan adriaan 3685 Jan 11 2007 Makefile.fpc -rw-r--r-- 1 adriaan adriaan 2285 Jan 11 2007 README.txt drwxr-xr-x 39 adriaan adriaan 1326 Jul 16 16:03 components drwxr-xr-x 8 adriaan adriaan 272 Jun 7 11:23 converter drwxr-xr-x 33 adriaan adriaan 1122 Jan 11 2007 debian drwxr-xr-x 36 adriaan adriaan 1224 Jul 12 17:30 debugger drwxr-xr-x 35 adriaan adriaan 1190 Jul 12 17:30 designer drwxr-xr-x 52 adriaan adriaan 1768 Jul 12 17:31 doceditor drwxr-xr-x 23 adriaan adriaan 782 Jul 16 16:03 docs drwxr-xr-x 95 adriaan adriaan 3230 Jul 16 16:03 examples drwxr-xr-x 261 adriaan adriaan 8874 Jul 17 12:09 ide drwxr-xr-x 89 adriaan adriaan 3026 Jul 16 16:07 ideintf drwxr-xr-x 115 adriaan adriaan 3910 Jul 17 11:17 images drwxr-xr-x 4 adriaan adriaan 136 Jun 7 11:23 install drwxr-xr-x 31 adriaan adriaan 1054 Jul 16 16:03 languages -rw-r--r-- 1 adriaan adriaan 61941269 Jul 17 12:10 lazarus.exe -rw-r--r-- 1 adriaan adriaan 24999860 Jul 17 12:10 lazbuild.exe drwxr-xr-x 109 adriaan adriaan 3706 Jul 17 10:55 lcl -rw-r--r-- 1 adriaan adriaan 2082 Jun 7 11:24 localize.bat -rwxr-xr-x 1 adriaan adriaan 1732 Jan 11 2007 localize.sh drwxr-xr-x 41 adriaan adriaan 1394 Jul 16 16:07 packager -rw-r--r-- 1 adriaan adriaan 9850570 Jul 17 12:10 startlazarus.exe drwxr-xr-x 14 adriaan adriaan 476 Jun 7 11:22 test drwxr-xr-x 34 adriaan adriaan 1156 Jul 16 16:48 tools drwxr-xr-x 4 adriaan adriaan 136 Jul 17 11:04 units

The "C:lazarus" directory is a cross-installation problem, of course, I will look at that next.

Regards,

Adriaan van Os

Reply by email

Adriaan van Os
to Daniël Mantione: Op Mon, 16 Jul 2007, schreef Adriaan van Os: Note that you can install Wine (I'm not sure…
Daniël Mantione wrote 9 lines
Op Mon, 16 Jul 2007, schreef Adriaan van Os: > and hello.exe actually runs at the other side of the fence. Note that you can install Wine (I'm not sure though how the Darwin port hasprogressed) to do testing. With Wine you can do the full development without a Windows computer and you only need to do some final compatibility testing on Win32.

The amusing result <http://www.microbizz.nl/lazarus-crossover.png>.

Regards,

Adriaan van Os

Reply by email