- Posts: 40
- Thank you received: 0
Question Cross-compile from MacOs to Win64/Linux64?
- Premysl Beran
- Topic Author
- Offline
- Junior Member
-
I used to cross-compile my project from Win to Linux without any issue. Lately, I also had to deal with Mac. So I installed CT on Mac and compiled my project for Mac. All works quite fine.
I wanted to test if I can compile on Mac the executable for Win64 to not need to switch to Windows all the time. As there is no toolchain for this, I wanted to create one using ToolChainBuilder. I selected CPU-OS target as x86_64-win64. But the build finished with error (see below). What I'm doing wrong? Thanks for the help.
The toolchain for X86_64-linux was created correctly. But when I tried to build cross elements for that I got a message (below). It says that "gmake[2]: x86_64-linux-as: Not found". But I found it in the CT/binTollchains/mac64-x86_64-linux directory. What can be wrong in this procedure of cross-compiling? Thanks for the help.
With best regards
Premek
Windows toolchain build error
----------------------------------------------
GNU Cross toolschains Engine settings
-----------------------------------------------
mac64
x86_64-darwin
xxxx
x86_64
win64
xxxx
x86_64-win64
xxxx
-------- configure -----------
checking build system type...
checking build system type... x86_64-apple-darwin18.7.0
checking host system type... x86_64-apple-darwin18.7.0
checking target system type... Invalid configuration `x86_64-win64': system `win64' not recognized
configure: error: /bin/sh ./config.sub x86_64-win64 failed
Linux cross element build error
INFO]: !!! Cross compiler Executable ppcrossx64, Build OK. !!!
------------------------------------------------
Stage 2: Build All Units and Packages
------------------------------------------------
/usr/local/bin/gmake -C rtl all
gmake[1]: Vstupuje se do adresáře „/usr/local/codetyphon/fpcsrc/rtl“
/usr/local/bin/gmake -C linux all
gmake[2]: Vstupuje se do adresáře „/usr/local/codetyphon/fpcsrc/rtl/linux“
/bin/mkdir -p /usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux
/usr/local/bin/gmake /usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux
gmake[3]: Vstupuje se do adresáře „/usr/local/codetyphon/fpcsrc/rtl/linux“
gmake[3]: „/usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux“ je aktuální.
gmake[3]: Opouští se adresář „/usr/local/codetyphon/fpcsrc/rtl/linux“
x86_64-linux-as --64 -o /usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux/prt0.o x86_64/prt0.as
gmake[2]: x86_64-linux-as: Příkaz nenalezen
gmake[2]: *** [Makefile:3918: prt0.o] Chyba 127
gmake[2]: Opouští se adresář „/usr/local/codetyphon/fpcsrc/rtl/linux“
gmake[1]: *** [Makefile:2073: linux_all] Chyba 2
gmake[1]: Opouští se adresář „/usr/local/codetyphon/fpcsrc/rtl“
gmake: *** [Makefile:2685: rtl] Chyba 2
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
For MacOS x86_64-win64 Toolchain NOT Exists
For GNU binutils version 2.33.1 (CT 7.00) and Apple clang version 11.0.0 (clang-1100.0.33.16) MacOS Catalina
Exists
x86_64-w64-mingw32
i686-w32-mingw32
So for MacOS64 to Win64 you must
a) Build x86_64-w64-mingw32 toolchain
b) Rename x86_64-w64-mingw32 folder to x86_64-win64
b) Rename ALL executables to x86_64-win64-xxx
For MacOS64 to Win32 you must
a) Build i686-w32-mingw32 toolchain
b) Rename i686-w32-mingw32 folder to i386-win32
b) Rename ALL executables to i386-win32-xxx
We upload win32 and win64 Toolchains for MacOS64 to our
Toolchains Server
and we build more now...
with GNU binutils version 2.33.1 (CT 7.00) and
Apple clang version 11.0.0 (clang-1100.0.33.16) on MacOS 10.15.2 Catalina
PS: CodeTyphon Toolchain Building System is unique on planet Earth ...

PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.
- Premysl Beran
- Topic Author
- Offline
- Junior Member
-
- Posts: 40
- Thank you received: 0
Thank you for the info. After I update to Catalina, I will definitely try. You are right that Cross-tool chains are something really unique and very very helpful. Thanks for your nice work and support.
And any comment to MacOS to Linux error? The compiler complaining that executable doesn't exist, but it is there. Some link problem, or so?
With best regards
Premek
Please Log in or Create an account to join the conversation.
- Premysl Beran
- Topic Author
- Offline
- Junior Member
-
- Posts: 40
- Thank you received: 0
So the time came and I moved to Catalina 10.15.5 and CT7.1. After some initial troubles with Synapse package, I was able to launch my projects.
In this point, I wanted to test if I will be able to do the cross-compiling from MacOS to Win64. I downloaded the darwin-x64_win64 toolchain and compile it. All went smoothly until the 3rd stage. The script output is following
------------------------------------------------
Stage 3: Install All Units and Packages
------------------------------------------------
/usr/local/bin/gmake -C rtl install
gmake[1]: Entering directory „/usr/local/codetyphon/fpcsrc/rtl“
/usr/local/bin/gmake -C win64 all
gmake[2]: Entering directory „/usr/local/codetyphon/fpcsrc/rtl/win64“
gmake[2]: Leaving directory „/usr/local/codetyphon/fpcsrc/rtl/win64“
__missing_command_FPCMAKE -p -Tx86_64-win64 Makefile.fpc
gmake[1]: __missing_command_FPCMAKE: No such file or directory
gmake[1]: *** [Makefile:1590: fpc_install] Error 127
gmake[1]: Leaving directory „/usr/local/codetyphon/fpcsrc/rtl“
gmake: *** [Makefile:2845: rtl_install] Error 2
The similar problem is also for MacOs to Linux (64-bits) cross-build. But there are is an error already at stage 2.
------------------------------------------------
Stage 2: Build All Units and Packages
------------------------------------------------
/usr/local/bin/gmake -C rtl all
gmake[1]: Entering directory „/usr/local/codetyphon/fpcsrc/rtl“
/usr/local/bin/gmake -C linux all
gmake[2]: Entering directory „/usr/local/codetyphon/fpcsrc/rtl/linux“
/bin/mkdir -p /usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux
/usr/local/bin/gmake /usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux
gmake[3]: Entering directory „/usr/local/codetyphon/fpcsrc/rtl/linux“
gmake[3]: „/usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux“ je aktuální.
gmake[3]: Leaving directory „/usr/local/codetyphon/fpcsrc/rtl/linux“
x86_64-linux-as --64 -o /usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux/prt0.o x86_64/prt0.as
gmake[2]: x86_64-linux-as: No such file or directory
gmake[2]: *** [Makefile:4233: prt0.o] Error 127
gmake[2]: Leaving directory „/usr/local/codetyphon/fpcsrc/rtl/linux“
gmake[1]: *** [Makefile:2212: linux_all] Error 2
gmake[1]: Leaving directory „/usr/local/codetyphon/fpcsrc/rtl“
gmake: *** [Makefile:2871: rtl] Error 2
------------------------------------------------
Stage 3: Install All Units and Packages
------------------------------------------------
/usr/local/bin/gmake -C rtl install
gmake[1]: Entering directory „/usr/local/codetyphon/fpcsrc/rtl“
/usr/local/bin/gmake -C linux all
gmake[2]: Entering directory „/usr/local/codetyphon/fpcsrc/rtl/linux“
/usr/local/bin/gmake /usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux
gmake[3]: Entering directory „/usr/local/codetyphon/fpcsrc/rtl/linux“
gmake[3]: „/usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux“ je aktuální.
gmake[3]: Leaving directory „/usr/local/codetyphon/fpcsrc/rtl/linux“
x86_64-linux-as --64 -o /usr/local/codetyphon/fpcsrc/rtl/units/x86_64-linux/prt0.o x86_64/prt0.as
gmake[2]: x86_64-linux-as: No such file or directory
gmake[2]: *** [Makefile:4233: prt0.o] Error 127
gmake[2]: Leaving directory „/usr/local/codetyphon/fpcsrc/rtl/linux“
gmake[1]: *** [Makefile:2212: linux_all] Error 2
gmake[1]: Leaving directory „/usr/local/codetyphon/fpcsrc/rtl“
gmake: *** [Makefile:2845: rtl_install] Error 2
Thanks for any suggestion.
With best regards
Premek
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
did you follow this Tutorial
PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.
- Premysl Beran
- Topic Author
- Offline
- Junior Member
-
- Posts: 40
- Thank you received: 0
Yes, I'm aware of the Tutorial, it is nicely explained. I'm using this approach to compile the Linux executable from Windows. Recently I had to use also Mac. So I tried to install CT on Mac. All worked quite fine. So I was wonder if I can compile for Linux and Mac os from Windows. But I have problems to compile the cross elements and moreover I will need to copy the libraries from Mac to Windows. You mentioned that it would be possible from MacOS Catalina to do it another way around, compile from Mac to Windows. So I tried and got this problem with the compilation of cross-utils for both Windows and Linux. The Windows once looks more promising than Linux one. The Linux process stops before the package build, the same as I faced 5 months ago.
I very much appreciate your work and if I could help to solve this, I'm listening.
With best regards
Premek
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
give us time to solve and this
PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
just replace
/usr/local/codetyphon/ScriptsLin/crossbuild/*.*
with attach files
Tested
mac64-i386-linux OK
mac64-i386-win32 OK
mac64-x86_64-win64 OK
mac64-x86_64-linux ERROR
mac64-x86_64-freebsd ERROR
mac64-arm-android ERROR
mac64-aarch64-android ERROR
to be continue...
PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.
- Matis A.
-
- Offline
- Moderator
-

The same tests above on Latest Stable Debian Linux (ver 10.4) and all are OK
and a Screenshot
PilotLogic Core Programmer
Attachments:
Please Log in or Create an account to join the conversation.
- Premysl Beran
- Topic Author
- Offline
- Junior Member
-
- Posts: 40
- Thank you received: 0
Very nice job. I tested to compile mac64-i386-linux, mac64-i386-win32, mac64-x86_64-win64. All worked fine. I tried to produce the Win64 executable of my project. It worked perfectly.

Unfortunately Win32 and Linux32, I was not able to compile. It says that "Error: Compiler "/usr/local/codetyphon/fpc/fpc64/bin/x86_64-darwin/fpc" does not support target i386-win32". The same for Linux.
Then I looked into the CTCenter and realise that the cross-compile info is not only at FPC, but also at Typhon-IDE tree (see attachment). The one under Typhon-IDE is the only one (Win64) for what I can build the executable.
Premek
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
....
Then I looked into the CTCenter and realise that the cross-compile info is not only at FPC, but also at Typhon-IDE tree (see attachment). The one under Typhon-IDE is the only one (Win64) for what I can build the executable.
Premek
Yes
Typhon IDE if find a crossbuild FPC element,
will build for target CPU-OS-Platform, adLCL and all packages your app use,
without to modify the Host Typhon CPU-OS-Platform.
Typhon-IDE It's a multi-layer CPU-OS-Platform System
and CT-FPC is a multi-layer CPU-OS System
PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.
- Premysl Beran
- Topic Author
- Offline
- Junior Member
-
- Posts: 40
- Thank you received: 0
Thanks for explication. I looked a little bit around. The message about the fact that fpc doesn't support certain target I found also in Windows. But after I just compile the source of my application the cross elements appeared below the TyphonIDE tree. When I did the same on MacOS, I get the error message that ppc386 can't be executed.
I searched for this executable and I didn't find it. But I found in the directory CT/fpc/fpc64/bin/x86_64-darwin/ file with the name pccross386. So I renamed pccross386 to pcc386 and the code compilation of my project worked well. I've obtained an executable which is possible to launch. The same was for linux386.
There was also files pccrossx86 and pccx86. What is the difference? Is it only a name mismatch or there is a real difference?
With best regards
Premek
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.