[fpc-pascal] PowerPC crosscompiler on i386 Mac OS X looks for, wrong assembler and linker
Adriaan van Os
fpc at microbizz.nl
Tue Jul 3 09:45:18 CEST 2007
> A NOTE has been added to this issue.
> ======================================================================
> http://www.freepascal.org/mantis/view.php?id=9201
> ======================================================================
> Reported By: Adriaan van Os
> Assigned To:
> ======================================================================
> Project: FPC
> Issue ID: 9201
> Category: Compiler
> Reproducibility: always
> Severity: minor
> Priority: normal
> Status: new
> FPCOldBugId: 0
> FPCTarget: -
> Fixed in Revision:
> ======================================================================
> Date Submitted: 2007-07-02 16:08 CEST
> Last Modified: 2007-07-02 20:17 CEST
> ======================================================================
> Summary: PowerPC crosscompiler on i386 Mac OS X looks for
> wrong assembler and linker
> Description:
> Building FreePascal on i386 Mac OS X with
>
> sudo ln -sf /usr/bin/as /usr/bin/powerpc-darwin-as
> sudo ln -sf /usr/bin/ld /usr/bin/powerpc-darwin-ld
>
> and
>
> make all CPU_TARGET=powerpc DEBUG=1
> sudo make install CPU_TARGET=powerpc DEBUG=1 CROSSINSTALL=1
>
> results in a PowerPC crosscompiler /usr/local/lib/fpc/2.3.1/ppcrossppc.
> The problem is that this compiler expects an assembler "-as" and a linker
> "-ld".
>
> [p17:~/Support/fpcbugs] adriaan% /usr/local/lib/fpc/2.3.1/ppcrossppc p.p
> Free Pascal Compiler version 2.3.1 [2007/06/28] for powerpc
> Copyright (c) 1993-2007 by Florian Klaempfl
> Target OS: Darwin for PowerPC
> Compiling p.p
> Assembling p
> Error: Assembler -as not found, switching to external assembling
> Fatal: There were 1 errors compiling module, stopping
> Fatal: Compilation aborted
>
> [p17:~/Support/fpcbugs] adriaan% cat p.p
> program P; begin end.
>
> ======================================================================
>
> ----------------------------------------------------------------------
> Jonas Maebe - 2007-07-02 16:32
> ----------------------------------------------------------------------
> Have you installed FPC 2.1.4? The configuration file for earlier FPC's set
> a wrong (and superfluous) cross-compiling prefix when cross-compiling from
> Darwin to Darwin. 2.1.4 does not set any prefix at all, since plain as and
> ld are simple frontends which call through to the cpu-specific drivers.
>
> Check your /etc/fpc.cfg file. It should contain this:
>
> ---
> # set binutils prefix
> #DEFINE NEEDCROSSBINUTILS
>
> #ifdef darwin
> #undef NEEDCROSSBINUTILS
> #endif
>
>
> #IFDEF FPC_CROSSCOMPILING
> #IFDEF NEEDCROSSBINUTILS
> -XP$fpctarget-
> #ENDIF NEEDCROSSBINUTILS
> #ENDIF
> ---
>
> The -XP parameter is what sets the prefix.
>
> ----------------------------------------------------------------------
> Adriaan van Os - 2007-07-02 20:00
> ----------------------------------------------------------------------
>> > Have you installed FPC 2.1.4?
>
> I installed fpc-2.1.4a.intel-macosx.dmg
>
>> > The configuration file for earlier FPC's set a wrong (and superfluous)
> cross-compiling prefix when cross-compiling from Darwin to Darwin. 2.1.4
> does not set any prefix at all, since plain as and ld are simple frontends
> which call through to the cpu-specific drivers. compiling from Darwin to
> Darwin. 2.1.4 does not set any prefix at all, since plain as and ld are
> simple frontends which call through to the cpu-specific drivers.
>
> But somehow, it looks like a hyphen gets into the prefix
>
>> > Check your /etc/fpc.cfg file. It should contain this ...
>
> My /etc/fpc.cfg has these lines:
>
> # set binutils prefix
>
> #IFNDEF CPUI386
> #IFNDEF CPUAMD64
> #DEFINE NEEDCROSSBINUTILS
> #ENDIF
> #ENDIF
>
> #ifdef darwin
> #undef NEEDCROSSBINUTILS
> #endif
>
> #IFDEF FPC_CROSSCOMPILING
> #IFDEF NEEDCROSSBINUTILS
> -XP$fpctarget-
> #ENDIF NEEDCROSSBINUTILS
> #ENDIF
>
> so that looks OK.
>
>> > The -XP parameter is what sets the prefix.
>
> Compiling with -XP does solve the problem.
>
> [p17:~/Support/fpcbugs] adriaan% /usr/local/lib/fpc/2.3.1/ppcrossppc
> -XPpowerpc-darwin- p.p
> Free Pascal Compiler version 2.3.1 [2007/07/02] for powerpc
> Copyright (c) 1993-2007 by Florian Klaempfl
> Target OS: Darwin for PowerPC
> Compiling p.p
> Assembling p
> Linking p
> 1 lines compiled, 0.7 sec
>
> ----------------------------------------------------------------------
> Jonas Maebe - 2007-07-02 20:17
> ----------------------------------------------------------------------
> Maybe you have a ~/.fpc.cfg, or an fpc.cfg in the current directory?
No, there is only one fpc.cfg on my computer and that's the one in /etc/
> By
> default, no prefix is set, so it has to come from some configuration file
> you have somewhere.You can also try compiling with -va to see which
> config files are parsed (and see a lot of other debug information).
>
> Also, as far as I know you've cross-compiled successfully in the past,
I tried ppcppc, but it turned it to be a PowerPC binary and it has endian issues
<http://www.freepascal.org/mantis/view.php?id=9165>.
> so
> what changed? Maybe it's better to take this to the mailing list, because
> this doesn't sound like a bug to me but a configuration problem.
I am doing that now, but I bet it's a bug. Even if not, why is the build system so obscure "some
configuration file you have somewhere" that this can happen ?
I am not at all saying that FPC should follow GNU conventions, no, but at least the rules are clear
there. You configure for target, host and build and then the Makefile takes cares of the rest. If a
configuration is not supported or if there is a problem, you get a clear error message.
> Issue History
> Date Modified Username Field Change
> ======================================================================
> 2007-07-02 16:08 Adriaan van Os New Issue
> 2007-07-02 16:32 Jonas Maebe Note Added: 0013543
> 2007-07-02 20:00 Adriaan van Os Note Added: 0013547
> 2007-07-02 20:17 Jonas Maebe Note Added: 0013548
> ======================================================================
Anyway, keep up the excellent work,
Regards,
Adriaan van Os
More information about the fpc-pascal
mailing list