PDA

View Full Version : freepascal on intel osx?



tux
04-07-2006, 08:18 PM
Hey,

im interested in compiling my projects on an intel based mac. theres a power pc version of freepascal but does anyone know about the intel version?

Robert Kosek
04-07-2006, 08:47 PM
The intel version is just a souped up copy of Linux, that's all.

dmantione
04-07-2006, 09:15 PM
Well, it was one of the easiest ports ever, it was done in two days! 8)

No release exists yet. You could try to compile one yourself using the PowerPC version, which runs fine on Intel Macs.

tux
04-07-2006, 09:26 PM
ill try compile it myself and run it in xcode.

now all i need is my mini to arrive :D

WILL
05-07-2006, 12:26 AM
Well, it was one of the easiest ports ever, it was done in two days! 8)

:lol: You FPC guys rock man. Don't let anyone tell ya different. :D

WILL
05-07-2006, 12:30 AM
How come those darn Mac Mini offers never reach Canada. :evil:

I want a little Blue Apple Box I can laugh at here in my very own home dammit! :lol:

But seriously, it would be nice to have around just as a (forgive the pun) mini server for my torrents and to plop Linux on it. Yay, first offical sole development platform. :D

tux
06-07-2006, 08:28 PM
are there any cocoa headers available to create a rendering context for an opengl window? a quick search only seemed to bring up out of date info

dmantione
06-07-2006, 09:09 PM
We just comitted interface units to Apple's universal interfaces. I'm no Mac-expert so cannot judge if the things are there that you need, but some of the units do handle OpenGL.

http://svn.freepascal.org/svn/fpc/trunk/packages/extra/univint/

tux
07-07-2006, 10:57 PM
so my mini arrived today, first things first i checked out a copy of the svn trunk to get started with xcode. when i go to compile fpc i get this:


jons-computer:~/fpc svn jon$ make all
make: -iVSPTPSOTO: Command not found
make: -iSP: Command not found
make: -iTP: Command not found
make: -iSO: Command not found
make: -iTO: Command not found
make compiler_cycle RELEASE=1
make[1]: -iVSPTPSOTO: Command not found
make[1]: -iSP: Command not found
make[1]: -iTP: Command not found
make[1]: -iSO: Command not found
make[1]: -iTO: Command not found
make -C compiler cycle
make[2]: -iVSPTPSOTO: Command not found
make[2]: -iSP: Command not found
make[2]: -iTP: Command not found
make[2]: -iSO: Command not found
make[2]: -iTO: Command not found
make tempclean ppc3.exe
make[3]: -iVSPTPSOTO: Command not found
make[3]: -iSP: Command not found
make[3]: -iTP: Command not found
make[3]: -iSO: Command not found
make[3]: -iTO: Command not found
/bin/rm -f ppcross ppc ppc1.exe ppc2.exe ppc3.exe ./msg2inc.exe
make 'OLDFPC=' next
make[4]: -iVSPTPSOTO: Command not found
make[4]: -iSP: Command not found
make[4]: -iTP: Command not found
make[4]: -iSO: Command not found
make[4]: -iTO: Command not found
make rtlclean rtl
make[5]: -iVSPTPSOTO: Command not found
make[5]: -iSP: Command not found
make[5]: -iTP: Command not found
make[5]: -iSO: Command not found
make[5]: -iTO: Command not found
make -C clean
make: *** clean: No such file or directory. Stop.
make[5]: *** [rtlclean] Error 2
make[4]: *** [next] Error 2
make[3]: *** [ppc1.exe] Error 2
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.-] Error 2
jons-computer:~/fpc svn jon$


any ideas?

dmantione
08-07-2006, 11:18 AM
This means the "fpc" executable cannot be found. Is FPC installed and available in the PATH?

tux
08-07-2006, 11:37 AM
well i tried installing the ppc binary (i assumed it would run ok under rosetta) and it gets a bit further but still with errors:


