Re: [fpc-pascal] cross-compiling
> Date: Fri, 3 Apr 2026 23:55:19 +0100 > From: Kevin Lyda > To: FPC-Pascal users discussions > Subject: [fpc-pascal] Cross-compiling > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > tl;dr Is there a docker image(s) with an fpc compiler that supports a slew > of platforms? > > For April Fools Day this year I released a command.com shell for Unix[0]. > It included a version of the Turbo Pascal 3.0 "IDE" and it was released for > a slew of platforms. This is rather easy to accomplish with the go tool - > you just set some environment variables and it works. > > I'm winding down my career and have a number of fun projects in mind. My > goal this year was to release one written in Pascal - one that would be > fun, but also hopefully useful. But I ran out of time so I did the simpler > Go one. Now that I've slipped the release date a year I'd like to make sure > I can release it just as polished as I did for the silly one I did this > year. And part of that involves releasing for all the mainstream OS's: > linux, freebsd, openbsd, netbsd, ilumos, aix and darwin. And also all the > mainstream architectures: riscv64, arm64, ppc, i386 and amd64. Now, fpc > might not support all thes, but it likely supports many of them and I'd > ideally like to build them all in one runner. I can install the forgejo > runner on a slew of libvirt machines and configure them all, but that's a > rather heavy solution. > > I'm working on building an fpc cross compiler[2] for a number of > architectures, but am I triodding well-trodden ground? Does something like > this already exist? I can't find anything, but maybe I'm not looking in the > right places. What I've built[3] supports: > > fpc -Px86_64 -Tlinux > fpc -Paarch64-Tlinux > fpc -Parm-Tlinux > fpc -Pi386 -Tlinux > fpc -Ppowerpc64 -Tlinux > fpc -Pmipsel -Tlinux > fpc -Px86_64 -Tfreebsd > fpc -Px86_64 -Tnetbsd > fpc -Px86_64 -Topenbsd > > I think I'd need to do darwin on an actual Mac and not sure what other > architectures are supported for the *BSDs. It's a large container as it is. > > As an aside, if there's someone out there wanting to collaborate on a TUI > application that would have a filesystem focus, please reach out. I'm not > close to that part, but I might be later in the year and I've honestly > never made one. Alternatively, if folks could suggest good tview TUI > applications to read, that would be great. > > Thanks, > > Kevin > > [0]: https://codeberg.org/lyda/command-com/releases > [1]: > https://codeberg.org/lyda/command-com/src/branch/main/.forgejo/workflows/release.yml > [2]: https://codeberg.org/lyda/fpc-docker > [3]: https://codeberg.org/lyda/fpc-docker/packages > > -- > Kevin Lyda > Galway, Ireland Slightly related: I maintain the package description for Freepascal for macports, a package manager for macOS. It also includes a couple of cross-compilers. I also did this with fink, a similar package manager, but stopped doing so in favor of macports. You can find the macports package description file here: https://github.com/macports/macports-ports/blob/master/lang/fpc/Portfile I do not really know docker, and you may not need cross compiling, But in case, have a look at this page about binutils and complete the table, if you figured out missing platforms: https://wiki.lazarus.freepascal.org/Binutils Have fun - Michael. ___ fpc-pascal maillist - [email protected] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling Linux to OS X
On 27/03/2019 22:28, Torsten Bonde Christiansen wrote: > make distclean crossall crossinstall OPT="-O2 -XX -CX -Xs -Xd -Fl/home/epidata/Apple/SDKs/MacOSX10.5.sdk/usr/lib" CPU_TARGET=i386 OS_TARGET=darwin BINUTILSPREFIX=i686-apple-darwin10- INSTALL_PREFIX=~/fpc FPMAKEOPT="-o -Aas-darwin" It surprises me this works with FPC 3.0, as cross-compilation-specific options should be passed via CROSSOPT instead of OPT. Anyway, the non-hacky way to specify a cross-compilation sysroot is with -XR instead of -Xd -Fl. So try this instead: make distclean crossall crossinstall OPT="-O2 -XX -CX -Xs" CROSSOPT="-XR/home/epidata/Apple/SDKs/MacOSX10.5.sdk -Aas-darwin" CPU_TARGET=i386 OS_TARGET=darwin BINUTILSPREFIX=i686-apple-darwin10- INSTALL_PREFIX=~/fpc If you split the make invocations into one per command, you can also add -j 4 FPMAKEOPT="-T 4" for "crossall" to significantly speed up the process. Jonas ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling: Win 32 to 64
Sorry guys, I've just forgot to setup in Lazarus, Config and Target this: -Twin64 _AND_ -Px86_64 parameters. In the first time, I just set -Twin32 but -P stayed "(default)":| ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling Windows to arm-linux
On 07/22/2013 09:52 PM, John Hansen wrote: I am working on an API library for the new LEGO MINDSTORMS EV3 programmable brick. The brick is running Linux on a TI AM1808 ARM chip. Does the EV3 provide any graphic ? If not, you will need to set up a remote debugging environment, best using Lazarus. In theory this should be possible in two ways: - using gdbserver on the target and a "cross gdb" on the PC, the two connected via the gdb-propriety protocol (here stopping a running project from the PC other than on a breakpoint is not possible ) , or - using standard ARM gdb on the target and access same from Lazarus using SSH (no such limitations, but Lazarus does not provide this "out of the box" (AFAIR, the appropriate code is not decently tested and commented out). AFAIK neither way has been set up successfully yet. A friend of mine and myself tried to do this for our ARM based NAS devices by QNAP, but while we did not give up at the moment the project is stalled If the EV3 is powerful enough to run a VNC server, same can be used an X Server for a GUI interface and that way you might be able to run the Lazarus IDE native on the device to do comfortable debugging. I tried to run a binary for the first time that used TThread and I got a run-time error message that, via Google, told me I needed to use cthreads as the first unit in my program source code. After adding that to my uses statement I now get linker errors. lcd_test.dpr: warning: 31: "crti.o" not found, this will probably cause a linking failure ... I ran into a similar problem, doing native compiling on the ARM, trying to compile a project that includes Synapse. I found that the "crt" stuff is necessary for attaching to dynamic libraries (.so files in Linux). It is linked in, when the project might _possibly_ intend to attach to a dynamic library. I was able to link the project by providing some (AFAIR *.so) files and set the linker path appropriately. If you in fact want to use TThread, there are some additional considerations: The normal "Lazarus" programming way is to have a MainThread and Worker threads. The main thread in "normal" Lazarus applications is based on an event queue, so that the application programmer can do "event driven programming" and does not have to bother about a "main loop". The worker threads can notify the main thread by pushing events into the queue. Unfortunately, in Lazarus, none of the multiple "LCL Widget Type"s is able to _not_ attach to a GUI API of the system it runs on, while providing the said event queue. (Of course when using a GUI, events generated by TThread instances are merged with events generated by the GUI. ) So you you are on your own when using threads on non-GUI enabled systems. -Michael ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling Windows to arm-linux
John Hansen wrote: lcd_test.dpr: warning: 31: "crti.o" not found, this will probably cause a linking failure lcd_test.dpr: warning: 31: "crtbegin.o" not found, this will probably cause a linking failure lcd_test.dpr: warning: 31: "crtend.o" not found, this will probably cause a linking failure lcd_test.dpr: warning: 31: "crtn.o" not found, this will probably cause a linking failure D:\FPC\2.7.1\units\arm-linux\rtl\cprt0.o: In function `_haltproc_eabi': (.text+0x88): undefined reference to `_fini' D:\FPC\2.7.1\units\arm-linux\rtl\cprt0.o: In function `_haltproc_eabi': (.text+0x90): undefined reference to `_init' Does anyone have any idea what is going wrong and how to fix this problem? It sounds like it might be that I need to have the order that it tries to link the files and libraries modified so that it links the C runtime .o files after my own code or something like that. But how do I accomplish that feat? This is a placeholder pending somebody more experienced commenting. A number of people have reported similar problems over the last few months, e.g. http://comments.gmane.org/gmane.comp.compilers.free-pascal.general/32106 -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling Windows to arm-linux
For some years ago I had a similar problem.
I solved it by forcing the use of specific libs.
See my old test programme below.
Carsten
> lcd_test.dpr: warning: 31: "crti.o" not found, this will probably cause a
> linking failure
> lcd_test.dpr: warning: 31: "crtbegin.o" not found, this will probably cause a
> linking failure
> lcd_test.dpr: warning: 31: "crtend.o" not found, this will probably cause a
> linking failure
> lcd_test.dpr: warning: 31: "crtn.o" not found, this will probably cause a
> linking failure
program testthreads;
{$mode objfpc}
{$RANGECHECKS ON}
{$OVERFLOWCHECKS ON}
{$S+ STACK CHECKING ON}
{$SMARTLINK ON}
{$TYPEINFO ON}
{$LONGSTRINGS OFF}
uses
cthreads,
sysutils,
dos;
{$IFDEF ARM9LINUX}
{$IFDEF Ulibc}
{$linklib ulibc}{Force use of uLibC}
{$linklib gcc_s}{Force use of gcc_s}
{$linklib pthread} {Force use of pthread-0.9.27}
{$DEFINE IO_WORKAEAROUND}
{$ENDIF}
{$ENDIF}
const
threadcount = 10;
var
finished : longint;
ta:array[1..threadcount] of LongWord;
(*
{$I-}{Input/output checking}
Function FileExists(s:shortstring):integer;
var
f:file;
mvi:integer;
Begin
assign(f,s);
reset(f);
FileExists:=ioResult;
close(f);
mvi:=ioResult;
End;
{$I+}{Input/output checking}
*)
(*
Function FileExists(s:shortstring):boolean;
Begin
Exec('/bin/ls',s+'>NULL');
FileExists:=Lo(DosExitCode)=0;
End;
*)
function fu(p : pointer) : longint;
Var
f:file;
Begin
finished:=succ(finished);
Writeln('thread ',finished,' started');
assign(f,IntToStr(finished));
rewrite(f);
close(f);
sleep(1000+finished*1000);
Writeln('thread ',finished,' stopped');
finished:=pred(finished);
End;
var
i : longword;
b:boolean;
Begin
WriteLn('<0>',paramstr(0));
WriteLn('<1>',paramstr(1));
WriteLn('<2>',paramstr(2));
WriteLn('',GetEnv('USER'));
WriteLn(fileExists('1'));
WriteLn(fileExists('11'));
finished:=0;
for i:=1 to threadcount do
begin
BeginThread(@fu,nil,ta[i]);
end;
sleep(1000);
while finished>0 do;
Writeln(finished);
try
b:=fileExists('1');
except
WriteLn('---');
end;
WriteLn(b);
try
b:=fileExists('11');
except
WriteLn('---');
end;
WriteLn(b);
End.
___
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling FPC trunk to Win x64 fails using fpcup - make file problems?
On 1-11-2012 16:11, Jonas Maebe wrote: > > On 01 Nov 2012, at 16:04, Reinier Olislagers wrote: > >> I wonder if the problems below are caused by wrong make files or >> problems in fpcup: >> (fpc trunk, Windows; fpcup compiles fpc x86+Lazarus fine, then tries an >> x64 cross compile followed by an LCL cross compile): > > It's probably the same problem you had last time: the fact that "make > distclean" does not work properly. In the mean time, it has been partially > fixed in that running "make distclean" twice right after each other does > clean everything. Try that and building then. > Thanks, Jonas, changing fpcup to run make distclean 2x seemed to fix this. (Leaving some LCL x64 problems but that's another story) ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling FPC trunk to Win x64 fails using fpcup - make file problems?
On 1-11-2012 16:11, Jonas Maebe wrote: > > On 01 Nov 2012, at 16:04, Reinier Olislagers wrote: > >> I wonder if the problems below are caused by wrong make files or >> problems in fpcup: >> (fpc trunk, Windows; fpcup compiles fpc x86+Lazarus fine, then tries an >> x64 cross compile followed by an LCL cross compile): > > It's probably the same problem you had last time: the fact that "make > distclean" does not work properly. In the mean time, it has been partially > fixed in that running "make distclean" twice right after each other does > clean everything. Try that and building then. Thanks Jonas - meanwhile I did implement a radical distclean alternative. You're right, I should really check again with a clean slate (i.e. clean svn checkout). Anyway, great news about the double distclean fixing things, I can fairly easily use that in fpcup as a workaround rather than trying to duplicate things! Thanks, Reinier ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling FPC trunk to Win x64 fails using fpcup - make file problems?
On 01 Nov 2012, at 16:04, Reinier Olislagers wrote: > I wonder if the problems below are caused by wrong make files or > problems in fpcup: > (fpc trunk, Windows; fpcup compiles fpc x86+Lazarus fine, then tries an > x64 cross compile followed by an LCL cross compile): It's probably the same problem you had last time: the fact that "make distclean" does not work properly. In the mean time, it has been partially fixed in that running "make distclean" twice right after each other does clean everything. Try that and building then. Jonas___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling Win64=>Win32 fails
On 20-7-2012 13:11, Jonas Maebe wrote: > > On 20 Jul 2012, at 12:20, Reinier Olislagers wrote: > >> I've been extending fpcup, trying to add Win64=>Win32 cross compiler ... >> see latest revision on >> https://bitbucket.org/reiniero/fpcup/changesets >> >> With FPC trunk, I get this error: >> fpcdefs.inc(216,2) Error: User defined: Cross-compiling from systems >> without support for an 80 bit extended floating point type to i386 is >> not yet supported at this time >> >> Is there anything I can do about this? > > Finish the 80 bit floating point emulation routines (/rtl/inc/sfpux80.pp and > the files it includes) and integrate their use into the compiler. > Thanks Jonas, Very clear answer, thanks. Having had a brief look at the softfpu code I suspect it's out of my league (at least as far as getting error free results)... Reinier ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling Win64=>Win32 fails
On 20 Jul 2012, at 12:20, Reinier Olislagers wrote: > I've been extending fpcup, trying to add Win64=>Win32 cross compiler ... > see latest revision on > https://bitbucket.org/reiniero/fpcup/changesets > > With FPC trunk, I get this error: > fpcdefs.inc(216,2) Error: User defined: Cross-compiling from systems > without support for an 80 bit extended floating point type to i386 is > not yet supported at this time > > Is there anything I can do about this? Finish the 80 bit floating point emulation routines (/rtl/inc/sfpux80.pp and the files it includes) and integrate their use into the compiler. Jonas___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
On 31/05/12 17:59, Jonas Maebe wrote: > > You can try filing a bug with binutils of course, but I don't think > it will be considered a bug (although you can always ask to add an > option to get the behaviour you want). Thanks Jonas, I agree that this is not likely to be considered a bug by GNU but would be "nice to have" as an option for ld. I might suggest it. Bruce. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
Bruce Tulloch wrote on Thu, 31 May 2012: On 31/05/12 01:40, Jonas Maebe wrote: That's correct. It seems that -XR isn't completely implemented on Linux in the compiler. Could you try, *instead* of using -XR, to use -k--sysroot=/full/path/to/crossroot/ ? I replaced the -XR option with -k--sysroot=/mnt/engels and that works (ie, you are correct, -XR does not appear to pass the sysroot to the linker) No, on Linux it prepends the search paths with the -XR path internally in the compiler. The reason is that not all GNU binutils builds support the --sysroot parameter, and especially when -XR was implemented it wasn't very commonplace yet. That should probably be changed. which does not right to me. It looks like --sysroot is not analogous to chroot as far as the linker is concerned and symlinks are dereferenced literally. That's correct, --sysroot is not the same as a chroot, and I doubt it was ever meant to be. All it does is prepend the sysroot path to all searched files. It seems quite reasonable to me that in certain situations someone would want to set up their library directory with symlinks pointing to other locations on their system (e.g. for sharing files located elsewhere). So if you want to simply copy files from another system, you'll indeed have to change some symlinks. You can try filing a bug with binutils of course, but I don't think it will be considered a bug (although you can always ask to add an option to get the behaviour you want). Jonas ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
In follow up, I updated and rebuilt the latest binutils http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.gz and tried the patch associated with this bug report: http://sourceware.org/bugzilla/show_bug.cgi?id=10340 to see if my problem was due to this bug. It does not appear to be: the link problem I've described remains true. I'm thinking Tony Whyman's suggestion (building inside a chroot on a 64/32 bit host platform) is probably the best way forward for me now but there does look like there's a problem with FPC (i.e. handling of -XR apropos the ld) and GNU ld (i.e. the failure to prepend sysroot for symlink dereferenced library files). If you concur on the latter point, perhaps it might be worth reporting upstream to GNU? Bruce. On 31/05/12 10:39, Bruce Tulloch wrote: > On 31/05/12 01:40, Jonas Maebe wrote: >> >>> I'm thinking that ld should be looking at: >>> >>> /mnt/engels/lib/libpthread.so.0 >>> >>> but according to the error message it's looking at: >>> >>> /lib/libpthread.so.0 >>> >>> which read literally would explain the error. >> >> That's correct. It seems that -XR isn't completely implemented on Linux in >> the compiler. Could you try, *instead* of using -XR, to use >> -k--sysroot=/full/path/to/crossroot/ ? > > I replaced the -XR option with > > -k--sysroot=/mnt/engels > > and that works (ie, you are correct, -XR does not appear to pass the > sysroot to the linker) but there's another catch. Now I'm getting: > > x86_64-linux-ld: skipping incompatible /mnt/engels/usr/lib64/libdl.so > when searching for -ldl > > this library (on /mnt/engels) **is compatible** but it is a symlink: > > /usr/lib64/libdl.so -> /lib/libdl.so.2 > > Given the specified --sysroot the linker should be looking at > > /mnt/engels/lib/libdl.so.2 > > but I'm guessing it's looking at > > /lib/libdl.so.2 > > which does not right to me. It looks like --sysroot is not analogous to > chroot as far as the linker is concerned and symlinks are dereferenced > literally. > > For completeness I added > > -XR/mnt/engels > > as well, so all the (other) linker search paths are prepended with > /mnt/engels. This ended up producing a slightly errnoeous message: > > x86_64-linux-ld: skipping incompatible /mnt/engels/usr/lib64 > //libdl.so when searching for -ldl > > Note the "//" in the reported path name before libdl.so. > > This time it also reported the same error for glibc: > > x86_64-linux-ld: skipping incompatible /mnt/engels/usr/lib64//libglib- > 2.0.so when searching for -lglib-2.0 > > again with the erroneous "//". > > This glibc library is also a symlink to the /lib directory on engels. > > I tried adding -k-rpath-link options to tell the linker to look in the > relevant paths under /mnt/engels but all to no avail. > > Bruce. > ___ > fpc-pascal maillist - [email protected] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
On 31/05/12 01:40, Jonas Maebe wrote: > >> I'm thinking that ld should be looking at: >> >> /mnt/engels/lib/libpthread.so.0 >> >> but according to the error message it's looking at: >> >> /lib/libpthread.so.0 >> >> which read literally would explain the error. > > That's correct. It seems that -XR isn't completely implemented on Linux in > the compiler. Could you try, *instead* of using -XR, to use > -k--sysroot=/full/path/to/crossroot/ ? I replaced the -XR option with -k--sysroot=/mnt/engels and that works (ie, you are correct, -XR does not appear to pass the sysroot to the linker) but there's another catch. Now I'm getting: x86_64-linux-ld: skipping incompatible /mnt/engels/usr/lib64/libdl.so when searching for -ldl this library (on /mnt/engels) **is compatible** but it is a symlink: /usr/lib64/libdl.so -> /lib/libdl.so.2 Given the specified --sysroot the linker should be looking at /mnt/engels/lib/libdl.so.2 but I'm guessing it's looking at /lib/libdl.so.2 which does not right to me. It looks like --sysroot is not analogous to chroot as far as the linker is concerned and symlinks are dereferenced literally. For completeness I added -XR/mnt/engels as well, so all the (other) linker search paths are prepended with /mnt/engels. This ended up producing a slightly errnoeous message: x86_64-linux-ld: skipping incompatible /mnt/engels/usr/lib64 //libdl.so when searching for -ldl Note the "//" in the reported path name before libdl.so. This time it also reported the same error for glibc: x86_64-linux-ld: skipping incompatible /mnt/engels/usr/lib64//libglib- 2.0.so when searching for -lglib-2.0 again with the erroneous "//". This glibc library is also a symlink to the /lib directory on engels. I tried adding -k-rpath-link options to tell the linker to look in the relevant paths under /mnt/engels but all to no avail. Bruce. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
On 30 May 2012, at 01:50, Bruce Tulloch wrote: > I tried --with-sysroot for configure in buildcrossbinutils and it does > not appear to make any difference. I still get the error > "/usr/local/opt/binutils/bin/x86_64-linux-ld: skipping incompatible > /lib/libpthread.so.0 when searching for /lib/libpthread.so.0" at the > link phase. > > I'm thinking that ld should be looking at: > > /mnt/engels/lib/libpthread.so.0 > > but according to the error message it's looking at: > > /lib/libpthread.so.0 > > which read literally would explain the error. That's correct. It seems that -XR isn't completely implemented on Linux in the compiler. Could you try, *instead* of using -XR, to use -k--sysroot=/full/path/to/crossroot/ ? Jonas___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
Thanks Jonas, I tried --with-sysroot for configure in buildcrossbinutils and it does not appear to make any difference. I still get the error "/usr/local/opt/binutils/bin/x86_64-linux-ld: skipping incompatible /lib/libpthread.so.0 when searching for /lib/libpthread.so.0" at the link phase. I'm thinking that ld should be looking at: /mnt/engels/lib/libpthread.so.0 but according to the error message it's looking at: /lib/libpthread.so.0 which read literally would explain the error. FWIW I have attached the buildcrossbinutils build log in case there's a clue in there. Unless you have any other suggestions I might just give up and upgrade my mobile development environment to an x86_64 capable netbook and run a mixed 64/32 bit system to build 64 bit (and 32 bit) targets. I'm guessing not many people attempt to do it the other way around these days so I might as well join the 64 bit party... Cheers, Bruce. On 29/05/12 18:45, Jonas Maebe wrote: > > Bruce Tulloch wrote on Tue, 29 May 2012: > >> Closer, but not quite there yet... > [...] >> fpcfixes_2.6/cross/buildcrossbinutils > > Try adding --with-sysroot to the configure flags in that script. > > > Jonas > ___ > fpc-pascal maillist - [email protected] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal log-x86_64-linux.gz Description: application/gzip ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
Hi Tony, I use Debian as my Debian derived distro :-) I agree a minimal chroot environment for each target is a good solution but it's predicated on running a 64-bit kernel on the host (which I am trying to avoid so I can use this setup on a 32-bit capable netbook). Looks like I might have to abandon the idea (cross compiling for a x86_64 target on a i386 host) and upgrade my mobile development platform to something with an x86_64 capable CPU in it :-/ I'll see if Jonas has any more ideas. Cheers, Bruce. On 29/05/12 18:40, Tony Whyman wrote: > Bruce, > > If you are using a Debian derived distribution such as Ubuntu, you might > find it easier to use debootstrap to create a 64 bit environment on your > system and compile the program in that environment (see > https://help.ubuntu.com/community/DebootstrapChroot for a guide). Then > you can be sure that you have all the correct libraries in their > standard paths, etc. > > In my set up, I compile for both 64 bit and 32 bit targets on a 64 bit > machine and have separate debootstrap (chroots) for each target > environment rather than compile in the development environment. This > ensures that the final compilation takes place in a known clean > environment. I also have a chroot for a win32 cross compiler. > > Once you have created the chroot for each target, all you need to do is > to install the fpc debs in the appropriate environment (64 bit fpc for > the 64 bit environment, 32 bit for the 32 bit environment), install any > other libraries you need for the distribution repository and then > compile the software in each chroot separately. The result will be > executables built for each target and built in a clean environment. If > you also want to generate distribution packages (debs), this is also the > best way to go about it. > > Regards > > Tony Whyman > MWA Software > > > > > On 29/05/12 03:19, Bruce Tulloch wrote: >> Closer, but not quite there yet... >> >> To get this going I've (sshfs) mounted a 64 bit system on /mnt/engels >> and then attempted to cross-compile on the 32 bit system with: >> >>fpc -MDelphi -Scgi -CX -O3 -OoUNCERTAIN -OoREGVAR \ >>-Tlinux -Px86_64 -Xs -XX -va -l \ >>-dLCL -dLCLgtk2 -XR/mnt/engels >> >> This compiles but fails at the linker: >> >>Searching file /mnt/engels/usr/lib64/crtn.o... found >>Searching file /usr/local/opt/binutils/bin/x86_64-linux-ld... found >>Using util /usr/local/opt/binutils/bin/x86_64-linux-ld >>/usr/local/opt/binutils/bin/x86_64-linux-ld: skipping incompatible >> /lib/libpthread.so.0 when searching for /lib/libpthread.so.0 >>/usr/local/opt/binutils/bin/x86_64-linux-ld: cannot find >> /lib/libpthread.so.0 >>Error: Error while linking >>Fatal: There were 1 errors compiling module, stopping >> >> The linker >> >> /usr/local/opt/binutils/bin/x86_64-linux-ld >> >> was created using (an appropriately modified) >> >>fpcfixes_2.6/cross/buildcrossbinutils >> >> i.e. built to run on i386 and target x86_64 >> >>MYINTEL=i386 >>TARGETS_X86_64="linux" >> >> and the pthread library is (presumably, given the -XR option) >> >>/mnt/engels/lib/libpthread.so >> >> which file reports as >> >>libpthread-2.11.3.so: ELF 64-bit LSB shared object, x86-64, version >>1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux >>2.6.18, not stripped >> >> How can I find out why x86_64-linux-ld reports it as incompatible? >> >> Many thanks, Bruce. >> >> On 05/28/12 23:02, Jonas Maebe wrote: >>> On 28 May 2012, at 14:56, Bruce Tulloch wrote: >>> Am I correct to assume that if I drag in the x86_64 libraries I need from another x86_64 system, put them in a local directory and then reference then using the -XR option I can make this setup work? >>> -XR is for pointing the compiler/linker to the top of a complete >>> sysroot (i.e., a hierarchy with /lib, /usr/lib etc), not to a >>> directory with just few handpicked libraries. For the latter, use the >>> -Fl command line switch instead, possibly combined with -Xd (to >>> prevent the compiler from passing the default system directories as >>> search paths to the linker). >>> >>> And yes, that should indeed work fine. >>> >>> >>> Jonas___ >>> fpc-pascal maillist - [email protected] >>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> ___ >> fpc-pascal maillist - [email protected] >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > ___ > fpc-pascal maillist - [email protected] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
Bruce Tulloch wrote on Tue, 29 May 2012: Closer, but not quite there yet... [...] fpcfixes_2.6/cross/buildcrossbinutils Try adding --with-sysroot to the configure flags in that script. Jonas ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
Bruce, If you are using a Debian derived distribution such as Ubuntu, you might find it easier to use debootstrap to create a 64 bit environment on your system and compile the program in that environment (see https://help.ubuntu.com/community/DebootstrapChroot for a guide). Then you can be sure that you have all the correct libraries in their standard paths, etc. In my set up, I compile for both 64 bit and 32 bit targets on a 64 bit machine and have separate debootstrap (chroots) for each target environment rather than compile in the development environment. This ensures that the final compilation takes place in a known clean environment. I also have a chroot for a win32 cross compiler. Once you have created the chroot for each target, all you need to do is to install the fpc debs in the appropriate environment (64 bit fpc for the 64 bit environment, 32 bit for the 32 bit environment), install any other libraries you need for the distribution repository and then compile the software in each chroot separately. The result will be executables built for each target and built in a clean environment. If you also want to generate distribution packages (debs), this is also the best way to go about it. Regards Tony Whyman MWA Software On 29/05/12 03:19, Bruce Tulloch wrote: Closer, but not quite there yet... To get this going I've (sshfs) mounted a 64 bit system on /mnt/engels and then attempted to cross-compile on the 32 bit system with: fpc -MDelphi -Scgi -CX -O3 -OoUNCERTAIN -OoREGVAR \ -Tlinux -Px86_64 -Xs -XX -va -l \ -dLCL -dLCLgtk2 -XR/mnt/engels This compiles but fails at the linker: Searching file /mnt/engels/usr/lib64/crtn.o... found Searching file /usr/local/opt/binutils/bin/x86_64-linux-ld... found Using util /usr/local/opt/binutils/bin/x86_64-linux-ld /usr/local/opt/binutils/bin/x86_64-linux-ld: skipping incompatible /lib/libpthread.so.0 when searching for /lib/libpthread.so.0 /usr/local/opt/binutils/bin/x86_64-linux-ld: cannot find /lib/libpthread.so.0 Error: Error while linking Fatal: There were 1 errors compiling module, stopping The linker /usr/local/opt/binutils/bin/x86_64-linux-ld was created using (an appropriately modified) fpcfixes_2.6/cross/buildcrossbinutils i.e. built to run on i386 and target x86_64 MYINTEL=i386 TARGETS_X86_64="linux" and the pthread library is (presumably, given the -XR option) /mnt/engels/lib/libpthread.so which file reports as libpthread-2.11.3.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped How can I find out why x86_64-linux-ld reports it as incompatible? Many thanks, Bruce. On 05/28/12 23:02, Jonas Maebe wrote: On 28 May 2012, at 14:56, Bruce Tulloch wrote: Am I correct to assume that if I drag in the x86_64 libraries I need from another x86_64 system, put them in a local directory and then reference then using the -XR option I can make this setup work? -XR is for pointing the compiler/linker to the top of a complete sysroot (i.e., a hierarchy with /lib, /usr/lib etc), not to a directory with just few handpicked libraries. For the latter, use the -Fl command line switch instead, possibly combined with -Xd (to prevent the compiler from passing the default system directories as search paths to the linker). And yes, that should indeed work fine. Jonas___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
Closer, but not quite there yet... To get this going I've (sshfs) mounted a 64 bit system on /mnt/engels and then attempted to cross-compile on the 32 bit system with: fpc -MDelphi -Scgi -CX -O3 -OoUNCERTAIN -OoREGVAR \ -Tlinux -Px86_64 -Xs -XX -va -l \ -dLCL -dLCLgtk2 -XR/mnt/engels This compiles but fails at the linker: Searching file /mnt/engels/usr/lib64/crtn.o... found Searching file /usr/local/opt/binutils/bin/x86_64-linux-ld... found Using util /usr/local/opt/binutils/bin/x86_64-linux-ld /usr/local/opt/binutils/bin/x86_64-linux-ld: skipping incompatible /lib/libpthread.so.0 when searching for /lib/libpthread.so.0 /usr/local/opt/binutils/bin/x86_64-linux-ld: cannot find /lib/libpthread.so.0 Error: Error while linking Fatal: There were 1 errors compiling module, stopping The linker /usr/local/opt/binutils/bin/x86_64-linux-ld was created using (an appropriately modified) fpcfixes_2.6/cross/buildcrossbinutils i.e. built to run on i386 and target x86_64 MYINTEL=i386 TARGETS_X86_64="linux" and the pthread library is (presumably, given the -XR option) /mnt/engels/lib/libpthread.so which file reports as libpthread-2.11.3.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped How can I find out why x86_64-linux-ld reports it as incompatible? Many thanks, Bruce. On 05/28/12 23:02, Jonas Maebe wrote: > > On 28 May 2012, at 14:56, Bruce Tulloch wrote: > >> Am I correct to assume that if I drag in the x86_64 libraries I need >> from another x86_64 system, put them in a local directory and then >> reference then using the -XR option I can make this setup work? > > -XR is for pointing the compiler/linker to the top of a complete sysroot > (i.e., a hierarchy with /lib, /usr/lib etc), not to a directory with just few > handpicked libraries. For the latter, use the -Fl command line switch > instead, possibly combined with -Xd (to prevent the compiler from passing the > default system directories as search paths to the linker). > > And yes, that should indeed work fine. > > > Jonas___ > fpc-pascal maillist - [email protected] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
Excellent, thanks Jonas. On 05/28/12 23:02, Jonas Maebe wrote: > > On 28 May 2012, at 14:56, Bruce Tulloch wrote: > >> Am I correct to assume that if I drag in the x86_64 libraries I need >> from another x86_64 system, put them in a local directory and then >> reference then using the -XR option I can make this setup work? > > -XR is for pointing the compiler/linker to the top of a complete sysroot > (i.e., a hierarchy with /lib, /usr/lib etc), not to a directory with just few > handpicked libraries. For the latter, use the -Fl command line switch > instead, possibly combined with -Xd (to prevent the compiler from passing the > default system directories as search paths to the linker). > > And yes, that should indeed work fine. > > > Jonas___ > fpc-pascal maillist - [email protected] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling x86_64 on i386 Linux.
On 28 May 2012, at 14:56, Bruce Tulloch wrote: > Am I correct to assume that if I drag in the x86_64 libraries I need > from another x86_64 system, put them in a local directory and then > reference then using the -XR option I can make this setup work? -XR is for pointing the compiler/linker to the top of a complete sysroot (i.e., a hierarchy with /lib, /usr/lib etc), not to a directory with just few handpicked libraries. For the latter, use the -Fl command line switch instead, possibly combined with -Xd (to prevent the compiler from passing the default system directories as search paths to the linker). And yes, that should indeed work fine. Jonas___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling - easier than expected - wiki needs update?
2012/4/29 Mattias Gaertner : >> I tried this but then it seems it would try to use what is configured >> in "Build Lazarus" > I fixed that. Please test. Now it works, now just setting the target OS is sufficient :-) Thank you! Bernd ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling - easier than expected - wiki needs update?
On Sun, 29 Apr 2012 15:27:47 +0200 Bernd wrote: > 2012/4/29 Mattias Gaertner : > > > You don't need to set the LCLWidgetType here because win32 is the > > default for TargetOS win32. > > I tried this but then it seems it would try to use what is configured > in "Build Lazarus" which is set to GTK2 on my machine. When I try to > run the resulting exe in wine then it will print this error and exit: > > err:module:import_dll Library libgdk-win32-2.0-0.dll (which is needed > by L"Z:\\home\\bernd\\proj\\inventar\\inventar.exe") not found I fixed that. Please test. Mattias ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling - easier than expected - wiki needs update?
In our previous episode, Bernd said: > an fpc checkout from the 2.6 fixes branch > a lazarus checkout from the trunk > > For normal compiling (not cross) after updating everything from svn I > usually just use > > in the fpc directory > make clean all > sudo make install A small warning, and possibly another outdated point, but afaik this might go wrong if starting FPC version <> built FPC version. Check make install output to see what "fpc"/"ppc386" binaries are used for the process (since the version number of the destination depends on it) > to set up. The only problem I had was the wiki page does not mention > with any word that one must first do fpcmake -Ti386-win32 That shouldn't be necessary as Mattias already pointed out. > maybe this also affects the other cross-compile-combinations (which > are certainly more complicated because of the binutils but maybe also > became easier), but I don't have enough experience with this to feel > confident enough to make changes. Someone else with more routine in > cross compiling should do this. Non windows as target brings in binutils. For windows they are built in. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling - easier than expected - wiki needs update?
2012/4/29 Mattias Gaertner : > You don't need to set the LCLWidgetType here because win32 is the > default for TargetOS win32. I tried this but then it seems it would try to use what is configured in "Build Lazarus" which is set to GTK2 on my machine. When I try to run the resulting exe in wine then it will print this error and exit: err:module:import_dll Library libgdk-win32-2.0-0.dll (which is needed by L"Z:\\home\\bernd\\proj\\inventar\\inventar.exe") not found ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling - easier than expected - wiki needs update?
On Sun, 29 Apr 2012 15:01:12 +0200 Bernd wrote: > Hi, > > I just thought I kill some time investigating cross compiling from > i386-linux to i386-win32 and hada look at the wiki page > http://wiki.freepascal.org/Cross_compiling > > It seems there is some important thing missing, right at the beginning > but I don't know enough about fpcmake to extend the article in a way > that explains in a short sentence what fpcmake's actually does (and > how it does this) and what options are of interest. > > Here is what I had installed initially on my Linux-i386 (Xubuntu 11.10) > > an fpc checkout from the 2.6 fixes branch > a lazarus checkout from the trunk > > For normal compiling (not cross) after updating everything from svn I > usually just use > > in the fpc directory > make clean all > sudo make install > > (the fpc.cfg is in /etc and I once created it with the tool that comes > with fpc and never touched it since) > > and in the Lazarus directory > make clean lazbuild useride > > (without install, just run Lazarus directly from there) > > *** > > Now I decided to try experimenting with cross compiling to win32, > something I have never done before and expected to be very difficult > to set up. The only problem I had was the wiki page does not mention > with any word that one must first do fpcmake -Ti386-win32 Normally this is not needed because the makefiles are created with fpcmake -Tall, which creates Makefile for all targets. Maybe someone forgot this? > Then it was surprisingly easy: > > fpcmake -Ti386-win32 > make all OS_TARGET=win32 CPU_TARGET=i386 > sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 > > and that was all! > > I have also seen mentioning somewhere the fpc.cfg needs to be edited > but my fpc.cfg seemed to already contain the correct $fpctarget > macros. Some years ago some installers created fpc.cfg without the macros. That's why the wiki mentions it. Feel free to add a comment, that nowadays this is usually already done. > Also it seems there is absolutely no additional configuration > in Lazarus needed, it just worked out of the box immediately on the > first try! :) > All I did was opening a simple project with some database > stuff for sqlite that already used to compile and run on windows, I > just opened the project and set in the project settings: > > Code Generation / Target OS: Win32 > Build Modes / Macro values: LCLWidgetType: win32 You don't need to set the LCLWidgetType here because win32 is the default for TargetOS win32. > And it immediately worked! It automatically re-compiled all needed LCL > and other packages without changing *any* Lazarus setting at all and > it created a working LCL windows exe! > > This is great stuff, I am impressed! I initially prepared for many > frustrating hours experimenting and searching little pieces of > information from all over the web but instead it just worked > immediately! The only thing is the wiki page seems slightly outdated > in a few details regarding Linux->Windows cross compile: > > * missing hint for fpcmake > * fpc.cfg probably already ok, no editing here anymore > * no Lazarus config change, no new Lazarus profile, no rebuilding of > Lazarus anymore > > maybe this also affects the other cross-compile-combinations (which > are certainly more complicated because of the binutils but maybe also > became easier), but I don't have enough experience with this to feel > confident enough to make changes. Someone else with more routine in > cross compiling should do this. Mattias ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How? [SOLVED]
I finally managed to get Intel Mac OS X cross-compilation (from Linux) working well so I thought I'd document what I did for the benefit of others because the info in the wiki is wildly out of date. I'll update the wiki (if I can) to point to this message. What you'll need: [1] an Intel Mac running Leopard or Snow Leopard [2] the original or retail OSX DVD (for the SDK) [3] a working linux setup (Debian Squeeze in my case) [4] up to date source for FPC (2.4.x) and Lazarus (0.9.30) [5] the Open Darwin cctools (odcctools) Once set up, you won't need the Mac to compile your code. STEP 1: copy the SDK from your Mac. You need to install XCode from your OSX DVD if you've not already done so and copy the SDK to an appropriate location on your Linux box. I'd recommend MacOSX10.5.sdk but it depends on how far back you want to be compatible. MacOSX10.5.sdk is located in /Developer/SDKs on the Mac. I put mine at /opt/MacOSX10.5.sdk on my Debian box. STEP 2: grab odcctools from SVN (I use mercurial, hence the "hg" stuff) hg clone http://svn.macosforge.org/repository/odcctools/trunk/ odcctools and build it as $ cd ~/hg/odcctools && ./extract.sh && cd odcctools $ CC=gcc-4.4 ./configure --target=i386-darwin \ --prefix=/opt/odcctools --with-sysroot=/opt/MacOSX10.5.sdk $ make && make install I've specified gcc 4.4 but it should be okay with other versions. STEP 3: rebuild FPC (my sources are in ~/hg/pascal) $ cd ~/hg/pascal && hg id -bint 730fd5ffbeb1 1 fixes_2_4 release_2_4_2 $ make distclean && FPC=ppc386 make crossall crossinstall \ CPU_TARGET=i386 OS_TARGET=darwin \ CROSSBINDIR=/opt/odcctools/bin BINUTILSPREFIX=i386-darwin- \ INSTALL_PREFIX=/opt/cross \ OPT="-gl -gw -godwarfsets -XX -CX -Xd -Fl/opt/MacOSX10.5.sdk/usr/lib" Note that the options (OPT) as shown are vital, especially -gw. STEP 4: add a darwin (cross-compile) clause to /etc/fpc.cfg #IFDEF darwin -Fu/opt/cross/lib/fpc/$fpcversion/units/i386-darwin/ -Fu/opt/cross/lib/fpc/$fpcversion/units/i386-darwin/* -Fu/opt/cross/lib/fpc/$fpcversion/units/i386-darwin/rtl -FD/opt/odcctools/bin #ENDIF STEP 5: build the Carbon LCL (in Lazarus) Be sure to specify the Darwin OS target, i386 CPU target and, most importantly, add the -gw option. Perform a Clean+Build of the LCL and the Package Registration. You should now be able to use Lazarus in Linux to build for Mac OS X. There are two more gotcha's when cross-compiling to OS X: First, be sure to specify the -gw in your projects to avoid problems reported in (the unfixable) FPC bug #12001. Second, be sure to specify the -XR option pointing to your SDK root, in my case -XR/opt/MacOSX10.5.sdk, or the Darwin linker will try to link to the wrong startup object (/usr/lib/crt1.o). I hope this information saves the next person to try to set this up a lot of time :-) Cheers, Bruce. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?
On 04 Aug 2011, at 15:13, Bruce Tulloch wrote: So I've got cross-compilation working but I have one last problem. I can't seem to get fpc to drive the linker to search the SDK path BEFORE the default paths. Specifically, i386-darwin-ld finds /usr/lib/crt1.o and NOT /opt/MacOSX10.5.sdk/usr/lib/crt1.o despite fpc being passed the option -k-L/opt/MacOSX10.5.sdk/usr/lib Use -XR/opt/MacOSX10.5.sdk/ and get rid of the -k parameter. Jonas ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?
In our previous episode, Jonas Maebe said: > > The information on the FPC wiki and elsewhere in the lists is woefully > > out of date. > > In general, this is not supported (and personally I've never done it). You > have to build an Apple tool chain (assembler, linker) on a Linux host, which > is not supported by Apple, and then copy a Mac OS X SDK to your Linux > machine. Additionally, for -Xg functionality (in combination with DWARF debug > information) the dsymutil program is required, but since it's not open source > it is definitely not possible to build it for Linux. > > I think your best bet is to google general information about cross-compiling > from Linux to Mac OS X. I think there is nothing FPC-specific about it, > except for maybe pointing the compiler to the SDK (use the -XR command line > parameter for that). I did it with 10.4. The trouble is getting the toolchain to run. IIRC Adriaan assisted me with that back then. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?
On Mon, Aug 1, 2011 at 9:49 AM, Bruce Tulloch wrote: > Is anyone on the list doing this? If so, how did you set it up? If your objective is writing software for Mac OS X without actually having a Mac computer, then I seriously doubt it would work, unless your app is a simple command line program. Mac OS X has a number of particularities. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross Compiling from Linux to a Mac OS X 10.5 or 10.6 target. How?
On 01 Aug 2011, at 09:49, Bruce Tulloch wrote: > The information on the FPC wiki and elsewhere in the lists is woefully > out of date. In general, this is not supported (and personally I've never done it). You have to build an Apple tool chain (assembler, linker) on a Linux host, which is not supported by Apple, and then copy a Mac OS X SDK to your Linux machine. Additionally, for -Xg functionality (in combination with DWARF debug information) the dsymutil program is required, but since it's not open source it is definitely not possible to build it for Linux. I think your best bet is to google general information about cross-compiling from Linux to Mac OS X. I think there is nothing FPC-specific about it, except for maybe pointing the compiler to the SDK (use the -XR command line parameter for that). Jonas___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get thecross compiler ?
-Message d'origine- De : [email protected] [mailto:[email protected]] De la part de Sven Barth Envoyé : jeudi 4 novembre 2010 09:16 À : [email protected] Objet : Re: [fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get thecross compiler ? Am 03.11.2010 18:24, schrieb Julien Devillers: > Ok, I Found them. > > thanks > Julien Out of curiosity and maybe for others that have the same problem: Where did you find them? Regards, Sven - win32crossbinutils2005.zip in ftp://ftp.freepascal.org/pub/fpc/contrib/cross/mingw/ Regards Julien __ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5589 (20101103) __ Le message a été vérifié par ESET NOD32 Antivirus. http://www.eset.com ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get the cross compiler ?
Am 03.11.2010 18:24, schrieb Julien Devillers: Ok, I Found them. thanks Julien Out of curiosity and maybe for others that have the same problem: Where did you find them? Regards, Sven ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get the cross compiler ?
-Message d'origine- De : [email protected] [mailto:[email protected]] De la part de Julien Devillers Envoyé : mercredi 3 novembre 2010 17:27 À : FPC-Pascal users discussions Objet : RE: [fpc-pascal] Cross-Compiling win32 -> Linux 64,how to get the cross compiler ? -Message d'origine- De : [email protected] [mailto:[email protected]] De la part de Jonas Maebe Envoyé : mercredi 3 novembre 2010 14:01 À : FPC-Pascal users discussions Objet : Re: [fpc-pascal] Cross-Compiling win32 -> Linux 64,how to get the cross compiler ? On 03 Nov 2010, at 13:55, Julien Devillers wrote: > I tried to build everything from scratch with fpc source code, but I > did > not find the correct make target. > > How should I do ? make OS_TARGET=linux CPU_TARGET=x86_64 clean all Jonas Hello Jonas Thanks for your answer. If I do that, I have a error on : x86_64-linux-as --64 -o D:/tmp/partage/fpc-2.4.0.source/fpc-2.4.0/rtl/units/x86_64-linux/prt0.o x86_64/prt0.as The file x86_64-linux-as does not exists on my system. Julien - Ok, I Found them. thanks Julien __ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5588 (20101103) __ Le message a été vérifié par ESET NOD32 Antivirus. http://www.eset.com ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get the cross compiler ?
-Message d'origine- De : [email protected] [mailto:[email protected]] De la part de Jonas Maebe Envoyé : mercredi 3 novembre 2010 14:01 À : FPC-Pascal users discussions Objet : Re: [fpc-pascal] Cross-Compiling win32 -> Linux 64,how to get the cross compiler ? On 03 Nov 2010, at 13:55, Julien Devillers wrote: > I tried to build everything from scratch with fpc source code, but I > did > not find the correct make target. > > How should I do ? make OS_TARGET=linux CPU_TARGET=x86_64 clean all Jonas Hello Jonas Thanks for your answer. If I do that, I have a error on : x86_64-linux-as --64 -o D:/tmp/partage/fpc-2.4.0.source/fpc-2.4.0/rtl/units/x86_64-linux/prt0.o x86_64/prt0.as The file x86_64-linux-as does not exists on my system. Julien __ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5588 (20101103) __ Le message a été vérifié par ESET NOD32 Antivirus. http://www.eset.com ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get the cross compiler ?
On 03 Nov 2010, at 13:55, Julien Devillers wrote: I tried to build everything from scratch with fpc source code, but I did not find the correct make target. How should I do ? make OS_TARGET=linux CPU_TARGET=x86_64 clean all Jonas ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling: "from linux to Darwin or Mac OS X"
Torsten Bonde Christiansen wrote: I do already own a legit Mac mini so I have not problem compiling my code for Mac OS X. But the mini is not my primary machine and is actually only meant for testing puposes, so I wanted to create a setup on my primary PC (64-bit linux) that, using a script, can compiles and cross compiles for all of our supported OS and CPU targets. I cross compile from Linux to i386-Win32 / i386-Darwin / PowerPC-Darwin. I've uploaded the tools I used to build the mac tool chain here : http://www.fnarfbargle.com/cross-tools The trick was to use the binaries from odcctools-20060413.tar.bz2, but to link i386-Darwin I needed ld from odcctools-9.2-ld.tgz I've had this working for over a year now, so the steps I used to build it are a little hazy, but from memory I built and installed the 2006 version of ocdtools, then I built the 9.2 version and manually copied just ld across. I build against a copy of the 10.4 SDK (I installed Tiger on an old PPC box, then installed X-Code and copied the SDK across to my Linux build machine. crossbuild.txt is the script I currently use to update my toolchains, so it contains the commands I use to build all versions of the compiler. In the comments at the top are the commands I used to build ocdtools. Hope this helps. Regards, Brad -- Dolphins are so intelligent that within a few weeks they can train Americans to stand at the edge of the pool and throw them fish. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling: "from linux to Darwin or Mac OS X"
I do already own a legit Mac mini so I have not problem compiling my code for Mac OS X. But the mini is not my primary machine and is actually only meant for testing puposes, so I wanted to create a setup on my primary PC (64-bit linux) that, using a script, can compiles and cross compiles for all of our supported OS and CPU targets. Regards, Torsten Bonde Christiansen. Patrick Chevalley wrote: I try and give up. What I use now is a Mac virtual machine running on my Linux x64. It's too bad you have to turn to the dark side of the Internet for instruction on how to do that. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling: "from linux to Darwin or Mac OS X"
On 26 Mar 2010, at 11:37, Patrick Chevalley wrote: I try and give up. It's indeed quite unfortunate that Apple's tool chain is not easily portable to other platforms. And since they regularly modify internal stuff (new sections/features/flags in object files, changes to the headers of binaries, ...), it's probably quite hard for external people to design and maintain their own (as is done for, e.g. Windows). Jonas ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling: "from linux to Darwin or Mac OS X"
I try and give up. What I use now is a Mac virtual machine running on my Linux x64. It's too bad you have to turn to the dark side of the Internet for instruction on how to do that. Patrick ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling from 64-bit Linux to 32-bit Linux
I use Ubuntu 9.10 64bit and I can confirm this link are present with this release. To search for the package that contain a file I find apt-file handy: sudo apt-get install apt-file sudo apt-file update and then apt-file search libX11 ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling from 64-bit Linux to 32-bit Linux
Patrick Chevalley wrote: > Install the ia32-libs package. I already had this installed and had many libraries available in /usr/lib32/ > also check if your fpc.cfg contain the following lines, I not remember > if I add them: > #ifdef cpui386 > -Fl/usr/lib32 > -Xd > #endif I added this and the problem was still the same. It seems the linker can't find the libX11 library to link against. Your reply about 'locate crti.o' gave me an idea. I did the following... $ locate libX11.so /usr/lib/libX11.so /usr/lib/libX11.so.6 /usr/lib/libX11.so.6.2.0 /usr/lib32/libX11.so.6 <-- missing unversioned libX11.so /usr/lib32/libX11.so.6.2.0 I noticed the "unversioned" libX11.so is missing from the /usr/lib32/ directory. I manually added a symbolic link and it solved the linking -lX11 problem, but then prompted about -lXft. I did a another locate and it had the same problem. Added another "unversioned" symbolic for libXft.so and now my project successfully links!!! :-) Thanks for getting me onto the right track. What location in the wiki will be appropriate for such information, in case somebody else gets stuck with cross-compiling and a similar linking problem? I used packages.ubuntu.com to search for packages that contain libX11.so. I noticed that only from Ubuntu 9.04 (Jaunty) does the ia32-libs include the unversioned symbolic link. I made a mistake in my original post, I am actually running Ubuntu 8.04.2 (Hardy) 64-bit. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling from 64-bit Linux to 32-bit Linux
> I have the same problem (or not?) : Maybe ... try $ locate crti.o must return: /usr/lib/crti.o /usr/lib32/crti.o On Debian/Ubuntu /usr/lib32/crti.o is in a package require by ia32-libs. Beware the path are not the same with Redhat! /usr/lib is 32bit and /usr/lib64 for 64bit. Patrick ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling from 64-bit Linux to 32-bit Linux
I have the same problem (or not?) : --- Free Pascal Compiler version 2.4.1 [2010/02/03] for i386 Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Linux for i386 Compiling lazarus.pp Compiling resource ../units/i386-linux/lazarus.or Linking ../lazarus ld: warning: ../link.res contains output sections; did you forget -T? ld: skipping incompatible /usr/lib/crti.o when searching for /usr/lib/crti.o ld: skipping incompatible /usr/lib/crti.o when searching for /usr/lib/crti.o ld: cannot find /usr/lib/crti.o lazarus.pp(127,1) Error: Error while linking lazarus.pp(127,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled) make[2]: ** [lazarus] Erro 1 make[2]: Saindo do diretório `/home/deskx/desenvolvimento/instaladores/lazarus/ide' make[1]: ** [ide] Erro 2 make[1]: Saindo do diretório `/home/deskx/desenvolvimento/instaladores/lazarus/ide' make: ** [ide] Erro 2 --- 2010/2/8 Patrick Chevalley : > Install the ia32-libs package. > > also check if your fpc.cfg contain the following lines, I not remember > if I add them: > #ifdef cpui386 > -Fl/usr/lib32 > -Xd > #endif > > Patrick > ___ > fpc-pascal maillist - [email protected] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling from 64-bit Linux to 32-bit Linux
Install the ia32-libs package. also check if your fpc.cfg contain the following lines, I not remember if I add them: #ifdef cpui386 -Fl/usr/lib32 -Xd #endif Patrick ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling on Windows
In our previous episode, Vincent Snijders said: > > Please file a bug anyway, with as much details as possible. It would be > > really great if you could get the "strace" output of the compiler run in > > both cases. > > Yes, but where to download strace for win32? Correct. Then settle for -va output for now, unless Jonas' suggestion works. It's possible that 2.3.1 has some param for this, to override startup code, but I can't look at that atm (at work). This is one of the reasons why stuff in the linker backend should always be overridable. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling on Windows
On 14 Oct 2008, at 15:56, Vincent Snijders wrote: Marco van de Voort schreef: Please file a bug anyway, with as much details as possible. It would be really great if you could get the "strace" output of the compiler run in both cases. Yes, but where to download strace for win32? More or less the same: download and run wine (http://winehq.org) with the environment variable "WINEDEBUG=+relay" set. I don't know whether the compiler works with wine, but I'd guess it does. Jonas ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling on Windows
Marco van de Voort schreef: Please file a bug anyway, with as much details as possible. It would be really great if you could get the "strace" output of the compiler run in both cases. Yes, but where to download strace for win32? Vincent ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling on Windows
In our previous episode, Carsten Bager said: > > I doubt it really is a samba problem, more some problem that certain > > heuristics that cause the libctype detection are somehow different (do you > > happen to use -Xd on the samba drive?) > > Yes and on the local drive. Every thing is the same (I copy everything to the > local drive). > > > > > Anyway, a simple workaround would be to copy cprt0.o in the rtl dir (of > > ARM) to > > cprt21.o > > That did the trick. Please file a bug anyway, with as much details as possible. It would be really great if you could get the "strace" output of the compiler run in both cases. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling on Windows
> I doubt it really is a samba problem, more some problem that certain > heuristics that cause the libctype detection are somehow different (do you > happen to use -Xd on the samba drive?) Yes and on the local drive. Every thing is the same (I copy everything to the local drive). > > Anyway, a simple workaround would be to copy cprt0.o in the rtl dir (of ARM) > to > cprt21.o That did the trick. Thanks Carsten ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling on Windows
In our previous episode, Carsten Bager said: > When moving from the 205 compiler to the 222 compiler I have got a strange > problem with > the cross compiler for Windows I suspect this is a bug, or something fixed with newer functionality. Iirc Florian worked on this (autodetection of glibc type). I doubt it really is a samba problem, more some problem that certain heuristics that cause the libctype detection are somehow different (do you happen to use -Xd on the samba drive?) Anyway, a simple workaround would be to copy cprt0.o in the rtl dir (of ARM) to cprt21.o ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross-compiling for a different Mac OS X version (was: Re: OT: Buy a Mac to develop for MacOS? Which one?)
On Mon, Oct 13, 2008 at 1:26 AM, Jonas Maebe <[EMAIL PROTECTED]>wrote: > > On 13 Oct 2008, at 02:42, John Stoneham wrote: > > Until Apple makes a 17" MacBook Pro >> > > > Well, they already do, albeit with a lower resolution than your Dell. I suppose I should say, "until I can afford one", heh? They do offer a 17" LED-backlit version that's 1920x1200. Way out of my pricerange, though. beileve >> Apple went Intel-only with the release of Leopard >> > > > No, they didn't. That will probably happen with the next release (10.6, aka > Snow Leopard). I meant Apple hardware. Yes, Leopard itself supports PPC for those people with older G5s or G4s who want the new OS, but all hardware sine Auguest 2006 has been intel only. > > > and most Tiger machines >> were intel as well >> > > Not really. Well, every Tiger machine made since August 2006 was Intel based. Leopard wasn't released until October 2007, so that's quite a few Intel-only Tiger machines. > > > Plus, if you compile your app on Tiger, it will >> run on Leopard, but not the other way around. >> > > You can compile apps on Leopard which run all the way back to Jaguar > (10.2.8). You do have to use the proper SDK (-XR/path/to/SDK) and tell the > linker to generate compatible binaries (-k"-macosx_version_min 10.2" or > whatever). > Yes, it's tricky. I never did get it to work right. However, since Lazarus apps compiled on Tiger run just fine on Leopard, that's the solution I've been taking. -- _| ( ) |-| |\| ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling enigma
Jonas Maebe wrote: > > On 08 Dec 2007, at 19:26, Sam Liddicott wrote: > >>> So... because the makefile knew it was compiling for the same >>> architecture it decided that I wasn't building an fpc cross compiler >>> but cross building an fpc compiler? That's a bit unexpectedly clever... >> So... this time: >> $ make clean all CPU_TARGET=powerpc OS_TARGET=linux FPC=/usr/bin/ppc386 >> BINUTILSPREFIX=/usr/bin/powerpc-linux-gnu- >> >> And, just like before, it has created a load of powerpc binaries: >> >> $ file /≈/usr/bin/postw32 >> /tmp/fpc_patchdir/fpc_build/usr/bin/postw32: ELF 32-bit MSB executable, >> PowerPC or cisco 4500, version 1 (SYSV), statically linked, stripped > > "make clean all" does not put anything in usr/bin, so you at least alo > have done a "make install" afterwards. Yes, I'm modifying lazarus's create_fpc_deb.sh so it can also create cross-compiler debs as well (this being simpler than fixing the scripts in cross_unix) > >> So I'm still puzzled that the recipe for creating a cross compiler is >> actually cross-compiling a compiler and cross-compiling the tools. >> >> Of course, compiler/ppcrossppc was created, but it seems as a precursor >> to creating all the powerpc binaries. > > It's a cross compiler, which is indeed necessary to create PowerPC > binaries. > yes... I was expecting ppcrossppc to be created, the rest was surprising me >> So I still think I'm doing it wrong; was my make command line correct to >> produce an fpc instance that will cross-compile for powerpc-linux? > > Cross compilers are only intended as add-ons to a native compiler > suite. If you do a plain install, the Makefiles assume you want to > create a native install for the target platform (although currently > this will only work consistently if both the source and target > platform have the same endianess). > > If you want to perform an add-on cross install (which will only > install the cross compiler and units, but not the PowerPC-native > compiler and utilities -- as the natively installed versions of those > utilities will be used), do something like this: > > make FPC=`pwd`/compiler/ppcrossppc > INSTALL_PREFIX=/tmp/fpc_patchdir/fpc_build/usr install CROSSINSTALL=1 > this was the required tip, thanks > (the CROSSINSTALL=1 may not even be necessary when you point FPC to > the cross compiler, as the Makefile should detect that it's a cross > compiler and set that variable itself) It seems to be needed, and I think I have it working now, apart from adding stuff to /etc/fpc.cfg when the cross compiler package is installed. I see that the old cross_unix crosswin32 stuff tries to add like this: # add -FD and -XP entry for cross compiling echo '# set binutils paths for crosscompiling # fpc_crosswin32' >> /etc/fpc.cfg echo '#IFDEF FPC_CROSSCOMPILING # fpc_crosswin32' >> /etc/fpc.cfg echo ' -XPfpc-i386-win32-' >> /etc/fpc.cfg echo '#ENDIF # fpc_crosswin32' >> /etc/fpc.cfg # end. But that seems to presume there will be only one cross compiler installed; do you have any hints on what to add to fpc.cfg? Thank Sam ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling enigma
On 08 Dec 2007, at 19:26, Sam Liddicott wrote: So... because the makefile knew it was compiling for the same architecture it decided that I wasn't building an fpc cross compiler but cross building an fpc compiler? That's a bit unexpectedly clever... So... this time: $ make clean all CPU_TARGET=powerpc OS_TARGET=linux FPC=/usr/bin/ ppc386 BINUTILSPREFIX=/usr/bin/powerpc-linux-gnu- And, just like before, it has created a load of powerpc binaries: $ file /≈/usr/bin/postw32 /tmp/fpc_patchdir/fpc_build/usr/bin/postw32: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), statically linked, stripped "make clean all" does not put anything in usr/bin, so you at least alo have done a "make install" afterwards. So I'm still puzzled that the recipe for creating a cross compiler is actually cross-compiling a compiler and cross-compiling the tools. Of course, compiler/ppcrossppc was created, but it seems as a precursor to creating all the powerpc binaries. It's a cross compiler, which is indeed necessary to create PowerPC binaries. So I still think I'm doing it wrong; was my make command line correct to produce an fpc instance that will cross-compile for powerpc-linux? Cross compilers are only intended as add-ons to a native compiler suite. If you do a plain install, the Makefiles assume you want to create a native install for the target platform (although currently this will only work consistently if both the source and target platform have the same endianess). If you want to perform an add-on cross install (which will only install the cross compiler and units, but not the PowerPC-native compiler and utilities -- as the natively installed versions of those utilities will be used), do something like this: make FPC=`pwd`/compiler/ppcrossppc INSTALL_PREFIX=/tmp/fpc_patchdir/ fpc_build/usr install CROSSINSTALL=1 (the CROSSINSTALL=1 may not even be necessary when you point FPC to the cross compiler, as the Makefile should detect that it's a cross compiler and set that variable itself) Jonas___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling enigma
Sam Liddicott wrote: > * Marco van de Voort wrote, On 07/12/07 08:20: >>> I'm modifying the lazarus packaging scripts to make building debs of >>> lazarus, fpc and cross-fpc variants simpler than it is. (Cross is not >>> simple right now) >>> >>> I've read the buildfaq (thanks Marco) and various fpc build scripts but >>> am still puzzled in this respect: >>> >>> Why does: >>> >>> $ cd fpc >>> $make clean all OS_TARGET=win32 FPC=/usr/bin/ppc386 >>> >>> make: >>> ./compiler/ppc386.exe >>> >>> I thought I was building a cross-compiler, not cross-compiling one - or >>> is it a side effect of building the rtl etc? >>> >> >> The thing you are missing (read buildfaq better :-) is that FPC doesn't have >> to be cross for platforms on the same architecture. >> > > :-( > I used 386-win32 for testing the script because FPC-SVN won't compile > for arm-wince - I'll try a ppc build for the test then. > > So... because the makefile knew it was compiling for the same > architecture it decided that I wasn't building an fpc cross compiler > but cross building an fpc compiler? That's a bit unexpectedly clever... So... this time: $ make clean all CPU_TARGET=powerpc OS_TARGET=linux FPC=/usr/bin/ppc386 BINUTILSPREFIX=/usr/bin/powerpc-linux-gnu- And, just like before, it has created a load of powerpc binaries: $ file /tmp/fpc_patchdir/fpc_build/usr/bin/postw32 /tmp/fpc_patchdir/fpc_build/usr/bin/postw32: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), statically linked, stripped So I'm still puzzled that the recipe for creating a cross compiler is actually cross-compiling a compiler and cross-compiling the tools. Of course, compiler/ppcrossppc was created, but it seems as a precursor to creating all the powerpc binaries. So I still think I'm doing it wrong; was my make command line correct to produce an fpc instance that will cross-compile for powerpc-linux? Sam ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling enigma
Sam Liddicott wrote: > Sam Liddicott wrote: >> * Marco van de Voort wrote, On 07/12/07 08:20: I'm modifying the lazarus packaging scripts to make building debs of lazarus, fpc and cross-fpc variants simpler than it is. (Cross is not simple right now) I've read the buildfaq (thanks Marco) and various fpc build scripts but am still puzzled in this respect: Why does: $ cd fpc $make clean all OS_TARGET=win32 FPC=/usr/bin/ppc386 make: ./compiler/ppc386.exe I thought I was building a cross-compiler, not cross-compiling one - or is it a side effect of building the rtl etc? >>> >>> The thing you are missing (read buildfaq better :-) is that FPC doesn't have >>> to be cross for platforms on the same architecture. >>> >> >> :-( >> I used 386-win32 for testing the script because FPC-SVN won't compile >> for arm-wince - I'll try a ppc build for the test then. >> >> So... because the makefile knew it was compiling for the same >> architecture it decided that I wasn't building an fpc cross compiler >> but cross building an fpc compiler? That's a bit unexpectedly clever... > So... this time: > $ make clean all CPU_TARGET=powerpc OS_TARGET=linux > FPC=/usr/bin/ppc386 BINUTILSPREFIX=/usr/bin/powerpc-linux-gnu- > > And, just like before, it has created a load of powerpc binaries: > > $ file /tmp/fpc_patchdir/fpc_build/usr/bin/postw32 > /tmp/fpc_patchdir/fpc_build/usr/bin/postw32: ELF 32-bit MSB > executable, PowerPC or cisco 4500, version 1 (SYSV), statically > linked, stripped > > > So I'm still puzzled that the recipe for creating a cross compiler is > actually cross-compiling a compiler and cross-compiling the tools. > > Of course, compiler/ppcrossppc was created, but it seems as a > precursor to creating all the powerpc binaries. > > So I still think I'm doing it wrong; was my make command line correct > to produce an fpc instance that will cross-compile for powerpc-linux? I guess my mistake was in "make all", possibly a less encompassing target would be better :-) like make cycle or whatever. Sam ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling enigma
* Marco van de Voort wrote, On 07/12/07 08:20: >> I'm modifying the lazarus packaging scripts to make building debs of >> lazarus, fpc and cross-fpc variants simpler than it is. (Cross is not >> simple right now) >> >> I've read the buildfaq (thanks Marco) and various fpc build scripts but >> am still puzzled in this respect: >> >> Why does: >> >> $ cd fpc >> $make clean all OS_TARGET=win32 FPC=/usr/bin/ppc386 >> >> make: >> ./compiler/ppc386.exe >> >> I thought I was building a cross-compiler, not cross-compiling one - or >> is it a side effect of building the rtl etc? >> > > The thing you are missing (read buildfaq better :-) is that FPC doesn't have > to be cross for platforms on the same architecture. > :-( I used 386-win32 for testing the script because FPC-SVN won't compile for arm-wince - I'll try a ppc build for the test then. So... because the makefile knew it was compiling for the same architecture it decided that I wasn't building an fpc cross compiler but cross building an fpc compiler? That's a bit unexpectedly clever... Sam ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] cross compiling enigma
> I'm modifying the lazarus packaging scripts to make building debs of > lazarus, fpc and cross-fpc variants simpler than it is. (Cross is not > simple right now) > > I've read the buildfaq (thanks Marco) and various fpc build scripts but > am still puzzled in this respect: > > Why does: > > $ cd fpc > $make clean all OS_TARGET=win32 FPC=/usr/bin/ppc386 > > make: > ./compiler/ppc386.exe > > I thought I was building a cross-compiler, not cross-compiling one - or > is it a side effect of building the rtl etc? The thing you are missing (read buildfaq better :-) is that FPC doesn't have to be cross for platforms on the same architecture. ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross Compiling from FreeBSD
On 7/22/06, Mattias Gaertner <[EMAIL PROTECTED]> wrote: I updated the wiki. The install directory is now in the fpcbuild repository: svn co http://svn.freepascal.org/svn/fpcbuild/branches/fixes_2_0/install install Thank you Mattias! I now seem to have all I need. Looks pretty straight forward. Tamara ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross Compiling from FreeBSD
On Sat, 22 Jul 2006 14:55:13 -0400 "Tamara Bunke" <[EMAIL PROTECTED]> wrote: > Greetings to the List: > > I installed FPC-2.0.2 as well as Lazarus from the source tarballs on > my FreeBSD 6.1 system. I would like to be able to cross-compile to > both Linux and to Windows. > > I have read the wiki at: > http://wiki.lazarus.freepascal.org/index.php/Cross_compiling_for_Win32_under_Linux > and succeeded in getting to step # 2.4 "Download the gnu binutils". In > step # 2.5 "Cross build binutils", the instructions say to: > > []$ cd ~/sources/fpc/install/cross/ > []$ cp buildcrossbinutils buildcrossbinutils.sh > > Unfortunately, my FPC source tree, has no such script called > "buildcrossbinutils.sh". I updated the wiki. The install directory is now in the fpcbuild repository: svn co http://svn.freepascal.org/svn/fpcbuild/branches/fixes_2_0/install install > The Docs must be old. Can someone point me to where/how to properly > set up this system to Cross-Compile? I will be needing the tools (LD, > AS... etc), as well as the units for both Linux and Win32. Mattias ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cross compiling from win32 to linux
> I try to crosscompile in win32 to linux with fpc 2.1.1. > I use the options: -Sd -B -Tlinux > > The compiler compiles all the sources without problem, but the linker > reports an errror: unrecognised emulation mode: elf_i386 > this is because fpc calls ld instead of i386-linux-ld > when i rename i386-linux-ld to ld, the linker reports another error: > cannot find -lpthread > > where is my fault ? Use -XPi386-linux- to let fpc use i386-linux-ld for the linking. You also need to have a copy of all .so files needed for the linking. Put them in a directory and pass -Fl ___ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Cross-Compiling Debian/Linux -> FreeBSD
> Marco, there isn't much documentation for xcomp around... suggest you put > the info in this email, and a link http://www.stack.nl/~marcov/buildfaq.pdf > or a copy of the document into ftp:\...contrib\cross\ eg in a readme? Could do that yes. But I have to finish the article first, then I'll do some documenting in buildfaq.pdf. Michael can then use that and absorb parts of it into the documentation. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal]Cross-Compiling Debian/Linux -> FreeBSD
Marco, there isn't much documentation for xcomp around... suggest you put the info in this email, and a link http://www.stack.nl/~marcov/buildfaq.pdf or a copy of the document into ftp:\...contrib\cross\ eg in a readme? Regards John For more info about this kind of tricks see the buildfaq, which is a good thing to read/have anyway if you are going to try crosscompiling. http://www.stack.nl/~marcov/buildfaq.pdf The crosscompile --- Make sure that all .o, .a and .ppu files are deleted from your build directory and all other include and unit paths in your source tree Then type ppc386 -Tfreebsd mymainprogram ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. LogicaCMG global sponsors, Gartner Symposium, Cannes, 4th -7th November 2003 http://symposium.gartner.com/story.php.id.3323.s.5.html Please note that LogicaCMG does not have control over content from,or availability of, this website ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Cross-Compiling Debian/Linux -> FreeBSD
> On Wed, Oct 08, 2003 at 11:02:45AM +0200, Marco van de Voort wrote: > > > doing (using a shell account), to cross-compile from Debian/Linux to > > > FreeBSD ? > > > > There are certainly ways, and you are in luck, I just did this last weekend. > > I'm writing an article about it for a German magazine, and am very > > interested how doable it is for a common user. > > > > It is not hard. I generated linux and freebsd binaries on windows > > > > Some questions first: > > - Is your binary pure FPC, or does it link to C? If it links to C libraries > >it goes out of my area of expertise. > Hrm,, unfortunately, it does use the SQLite library (www.sqlite.org). Is > it possible to link the library in the binary or do something else ? I haven't tested, and there is a gotcha that needs manual editing) but the idea would be - everything the same as earlier. - put static libraries of any library you need in a dir, say /usr/cross/freebsdlib (don't forget libc and libgcc) - compile using ppc386 -Tfreebsd -Fl/usr/cross/freebsdlib -kfail The process will terminate with an linking error Then edit ppas.sh to remove the "fail" word edit link.res and remove all searchdirs except the /usr/cross/freebsdlib one run ./ppas.sh Copy the generated file to freebsd, say a prayer, and run it. > In any case, if it's not possible at all with your current knowledge, > I'd like to know how it's done anyway for a pure FPC program :) A better word would be that I haven't tested it yet. But I will soon. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Cross-Compiling Debian/Linux -> FreeBSD
On Wed, Oct 08, 2003 at 11:02:45AM +0200, Marco van de Voort wrote: > > > Is there an easy way of cross-compiling other than what I"m currently > > doing (using a shell account), to cross-compile from Debian/Linux to > > FreeBSD ? > > There are certainly ways, and you are in luck, I just did this last weekend. > I'm writing an article about it for a German magazine, and am very > interested how doable it is for a common user. > > It is not hard. I generated linux and freebsd binaries on windows > > Some questions first: > - Is your binary pure FPC, or does it link to C? If it links to C libraries >it goes out of my area of expertise. Hrm,, unfortunately, it does use the SQLite library (www.sqlite.org). Is it possible to link the library in the binary or do something else ? In any case, if it's not possible at all with your current knowledge, I'd like to know how it's done anyway for a pure FPC program :) > - do you use 1.0.x or 1.1.x (I did it with 1.1.x, but 1.0.x is capable of it too) > Free Pascal Compiler version 1.0.10 [2003/08/18] for i386 Copyright (c) 1993-2003 by Florian Klaempfl > > If there is, I will need a step-by-step instruction, as I've never done > > it before without the need for a different machine. > > Let's make the shopping list first: > > You'll need > - crossbinutils (from ftp see below) > - a FreeBSD set of units matching the one you already have for linux. > > Retrieving and installation > --- > > Crossbinutils linux->about 10 platforms are available from > ftp://ftp.freepascal.org/fpc/contrib/cross/linux If this package is really > to large (26M) because you are not on broadband, yell, and I'll isolate the > FreeBSD ones from this package. > > Besides this, you need two matching FPC versions, one for FreeBSD one for > Linux. If you use a release, that is simple, just take the the freebsd > release, more importantly the $PREFIX/lib/fpc/$VERSION/units/freebsd part. > Put that in your FPC tree. (so in addition to > $PREFIX/lib/fpc/$VERSION/units/linux you get also units/freebsd) > (needs some manual extracting, and you don't need the FreeBSD binaries, just > the compiled units tree) > > Extract the cross libraries in a temp directory > and then go to the "bin" directory and get the i686-linux* files. > > Rename them to remove the prefix (so as,ar,ld) > > Put them in a directory (I'll use /usr/local/cross/freebsd for the > remainder of this post), and chmod +x them. > > Editing fpc.cfg > -- > > Make sure that all -Fu lines in your fpc.cfg don't specify units/linux/* at > the end but change them to units/$TARGET/* > > Put all additional -Fu commands (for own libraries) under #ifdef linux > > Also add a > > #ifdef freebsd > -FD/usr/local/cross/freebsd > #endif > > For more info about this kind of tricks see the buildfaq, which is a good > thing to read/have anyway if you are going to try crosscompiling. > http://www.stack.nl/~marcov/buildfaq.pdf > > The crosscompile > --- > > Make sure that all .o, .a and .ppu files are deleted from your build > directory and all other include and unit paths in your source tree > > Then type > > ppc386 -Tfreebsd mymainprogram > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- - -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Cross-Compiling Debian/Linux -> FreeBSD
> Is there an easy way of cross-compiling other than what I"m currently > doing (using a shell account), to cross-compile from Debian/Linux to > FreeBSD ? There are certainly ways, and you are in luck, I just did this last weekend. I'm writing an article about it for a German magazine, and am very interested how doable it is for a common user. It is not hard. I generated linux and freebsd binaries on windows Some questions first: - Is your binary pure FPC, or does it link to C? If it links to C libraries it goes out of my area of expertise. - do you use 1.0.x or 1.1.x (I did it with 1.1.x, but 1.0.x is capable of it too) > If there is, I will need a step-by-step instruction, as I've never done > it before without the need for a different machine. Let's make the shopping list first: You'll need - crossbinutils (from ftp see below) - a FreeBSD set of units matching the one you already have for linux. Retrieving and installation --- Crossbinutils linux->about 10 platforms are available from ftp://ftp.freepascal.org/fpc/contrib/cross/linux If this package is really to large (26M) because you are not on broadband, yell, and I'll isolate the FreeBSD ones from this package. Besides this, you need two matching FPC versions, one for FreeBSD one for Linux. If you use a release, that is simple, just take the the freebsd release, more importantly the $PREFIX/lib/fpc/$VERSION/units/freebsd part. Put that in your FPC tree. (so in addition to $PREFIX/lib/fpc/$VERSION/units/linux you get also units/freebsd) (needs some manual extracting, and you don't need the FreeBSD binaries, just the compiled units tree) Extract the cross libraries in a temp directory and then go to the "bin" directory and get the i686-linux* files. Rename them to remove the prefix (so as,ar,ld) Put them in a directory (I'll use /usr/local/cross/freebsd for the remainder of this post), and chmod +x them. Editing fpc.cfg -- Make sure that all -Fu lines in your fpc.cfg don't specify units/linux/* at the end but change them to units/$TARGET/* Put all additional -Fu commands (for own libraries) under #ifdef linux Also add a #ifdef freebsd -FD/usr/local/cross/freebsd #endif For more info about this kind of tricks see the buildfaq, which is a good thing to read/have anyway if you are going to try crosscompiling. http://www.stack.nl/~marcov/buildfaq.pdf The crosscompile --- Make sure that all .o, .a and .ppu files are deleted from your build directory and all other include and unit paths in your source tree Then type ppc386 -Tfreebsd mymainprogram ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Cross-Compiling
> > get them precompiled from the fpc website. They are part of the fpc > > binary distribution for your target os. > > Thank you for this information, I now have more of an insight of how > it's done :) Severely bored people may also watch http://www.stack.nl/~marcov/buildfaq.pdf which explains some things about the FPC buildprocess. Crosscompiling is not treated yet though. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Cross-Compiling
On Fri, Aug 01, 2003 at 10:45:00PM +0300, Nikolay Nikolov wrote: > James Mills wrote: > > >How are you guys goins with crosscompiling ? > >I'd like to be able to cross compile from Debian/Linux to various other > >platforms... Or have you been crosscompiling the other way ? > > > First of all, you need binutils, compiled with support for the targets > you want. Get the source, read the docs, and enable the targets you > want, then compile it. It's C, so you need gcc environment. > > http://www.gnu.org/directory/GNU/binutils.html > > If you manage to compile the binutils successfully you should end up > having as, ld, strip, etc... that support your target os & cpu. > > You could also try looking for some precompiled binaries of the > binutils, for the target you want. > > After that you can do: ppc386 -Tyour_target_os > -FD/path_to_cross_binutils yourfile.pas > > You also need the Free Pascal RTL (and other OS-specific units), you can > get them precompiled from the fpc website. They are part of the fpc > binary distribution for your target os. Thank you for this information, I now have more of an insight of how it's done :) cheers James > > > > ... or you can compile them yourself using the fpc source, but that's > somewhat more complicated. > > If you want to compile for another cpu (fpc 1.0.10 supports i386 and > m68k; fpc 1.1 currently supports i386, powerpc and sparc) then you > *must* compile the compiler. You can read the fpc docs, for compiling > the compiler... :) > > IIRC it was something like "make CPU_TARGET=m68k" in the compiler dir > for the motorola 680x0 (ppc for powerpc, i386 for i386, sparc for sparc > :) )... You end up having a ppc68k executable. Then you go to the rtl > directory and compile the rtl using this new ppc68k "make PP=ppc68k > OPT=-FD/path_to_cross_binutils" Perhaps you also need to add > OPT=-Tyour_target_os... I did it 2 weeks ago (I compiled a crosscompiler > for m68k amiga), and this is what I remember... There might be some > mistakes here... just read the docs, read the fpc compiler options and > play with it, until you get it working... :) > > And you're done. > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- - -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Cross-Compiling
James Mills wrote: How are you guys goins with crosscompiling ? I'd like to be able to cross compile from Debian/Linux to various other platforms... Or have you been crosscompiling the other way ? First of all, you need binutils, compiled with support for the targets you want. Get the source, read the docs, and enable the targets you want, then compile it. It's C, so you need gcc environment. http://www.gnu.org/directory/GNU/binutils.html If you manage to compile the binutils successfully you should end up having as, ld, strip, etc... that support your target os & cpu. You could also try looking for some precompiled binaries of the binutils, for the target you want. After that you can do: ppc386 -Tyour_target_os -FD/path_to_cross_binutils yourfile.pas You also need the Free Pascal RTL (and other OS-specific units), you can get them precompiled from the fpc website. They are part of the fpc binary distribution for your target os. ... or you can compile them yourself using the fpc source, but that's somewhat more complicated. If you want to compile for another cpu (fpc 1.0.10 supports i386 and m68k; fpc 1.1 currently supports i386, powerpc and sparc) then you *must* compile the compiler. You can read the fpc docs, for compiling the compiler... :) IIRC it was something like "make CPU_TARGET=m68k" in the compiler dir for the motorola 680x0 (ppc for powerpc, i386 for i386, sparc for sparc :) )... You end up having a ppc68k executable. Then you go to the rtl directory and compile the rtl using this new ppc68k "make PP=ppc68k OPT=-FD/path_to_cross_binutils" Perhaps you also need to add OPT=-Tyour_target_os... I did it 2 weeks ago (I compiled a crosscompiler for m68k amiga), and this is what I remember... There might be some mistakes here... just read the docs, read the fpc compiler options and play with it, until you get it working... :) And you're done. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
