Revision history for DevCrossCompiling


Revision [22580]

Last edited on 2019-02-26 08:51:59 by fxm [Suppressed reference to fbc version 0.24]
Additions:
The ""FreeBASIC"" compiler supports all compilation targets. You only need to install one fbc per host system, and it can be used to compile native programs aswell as non-native programs.
Deletions:
Since fbc version 0.24, the ""FreeBASIC"" compiler always supports all compilation targets. There no longer is any configuration necessary to enable support for additional targets at fbc compile-time, like it used to exist in older fbc versions. This means you only need to install one fbc per host system, and it can be used to compile native programs aswell as non-native programs.


Revision [20786]

Edited on 2016-03-12 13:12:53 by fxm [Formatting]

No Differences

Revision [19980]

Edited on 2016-02-10 15:48:01 by DkLwikki [Update link format]
Additions:
- [[CompilerOpttarget|-target]] and [[CompilerOptarch|-arch]] compiler options allow cross-compiling
The installed tools are called ##i686-w64-mingw32-as## (""MinGW"" cross assembler), ##i686-w64-mingw32-ld## (""MinGW"" cross linker), ##i686-w64-mingw32-gcc## (""MinGW"" cross gcc), etc. You can use them with fbc by specifying the common target prefix to the fbc [[CompilerOpttarget|-target]] option:
Deletions:
- [[CompilerOpttarget -target]] and [[CompilerOptarch -arch]] compiler options allow cross-compiling
The installed tools are called ##i686-w64-mingw32-as## (""MinGW"" cross assembler), ##i686-w64-mingw32-ld## (""MinGW"" cross linker), ##i686-w64-mingw32-gcc## (""MinGW"" cross gcc), etc. You can use them with fbc by specifying the common target prefix to the fbc [[CompilerOpttarget -target]] option:


Revision [17603]

Edited on 2015-04-11 20:49:55 by DkLwikki [Update for changes in Git]
Additions:
Install ""Win32"" FB libraries such that fbc can find them. For the ##-target i686-w64-mingw32## example from above, the directory where the ""Win32"" FB libraries need to be is ##/usr/local/lib/freebasic/win32/##, assuming fbc is installed at ##/usr/local/bin/fbc##. You have two options to get them.
a) Copy the libraries from the official ""Win32"" FB release package (or some other existing ""Win32"" build of FB). Create the ##/usr/local/lib/freebasic/win32/## directory and copy the libraries into it. This should be safe as long as the ""Win32"" FB libraries are from the same FB version as the FB-linux setup you have installed. However, if the ""Win32"" libraries were created with a ""MinGW"" toolchain that is incompatible with the one from Ubuntu, then there can be errors.
Deletions:
Install ""Win32"" FB libraries such that fbc can find them. For the ##-target i686-w64-mingw32## example from above, the directory where the ""Win32"" FB libraries need to be is ##/usr/local/lib/freebasic/i686-w64-mingw32/##, assuming fbc is installed at ##/usr/local/bin/fbc##. You have two options to get them.
a) Copy the libraries from the official ""Win32"" FB release package (or some other existing ""Win32"" build of FB). Create the ##/usr/local/lib/freebasic/i686-w64-mingw32/## directory and copy the libraries into it. This should be safe as long as the ""Win32"" FB libraries are from the same FB version as the FB-linux setup you have installed. However, if the ""Win32"" libraries were created with a ""MinGW"" toolchain that is incompatible with the one from Ubuntu, then there can be errors.


Revision [17276]

Edited on 2014-09-19 05:49:47 by DkLwikki [Fix binutils description]
Additions:
2. ""FreeBASIC"" uses the assembler and linker (and sometimes even more tools) from the GNU binutils project to create binaries, and these may only support one target at a time. Depending on how they were built, they can also support multiple targets. Either way, you need the proper binutils for every compilation target you want to use.
Deletions:
2. ""FreeBASIC"" uses the assembler and linker (and sometimes even more tools) from the GNU binutils project to create binaries, and these only support one target at a time. You need the proper binutils for every compilation target you want to use.


Revision [17177]