make compiler_cycle RELEASE=1
make -C compiler cycle
make tempclean ppc3
/bin/rm -f ppcrossppc ppc ppc1 ppc2 ppc3 ./msg2inc
make 'OLDFPC=' next
make rtlclean rtl
make -C /Users/jon/fpc/rtl clean
/bin/rm -f fpcmade.powerpc-darwin Package.fpc ppas.sh script.res link.res
/bin/rm -f *.s *_ppas.sh
make -C darwin clean
/bin/rm -f /Users/jon/fpc/rtl/units/powerpc-darwin/system.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/unixtype.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/ctypes.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/objpas.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/macpas.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/strings.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/sysctl.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/baseunix.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/unixutil.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/unix.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/initc.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/cmem.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/matrix.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/dynlibs.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/dos.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/dl.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/objects.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/printer.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/sockets.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/sysutils.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/typinfo.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/classes.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/math.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/varutils.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/charset.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/ucomplex.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/getopts.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/heaptrc.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/lineinfo.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/errors.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/terminfo.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/termio.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/video.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/crt.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/mouse.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/keyboard.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/console.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/variants.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/types.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/sysctl.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/dateutils.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/sysconst.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/cthreads.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/strutils.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/rtlconsts.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/cwstring.ppu /Users/jon/fpc/rtl/units/powerpc-darwin/fpmkunit.ppu
/bin/rm -f /Users/jon/fpc/rtl/units/powerpc-darwin/math.rst /Users/jon/fpc/rtl/units/powerpc-darwin/varutils.rst /Users/jon/fpc/rtl/units/powerpc-darwin/typinfo.rst /Users/jon/fpc/rtl/units/powerpc-darwin/classes.rst /Users/jon/fpc/rtl/units/powerpc-darwin/variants.rst /Users/jon/fpc/rtl/units/powerpc-darwin/dateutils.rst /Users/jon/fpc/rtl/units/powerpc-darwin/sysconst.rst /Users/jon/fpc/rtl/units/powerpc-darwin/rtlconsts.rst /Users/jon/fpc/rtl/units/powerpc-darwin/fpmkunit.rst
/bin/rm -f fpcmade.powerpc-darwin Package.fpc ppas.sh script.res link.res
/bin/rm -f *.s *_ppas.sh
make -C /Users/jon/fpc/rtl 'OPT=' all
make -C darwin all
/usr/local/bin/ppcppc -dNOMOUSE -Ur -dFPC_USE_LIBC -Ur -Xs -O1r -n -Fi../inc -Fi../powerpc -Fi../unix -Fi../bsd -Fi../bsd/powerpc -Fi../darwin/powerpc -FE. -FU/Users/jon/fpc/rtl/units/powerpc-darwin -dpowerpc -dRELEASE -Us -Sg ../bsd/system.pp
system.pp(257,1) Error: Error while assembling exitcode 1
system.pp(257,1) Fatal: There were 2 errors compiling module, stopping
system.pp(257,1) Fatal: Compilation aborted

and then the terminal is flooded with things like this:


system.pp:39667:no such 386 instruction: `lwz'
system.pp:39668:no such 386 instruction: `li'
system.pp:39669:no such 386 instruction: `addis'
system.pp:39670:more than 1 memory reference in instruction
system.pp:39671:no such 386 instruction: `blt'
system.pp:39672:no such 386 instruction: `li'
system.pp:39673:no such 386 instruction: `addis'
system.pp:39674:invalid character '.' in opcode
system.pp:39675:no such 386 instruction: `beq'
system.pp:39676:invalid character '.' in opcode
system.pp:39677:no such 386 instruction: `beq'
system.pp:39678:invalid character '.' in opcode
system.pp:39679:no such 386 instruction: `bne'
system.pp:39681:no such 386 instruction: `mr'
system.pp:39682:no such 386 instruction: `lwz'
system.pp:39683:no such 386 instruction: `lwz'
system.pp:39684:no such 386 instruction: `lwz'
system.pp:39685:no such 386 instruction: `bl'
system.pp:39686:no such 386 instruction: `mr'
system.pp:39687:operands given don't match any known 386 instruction
system.pp:39688:no such 386 instruction: `bge'
system.pp:39689:no such 386 instruction: `lis'

dmantione
08-07-2006, 01:30 PM
Your compiler is not yet aware of Intel Macs, but it can be circumvented.

Create a script ppc-as which contains:

#!/bin/sh
as -arch ppc $*

Then create also a script for the linker ppc-ld, which contains:

#!/bin/sh
ld -arch ppc $*

... and try "make all OPT=-XPppc".

tux
08-07-2006, 04:02 PM
Sorry, i dont understand what to do with the scripts. do i put them somewhere (and what should the filenames be)? do i run them from the terminal (didnt seem to have any effect)

from the new errors, it seems its still looking for what the scripts turn off


make all OPT=-XPppc

/usr/local/bin/ppcppc -Fu../rtl/units/powerpc-darwin -Fu../packages/base/hash -Fu../packages/base/paszlib -Fu../packages/base/netdb -Fu../packages/base/libasync -Fu../packages/base/pthreads -Fu../fcl/units/powerpc-darwin -Fu../packages/base/pasjpeg -Fu../packages/base/ibase -Fu../packages/base/postgres -Fu../packages/base/mysql -Fu../packages/base/odbc -Fu../packages/base/oracle -Fu../packages/base/sqlite -FE. -FUunits/powerpc-darwin -XPppc -dpowerpc ppdep.pp
Free Pascal Compiler version 2.0.2 [2005/11/15] for powerpc
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: Darwin for PowerPC
Compiling ppdep.pp
Assembling ppdep
ppdep.pp(577,1) Error: Assembler ppcas not found, switching to external assembling
ppdep.pp(577,1) Fatal: There were 1 errors compiling module, stopping
ppdep.pp(577,1) Fatal: Compilation aborted
make: *** [ppdep] Error 1

dmantione
08-07-2006, 06:53 PM
It will search the assembler in the PATH. Apparently it is searching for "ppcas" instead of "ppc-as", that should be easy to fix :D

(Rename the scripts or try "-XPppc-" )

tux
08-07-2006, 07:18 PM
ok great, i think its nearly there, but nearly not. in the main fpc folder im doing "make all OPT=-XPppc" and after about a minute i get this


make -C /Users/jon/fpc/rtl 'OPT=-XPppc' all
make -C darwin all
/Users/jon/fpc/compiler/ppc1 -dNOMOUSE -Ur -dFPC_USE_LIBC -Ur -Xs -O2 -n -Fi../inc -Fi../powerpc -Fi../unix -Fi../bsd -Fi../bsd/powerpc -Fi../darwin/powerpc -FE. -FU/Users/jon/fpc/rtl/units/powerpc-darwin -XPppc -dpowerpc -dRELEASE -Us -Sg ../bsd/system.pp
Error: Error while assembling exitcode 1
Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
as: more than one -arch option (not allowed, use cc(1) instead)
make[7]: *** [system.ppu] Error 1
make[6]: *** [darwin_all] Error 2
make[5]: *** [rtl] Error 2
make[4]: *** [next] Error 2
make[3]: *** [ppc2] Error 2
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.powerpc-darwin] Error 2

looks like its still doing a lot of ppc things... (im hoping to get an intel version out of this)

dmantione
08-07-2006, 07:40 PM
Argh! After bootstrapping the compiler the compiler does know about Intel macs and uses -arch twice, one time by the compiler, one time by our script.

Take the ppc1 from the compiler directory (move it to /usr/local/bin/ppcppc_211 or something.

Then try "make all FPC=/usr/local/bin/ppcppc_211".

About the Intel version. Don't worry, we'll get there. We need to have a PowerPC cross-compiler first.

tux
08-07-2006, 08:14 PM
it worked! where abouts is the new compiler and where do i put it? (the installer did this all for me last time :oops: )

thanks for getting this far dmantione :)

dmantione
08-07-2006, 08:24 PM
Good! You can do "make install" afterwards to install the newly build compiler.

Now the cross-compiler:
* Go to the directory compiler.
* Type "make i386 FPC=/path/to/fpc-source/compiler/ppcppc'
* Now a compiler ppc386 will be built. It is still a PowerPC binary, but instead of PowerPC code it generates i386 code.
* Copy ppc386 to /usr/local/bin

If you have the cross-compiler:
* Go into the root of the FPC source directory again.
* Type "make all FPC=/usr/local/bin/ppc386"
* This should build the Intel release.

tux
08-07-2006, 08:49 PM
ok, it seemed to compile the ppc386 without errors, i copied it to the /usr/local/bin folder and went to compile all again, this is what i got:


jons-computer:~/fpc jon$ make all FPC=/usr/local/bin/ppc386
Makefile:172: *** The Makefile doesn't support target darwin-Fatal:, please run fpcmake first. Stop.

if i run the earlier built ppcppc i get this


jons-computer:~/fpc jon$ ppcppc
Free Pascal Compiler version 2.1.1 [2006/07/08] for powerpc
Copyright (c) 1993-2006 by Florian Klaempfl

compiler options...


if i run ppc386 i get this


jons-computer:~/fpc jon$ ppc386
Fatal: Internal error 2004121201
Fatal: Compilation aborted

dmantione
08-07-2006, 09:11 PM
That Makefile error is because of the broken ppc386. I have no idea where that internalerror comes from, which is kind of bad news :/

Can youy try to "make clean" in the compiler directory first before doing "make i386 FPC=/path/to/compiler"? Before you do that, mjake sure you back up the ppcppc in that directory as it will be deleted.

tux
08-07-2006, 09:44 PM
i did a clean etc and i have the same thing with the ppc386. could this be a problem with the svn trunk copy?

dmantione
09-07-2006, 12:14 PM
That is quite likely. Perhaps it is best if you contact Jonas, he has more experience with this.

tux
09-07-2006, 02:17 PM
hey i managed to get it going!

i used the binary installer from the lazarus snapshot. seems to work well.

thanks for the help :)