Forum > General

Bootstrapping a "host compiler"

(1/2) > >>

Laphicet:
I've been wanting to bootstrap FPC for the MSYS2/MinGW-w64 ecosystem for a while now and I tried earlier, using a regular Win32 installation of FPC. However, what I want to build is not a cross compiler, but a host compiler, using another host compiler. There is no documentation on how to do this. Sure, there's a cross compiler bootstrap-but a cross compiler still depends on the FPC installation it was built from. This needs to be independent of another FPC installation. I have the proper binutils and stuff, but that's it.

marcov:
We called the target x86_64-win64. Straight forward FPC use is mingw(64) free as FPC has internal assemblers and linkers though.

The key is to use known good binutils from the "fpcbuild" release building repository.  (directories install/bin*), and then just following regular crossbuilding procedures. 

I attach my 64-bit build script, but it assumes the binw64 files have been set up in the path.  Please rename it back to a .CMD extension. I changed it to .txt to suit the forum software.

The start compiler is the regular win32 3.2.0 release :

set FPCSTART=c:\fpc\3.2.0\bin\i386-win32\ppc386.exe

but the result is entirely 64-bit.


Make sure your %PATH% is free of other development tools. (mingw,cygwin, but also commercials like Delphi and Visual studio that might package non standard tools, most notably make and sh)

Just give it a try, and report back here with detail and we figure it out. It is not hard, and once you have a working setup, very repeatable.

Laphicet:
I tried running your commands, however, I still get the same error output:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---C:/Users/admin/Documents/GitHub/MINGW-packages/mingw-w64-fpc/src/app/bin/i386-win32/ppc386.exe -Ur -Xs -O2 -n -Fui386 -Fusystems -Fu../rtl/units/i386-win32 -Fii386 -FE. -FUi386/units/i386-win32 -dRELEASE -di386 -dGDB -dBROWSERLOG -Fux86 -Sew pp.pasD:/msys64/usr/bin/mv.exe -f ./pp.exe ppc.exemingw32-make[4]: Leaving directory 'C:/Users/admin/Documents/GitHub/MINGW-packages/mingw-w64-fpc/src/fpcbuild-3.2.0/fpcsrc/compiler'D:/msys64/mingw64/bin/mingw32-make.exe 'FPC=/c/Users/admin/Documents/GitHub/MINGW-packages/mingw-w64-fpc/src/fpcbuild-3.2.0/fpcsrc/compiler/ppc.exe' OS_TARGET=win32 CPU_TARGET=i386 CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=2mingw32-make[4]: Entering directory 'C:/Users/admin/Documents/GitHub/MINGW-packages/mingw-w64-fpc/src/fpcbuild-3.2.0/fpcsrc/compiler'Makefile:135: *** Compiler /c/Users/admin/Documents/GitHub/MINGW-packages/mingw-w64-fpc/src/fpcbuild-3.2.0/fpcsrc/compiler/ppc.exe not found.  Stop. 
For reference, this is the bootstrap script I did for MSYS2:

--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---prepare() {  cd $srcdir  ./innoextract fpc-$pkgver.i386-win32.exe # MinGW-w64 `innoextract` is busted} build() {  cd "fpcbuild-${pkgver}"   declare -a extra_config  if [ "$CARCH" = "x86_64" ]; then    extra_config+=("CPU_TARGET=x86_64")    extra_config+=("OS_TARGET=win64")  else    extra_config+=("CPU_TARGET=i386")    extra_config+=("OS_TARGET=win32")  fi   BINUTILSPREFIX=${MINGW_CHOST}- ${MINGW_PREFIX}/bin/mingw32-make \        -j1 NOGDB=1 all crossinstall FPC="$srcdir/app/bin/i386-win32/ppc386.exe" \        PREFIX="$srcdir/tmp_install-$CARCH" ${extra_config[@]}}

marcov:
As said, using msys is not supported, nor its emulated path conventions like the  /c/Users/admin/Documents... (clearly visible in your error messages). If some tool passes that to a FPC compiled binary, as a native windows program, it wouldn't know what to do with it, and the makefiles are also not meant for it.

The FPC tools are msysless mingw tools (and usually older, since except for make and gdb not very critical anymore)

Unless you know what you are doing, use the provided bin and coretools from the fpcbuild repository, and not msys or other emulations (like cygwin).

Laphicet:
Oh! I feel silly. It was the path names all this time! Okay, well, yeah, I've been doing that. However, I wanted to see if I could use MSYS and integrate it.

Nevertheless, thanks!

Navigation

[0] Message Index

[#] Next page

Go to full version