Edited on 2014-08-21 11:31:37 by DkLwikki [Formatting]
Additions:
The installed tools are called ##i686-w64-mingw32-as## (""MinGW"" cross assembler), ##i686-w64-mingw32-ld## (""MinGW"" cross linker), ##i686-w64-mingw32-gcc## (""MinGW"" cross gcc), etc. You can use them with fbc by specifying the common target prefix to the fbc [[CompilerOpttarget -target]] option:
Deletions:
The installed tools are called ##i686-w64-mingw32-as## (""MinGW"" cross assembler), ##i686-w64-mingw32-ld## (""MinGW"" cross linker), ##i686-w64-mingw32-gcc## (""MinGW"" cross gcc), etc. You can use them with fbc by specifying the common target prefix to the fbc [[CompilerOpttarget -target] option:


Revision [17174]

Edited on 2014-08-20 17:27:20 by DkLwikki [Formatting]
Additions:
**1. gcc/binutils cross-compiler toolchain**
**2. ""Win32"" FB libraries**
Install ""Win32"" FB libraries such that fbc can find them. For the ##-target i686-w64-mingw32## example from above, the directory where the ""Win32"" FB libraries need to be is ##/usr/local/lib/freebasic/i686-w64-mingw32/##, assuming fbc is installed at ##/usr/local/bin/fbc##. You have two options to get them.
Deletions:
=====1. Install gcc/binutils cross-compiler toolchain=====
2. Install ""Win32"" FB libraries such that fbc can find them. For the ##-target i686-w64-mingw32## example from above, the directory where the ""Win32"" FB libraries need to be is ##/usr/local/lib/freebasic/i686-w64-mingw32/##, assuming fbc is installed at ##/usr/local/bin/fbc##. You have two options to get them.


Revision [17173]

