Recent

Author Topic: Fpc, building from source questions  (Read 12610 times)

lagprogramming

  • Sr. Member
  • ****
  • Posts: 406
Re: Fpc, building from source questions
« Reply #15 on: September 16, 2015, 10:13:30 am »
   I reformulate the question because I'd like to be sure I've expressed it right. Probably, the following commands might fail. I'd like to know when they will fail.

a. Host OS is linux and host CPU is x86_64
make crossall crossinstall OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=~/freepascalcompiler/

b. Host OS is linux and host CPU is i386
make crossall crossinstall OS_TARGET=linux CPU_TARGET=x86_64 INSTALL_PREFIX=~/freepascalcompiler/

   I assume that a SUBARCH parameter has no influence in these two situations. Reasons for failure might include: binutils is not built using adecvate parameters, missing proper CROSSBINUTILS parameter to the "make" command, and who knows what else...
   Will CROSSBINUTILS parameter have an influence upon adding it to the above examples, or it would be completely ignored same as when targetting win32/win64?
   If CROSSBINUTILS has an influence, then how comes "make crossall crossinstall OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=~/freepascalcompiler/" works fine even though I can't find any "i386-*" file on HDD. I would have expected for something like having "i386-linux-{as,ld,...}" files.

@marcov
Besides toolchain availability, there is also the need for the extended type for i386, afaik it makes crosscompiling the compiler from hostcpu=anything to targetcpu=i386 is not possible because the i386 part of the compiler cg uses extended?
   Can you reformulate your answer for the above two examples(a and b), I'm not sure I understand it. As far as I know all x86_64 CPUs support extended(as 80b floating value) and CPU_TARGET doesn't need extended support because the compiler will be used on the host CPU.
   This paragraph is in the case you meant that you can't build fpc for x86_64 on a 80386 CPU. From your answer I speculate that a 80386 CPU doesn't have extended support. For this reason a linux-i386 host that runs on a 80386 CPU can not build fpc for crosscompiling to linux-x86_64. This aspect would link to a different forum thread(posted recently) regarding extended type use within win64, where I've noticed the presence of "sfpux80" unit. Can't fpc emulate extended on a 80386 CPU? I'm getting lost.  %)  Can you also take a look at: http://forum.lazarus.freepascal.org/index.php/topic,29678.msg187660.html#msg187660 ?

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Fpc, building from source questions
« Reply #16 on: September 21, 2015, 11:44:47 am »
   Will CROSSBINUTILS parameter have an influence upon adding it to the above examples, or it would be completely ignored same as when targetting win32/win64?
The parameters are not ignored for win32 and win64. However, by default those targets use an assembler and linker that are built into the compiler. As a result, the compiler won't use any Binutils. With an external assembler and/or linker, that parameter will have an effect.

Quote
   If CROSSBINUTILS has an influence, then how comes "make crossall crossinstall OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=~/freepascalcompiler/" works fine even though I can't find any "i386-*" file on HDD. I would have expected for something like having "i386-linux-{as,ld,...}" files.
The compiler also uses an internal assembler by default on Linux for i386 and x86_64.  You do need an i386-linux-ld file to cross-compile from Linux/x86_64 to Linux/i386, otherwise you get the error message "pp.pas(228,1) Error: Util i386-linux-ld not found, switching to external linking".

Quote
As far as I know all x86_64 CPUs support extended(as 80b floating value)
Microsoft has deprecated the use of the x87 FPU (wich is necessary for extended 80 bit floating point support) under Win64, so FPC doesn't support it on that platform.

lagprogramming

  • Sr. Member
  • ****
  • Posts: 406
Re: Fpc, building from source questions
« Reply #17 on: September 21, 2015, 02:31:08 pm »
Quote
The compiler also uses an internal assembler by default on Linux for i386 and x86_64.  You do need an i386-linux-ld file to cross-compile from Linux/x86_64 to Linux/i386, otherwise you get the error message "pp.pas(228,1) Error: Util i386-linux-ld not found, switching to external linking".
   I don't have that file either. I wonder if compiling binutils with "multitarget" parameter is what makes the difference. This "multitarget" parameter adds support to binutils for cross compiling (does not work with gas). Maybe if binutils is not compiled with this parameter then that's the situation when users need these i386-* files. Hmm... :-\ If that would be true then how would I find out if binutils was compiled with this parameter?  %)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Fpc, building from source questions
« Reply #18 on: September 21, 2015, 02:40:33 pm »
It is unrelated to the way your Binutils are compiled. The compiler looks for a file with a particular file name, it does not test its capabilities. Similarly, the makefile compares the host and target of the compiler binary, and if they are different tells the compiler to add the prefix when calling external utilities.

lagprogramming

  • Sr. Member
  • ****
  • Posts: 406
Re: Fpc, building from source questions
« Reply #19 on: October 07, 2015, 08:39:20 am »
   How do I build fpc for a target different than host?
   For example, using linux how do I build the fpc binaries for win64? Can I also "install"(group) the binary files in a directory?

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Fpc, building from source questions
« Reply #20 on: October 07, 2015, 09:09:09 am »
   How do I build fpc for a target different than host?
   For example, using linux how do I build the fpc binaries for win64? Can I also "install"(group) the binary files in a directory?
perhaps something like:
make crosszipinstall CPU_TARGET=%TARGET_CPU% OS_TARGET=%TARGET_OS% CROSSBINDIR=%BINUTILS_PATH% BINUTILSPREFIX=%TARGET_CPU%-%TARGET_OS%- >> %LOG_FILE%
?

Which, for me, creates a zipfile with all necessary files to deploy on the target.
Ehm, i meant creates a zip file with the necessary files to cross-compile.

I still need the following additional line
make compiler OS_TARGET=%TARGET_OS% CPU_TARGET=%TARGET_CPU% FPC="path/and/filename/to/cross-compiler"
« Last Edit: October 07, 2015, 09:48:20 am by molly »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Fpc, building from source questions
« Reply #21 on: October 07, 2015, 09:56:55 am »
Note that we don't officially support building a full installer for a target different than the host. We only support building cross-compilers. You will e.g. miss several utilities (fpc binary etc) in the crosszip/crossinstall.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Fpc, building from source questions
« Reply #22 on: October 07, 2015, 10:02:02 am »
Yeah i noticed my error a little too late, i'm more into cross-compiling myself.

oficially not supported. Ok, i understand. But out of interest on the subject, isn't that what the fpcbuild repo is for ? (i truly have no idea).


Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Fpc, building from source questions
« Reply #23 on: October 07, 2015, 10:24:29 am »
The fpcbuild repository is to build complete releases (with documentation etc). But that one, too, only supports building a release that's hosted on the build platform (either native or cross).

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Fpc, building from source questions
« Reply #24 on: October 07, 2015, 10:44:50 am »
ok, thank you very much for your answer Jonas :thumbsup:

 

TinyPortal © 2005-2018