Edited on 2014-08-20 13:02:05 by DkLwikki [Cross-compiling info and examples]
Additions:
1. Besides fbc, ""FreeBASIC"" consists of the FB runtime library (rtlib/libfb) and the FB graphics library (gfxlib2/libfbgfx). Additionally, ""FreeBASIC"" uses libraries from the ""MinGW"", DJGPP or Linux GCC toolchains. All these libraries are precompiled for a certain target. You need a copy of the proper libraries for every compilation target you want to use.
2. ""FreeBASIC"" uses the assembler and linker (and sometimes even more tools) from the GNU binutils project to create binaries, and these only support one target at a time. You need the proper binutils for every compilation target you want to use.
{{fbdoc item="section" value="Example: Cross-compiling from Ubuntu GNU/Linux to Win32"}}
=====1. Install gcc/binutils cross-compiler toolchain=====
Install the ##gcc-mingw-w64## package and its dependencies. The exact package name could be different for different versions of Ubuntu. This should give you the gcc cross-compiler toolchain for targetting ""Win32"" (and ""Win64"" -- you can install the exact packages manually if you prefer to avoid installing the whole ##gcc-mingw-w64## and all of its dependencies.).
That includes the binutils and ""MinGW"" libraries, both of which fbc definitely needs for cross-compiling. It also includes the cross-compiling gcc, which fbc uses to look up the installation locations of the ""MinGW"" libraries. Besides that, gcc is obviously also needed if you want to use ##-gen gcc## (such as when targetting 64bit which is currently only supported via -gen gcc).
The installed tools are called ##i686-w64-mingw32-as## (""MinGW"" cross assembler), ##i686-w64-mingw32-ld## (""MinGW"" cross linker), ##i686-w64-mingw32-gcc## (""MinGW"" cross gcc), etc. You can use them with fbc by specifying the common target prefix to the fbc [[CompilerOpttarget -target] option:
%%fbc foo.bas -target i686-w64-mingw32%%
This tells fbc to cross-compile using the system's ##i686-w64-mingw32## gcc/binutils toolchain and libraries.
2. Install ""Win32"" FB libraries such that fbc can find them. For the ##-target i686-w64-mingw32## example from above, the directory where the ""Win32"" FB libraries need to be is ##/usr/local/lib/freebasic/i686-w64-mingw32/##, assuming fbc is installed at ##/usr/local/bin/fbc##. You have two options to get them.
a) Copy the libraries from the official ""Win32"" FB release package (or some other existing ""Win32"" build of FB). Create the ##/usr/local/lib/freebasic/i686-w64-mingw32/## directory and copy the libraries into it. This should be safe as long as the ""Win32"" FB libraries are from the same FB version as the FB-linux setup you have installed. However, if the ""Win32"" libraries were created with a ""MinGW"" toolchain that is incompatible with the one from Ubuntu, then there can be errors.
b) Compile the ""Win32"" FB libraries manually using Ubuntu's toolchain. Assuming you have the FB source code in ##fbc/##, you can do:
%%cd fbc
This should cross-compile the ""Win32"" FB libraries using the ##i686-w64-mingw32## toolchain and install them into the proper directory in ##/usr/local##. Again, here it is important to ensure that the used source code matches the version of the installed FB-linux setup.
To be completely safe and avoid FB version incompatibilities, you can build an entire FB setup from sources, including the ""Win32"" cross-compiling libraries:
%%cd fbc
Deletions:
- Besides fbc, ""FreeBASIC"" consists of the FB runtime library (rtlib/libfb) and the FB graphics library (gfxlib2/libfbgfx). Additionally, ""FreeBASIC"" uses libraries from the ""MinGW"", DJGPP or Linux GCC toolchains. All these libraries are precompiled for a certain target. You need a copy of the proper libraries for every compilation target you want to use.
- ""FreeBASIC"" uses the assembler and linker (and sometimes even more tools) from the GNU binutils project to create binaries, and these only support one target at a time. You need the proper binutils for every compilation target you want to use.
{{fbdoc item="section" value="Cross-compiling examples"}}
{{fbdoc item="subsect" value="From Ubuntu GNU/Linux to Win32"}}
- Install the ##gcc-mingw-w64## package and its dependencies. The exact package name could be different for different versions of Ubuntu.
This should give you the gcc cross-compiler toolchain for targetting Win32 (and Win64 -- you can install the exact packages manually if you to avoid installing the whole ##gcc-mingw-w64## and all of its dependencies.). That includes the binutils and ""MinGW"" libraries, both of which fbc definitely needs for cross-compiling. It also includes the cross-compiling gcc, which fbc uses to look up the installation locations of the ""MinGW"" libraries. Besides that, gcc is obviously also needed if you want to use ##-gen gcc## (such as when targetting 64bit which is currently only supported via -gen gcc).
The installed tools are called ##i686-w64-mingw32-as## (""MinGW"" cross assembler), ##i686-w64-mingw32-ld## (""MinGW"" cross linker), ##i686-w64-mingw32-gcc## (""MinGW"" cross gcc), etc. You can use them with fbc by specifying the common target prefix to the fbc [[CompilerOpttarget -target] option:
%%fbc foo.bas -target i686-w64-mingw32%%
This tells fbc to cross-compile using the system's ##i686-w64-mingw32## gcc/binutils toolchain and libraries.
- Install ""Win32"" FB libraries such that fbc can find them. For the ##-target i686-w64-mingw32## example from above, the directory where the ""Win32"" FB libraries need to be is ##/usr/local/lib/freebasic/i686-w64-mingw32/##, assuming fbc is installed at ##/usr/local/bin/fbc##. You have two options to get them:
- Copy the libraries from the official ""Win32"" FB release package (or some other existing ""Win32"" build of FB). Create the ##/usr/local/lib/freebasic/i686-w64-mingw32/## directory and copy the libraries into it. This should be safe as long as the ""Win32"" FB libraries are from the same FB version as the FB-linux setup you have installed. However, if the ""Win32"" libraries were created with a ""MinGW"" toolchain that is incompatible with the one from Ubuntu, then there can be errors.

- Compile the ""Win32"" FB libraries manually using Ubuntu's toolchain. Assuming you have the FB source code in ##fbc/##, you can do:
%%cd fbc
This should cross-compile the ""Win32"" FB libraries using the ##i686-w64-mingw32## toolchain and install them into the proper directory in ##/usr/local##. Again, here it is important to ensure that the used source code matches the version of the installed FB-linux setup.

To be completely safe and avoid FB version incompatibilities, you can build an entire FB setup from sources, including the ""Win32"" cross-compiling libraries:

%%cd fbc


Revision [17172]

Edited on 2014-08-20 12:42:29 by DkLwikki [Cross-compiling info and examples]
Additions:
Since fbc version 0.24, the ""FreeBASIC"" compiler always supports all compilation targets. There no longer is any configuration necessary to enable support for additional targets at fbc compile-time, like it used to exist in older fbc versions. This means you only need to install one fbc per host system, and it can be used to compile native programs aswell as non-native programs.
Deletions:
Since fbc version 0.24, the ""FreeBASIC"" compiler always supports all compilation targets. There no longer is any configuration necessary to enable support for additional targets at fbc compile-time, like it used to exist in older fbc versions.
This means you only need to install one fbc per host system, and it can be used to compile native programs aswell as non-native programs.


Revision [17171]

The oldest known version of this page was created on 2014-08-20 12:41:50 by DkLwikki [Cross-compiling info and examples]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode