Revision history for CompilerOpttarget


Revision [21684]

Last edited on 2016-11-07 08:11:30 by fxm [Formatting]

No Differences

Revision [19954]

Edited on 2016-02-10 15:46:46 by DkLwikki [Update link format]
Additions:
- The [[DevNormalVsStandalone|Normal]] fbc (e.g. FB-linux release) additionally recognizes GNU triplets, for example:
The ##-target## compiler option can be used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries and cross compilation tools (assembler, linker) must be installed for cross compilation to work (also see [[DevCrossCompiling|FB and cross-compiling]]).
- [[CompilerCmdLine|Using the Command Line]]
- [[DevCrossCompiling|FB and cross-compiling]]
Deletions:
- The [[DevNormalVsStandalone Normal]] fbc (e.g. FB-linux release) additionally recognizes GNU triplets, for example:
The ##-target## compiler option can be used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries and cross compilation tools (assembler, linker) must be installed for cross compilation to work (also see [[DevCrossCompiling FB and cross-compiling]]).
- [[CompilerCmdLine Using the Command Line]]
- [[DevCrossCompiling FB and cross-compiling]]


Revision [17229]

Edited on 2014-09-05 09:47:49 by DkLwikki [Overhaul for 64bit/ARM support etc.]
Additions:
The target platform. Recognized values:
- ##dos##
- ##win32##
- ##win64##
- ##xbox##
- ##<os>-<arch>##
##<os>## can be one of:
- ##linux##
- ##cygwin##
- ##darwin##
- ##freebsd##
- ##netbsd##
- ##openbsd##
##<arch>## can be one of:
- ##x86##
- ##x86_64##
- ##arm##
- ##aarch64##
Examples:
- ##linux-x86##
- ##linux-x86_64##
- ##linux-arm##
- ##linux-aarch64##
- ##freebsd-x86##
- ##freebsd-x86_64##
- ##...##
- For backwards compatibility, the following values are recognized. They will select the corresponding operating system, together with the compiler's default architecture (same as the host), because these values do not specify an architecture explicitly.
- ##linux##
- ##cygwin##
- ##darwin##
- ##freebsd##
- ##netbsd##
- ##openbsd##
- The [[DevNormalVsStandalone Normal]] fbc (e.g. FB-linux release) additionally recognizes GNU triplets, for example:
- ##i686-w64-mingw32##
- ##x86_64-w64-mingw32##
- ##i686-pc-linux-gnu##
- ##arm-linux-gnueabihf##
- ##...##
The ##-target## compiler option can be used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries and cross compilation tools (assembler, linker) must be installed for cross compilation to work (also see [[DevCrossCompiling FB and cross-compiling]]).
If ##-target <platform>## is given, the compiler will compile programs more or less as if they were compiled on the given platform. This affects which ##""__FB_*__""## operating-system-specific symbol will be pre-defined, the default calling convention, the object and executable file format (e.g. ELF/COFF), the available runtime libraries and functions, etc.
With a standalone FB setup such as the FB-dos or FB-win32 releases:
- Specifying ##-target <platform>## causes the compiler to use the compiler tools in the ##bin/<platform>/## directory, and target-specific libraries in the ##lib/<platform>/## directory. For example, ##-target win32## causes the compiler to compile for ""Win32"" and use tools from ##bin/win32/## and libraries from ##lib/win32/##.
- It is unnecessary (but safe) to specify a ##-target## option that matches the host (for example ##-target win32## on ##win32##). It does not make a difference to the compilation process.
- If ##-target## is not specified, the compiler defaults to compiling for the native system. It will then use the compiler tools and libraries from the ##bin/## and ##lib/## directories corresponding to the native system.
With a normal FB setup such as the FB-linux release:
- Specifying ##-target <platform>## causes the compiler to prefix the ##<platform>-## string to the executable names of binutils and gcc. For example, specifying ##-target i686-w64-mingw32## causes the compiler to invoke ##i686-w64-mingw32-ld## instead of ##ld## (same for other tools besides the linker). This allows fbc to integrate with binutils/gcc cross-compiler toolchains and matches how cross-compiling tools are typically installed on Linux distributions.
- Note that specifying something like ##-target win32## does not usually make sense here. It causes the compiler to try to use ##win32-ld## which usually does not exist, because binutils/gcc toolchains for cross-compilation to Windows typically have names such as ##i686-pc-mingw32##, not just ##win32##. Thus, it is necessary to specify something like ##-target i686-pc-mingw32## instead of ##-target win32##.
- For backwards compatibility, if the given //platform// string describes the host and is an FB target name (the values accepted by the ##-target## option with a standalone FB setup) instead of a GNU triplet, then the ##-target## option will be ignored, and the ##<platform>-## string will not be prefixed to compiler tools. For example, this allows ##-target linux## to work with the FB-linux release. It will be ignored instead of causing the compiler to try to use ##linux-ld## instead of ##ld##.
- If ##-target## is not specified, the compiler defaults to compiling for the native system, and it will invoke binutils/gcc without a target-specific prefix. This allows fbc to integrate with usual Linux (and similar) systems where binutils/gcc for native compilation are installed without any target-specific prefix.
- Libraries besides FB's own runtime libraries are located by running ##gcc -print-file-name=...## (or ##<platform>-gcc -print-file-name=...##). This allows fbc to use the system and gcc libraries installed on Linux and similar systems without knowing the exact installation directories.
- [[DevCrossCompiling FB and cross-compiling]]
Deletions:
The target platform. (See below)
The ##-target## compiler option can be used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries and cross compilation tools (assembler, linker) must be installed for cross compilation to work.
The behavior of ##-target## differs depending on whether the FB setup was configured as [[DevNormalVsStandalone Normal or Standalone]].
- for Normal, such as the ""FreeBASIC-linux"" release:
Whatever is given for //platform// will be prefixed to the file names of the used gcc/binutils programs. This will typically be a system triplet such as ##i686-pc-linux-gnu##. For example, specifying ##-target i686-pc-linux-gnu## will cause the compiler to invoke ##i686-pc-linux-gnu-ld## instead of the native ##ld##.

As an exception, if the given //platform// string matches the default FB target name for the host system, the -target option is ignored. This means that using ##-target linux## on Linux, ##-target win32## on ""Win32"" and so on, has no effect. This only affects the default FB target names listed for the Standalone setup below.

If ##-target## is not specified, the compiler defaults to compiling for the native system, and it will invoke gcc/binutils without a target prefix.
- for Standalone, such as the ""FreeBASIC-win32"" release:
//platform// can be one of the default FB target names:

- dos
- cygwin
- darwin
- freebsd
- linux
- netbsd
- openbsd
- win32
- xbox
The compilation target and the bin/ and lib/ sub-directories to use are selected base on whichever target name is given. For example, ##-target win32## causes the compiler to compile for ""Win32"" and use tools from ##bin/win32/## and libraries from ##lib/win32/##.


Revision [16282]

Edited on 2012-08-15 16:07:15 by DkLwikki [Update for latest 0.24 changes]
Additions:
As an exception, if the given //platform// string matches the default FB target name for the host system, the -target option is ignored. This means that using ##-target linux## on Linux, ##-target win32## on ""Win32"" and so on, has no effect. This only affects the default FB target names listed for the Standalone setup below.
Deletions:
As an exception, if the given //platform// string matches the default FB target name for the host system, the -target option is ignored. This means that using ##-target linux## on Linux, ##-target win32## on ""Win32"" and so on, has no effect. Note that things like ##-target i686-pc-linux-gnu## on Linux are not ignored though.


Revision [16281]

Edited on 2012-08-15 16:04:49 by DkLwikki [Update for latest 0.24 changes]
Additions:
As an exception, if the given //platform// string matches the default FB target name for the host system, the -target option is ignored. This means that using ##-target linux## on Linux, ##-target win32## on ""Win32"" and so on, has no effect. Note that things like ##-target i686-pc-linux-gnu## on Linux are not ignored though.
The compilation target and the bin/ and lib/ sub-directories to use are selected base on whichever target name is given. For example, ##-target win32## causes the compiler to compile for ""Win32"" and use tools from ##bin/win32/## and libraries from ##lib/win32/##.
Deletions:
As an exception, if the given //platform// string matches the default FB target name for the host system, the -target option is ignored. This means that using ##-target linux## on Linux, ##-target win32## on Win32 and so on, has no effect. Note that things like ##-target i686-pc-linux-gnu## on Linux are not ignored though.
The compilation target and the bin/ and lib/ sub-directories to use are selected base on whichever target name is given. For example, ##-target win32## causes the compiler to compile for win32 and use tools from ##bin/win32/## and libraries from ##lib/win32/##.


Revision [16280]

Edited on 2012-08-15 16:04:20 by DkLwikki [Update for latest 0.24 changes]
Additions:
The ##-target## compiler option can be used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries and cross compilation tools (assembler, linker) must be installed for cross compilation to work.
The behavior of ##-target## differs depending on whether the FB setup was configured as [[DevNormalVsStandalone Normal or Standalone]].
- for Normal, such as the ""FreeBASIC-linux"" release:


Whatever is given for //platform// will be prefixed to the file names of the used gcc/binutils programs. This will typically be a system triplet such as ##i686-pc-linux-gnu##. For example, specifying ##-target i686-pc-linux-gnu## will cause the compiler to invoke ##i686-pc-linux-gnu-ld## instead of the native ##ld##.

As an exception, if the given //platform// string matches the default FB target name for the host system, the -target option is ignored. This means that using ##-target linux## on Linux, ##-target win32## on Win32 and so on, has no effect. Note that things like ##-target i686-pc-linux-gnu## on Linux are not ignored though.

If ##-target## is not specified, the compiler defaults to compiling for the native system, and it will invoke gcc/binutils without a target prefix.

- for Standalone, such as the ""FreeBASIC-win32"" release:


//platform// can be one of the default FB target names:

- dos
- cygwin
- darwin
- freebsd
- linux
- netbsd
- openbsd
- win32
- xbox

The compilation target and the bin/ and lib/ sub-directories to use are selected base on whichever target name is given. For example, ##-target win32## causes the compiler to compile for win32 and use tools from ##bin/win32/## and libraries from ##lib/win32/##.
Deletions:
The ##-target## compiler option can be used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries and cross compilation tools (assembler, linker) must be installed in the lib/ and bin/ directories for cross compilation to work.
//platform// is the system name that is prefixed to the names of the compilation tools and also the name of the lib/ directory. It can be a system triplet such as ##i686-pc-mingw32## as known from gcc/binutils, or something as simple as ##dos## or ##win32##. The compiler expects to find compilation tools and libraries named after this //platform// name.
For example, in order to use ##-target dos## with the FB-win32 fbc, there must be ##bin/dos-{as,ar,ld}.exe## and ##dos-lib/*## (with the FB DOS libraries) installed in the FB-win32 directory.
For example, to cross-compile from Debian to ""Win32"":
- Install Debian's mingw32 cross-compiling toolchain (##gcc-mingw32##), so the ##i586-mingw32msvc-{as,ar,ld,gcc,dlltool}## tools are available.
- Install FB win32 libraries in ##lib/i586-mingw32msvc-freebasic/##. Those can be built from the FB source via ##make TARGET=i586-mingw32msvc##, or they can be taken from the FB win32 release, as long as it's the same FB version.
- Now you can use ##-target i586-mingw32msvc## to cross-compile.
""FreeBASIC"" generally supports these target systems at the moment: Cygwin, Darwin, DOS (DJGPP), ""FreeBSD"", Linux, ""NetBSD"", ""OpenBSD"", ""Win32"" (""MinGW""), Xbox.


Revision [15488]

Edited on 2011-11-04 11:49:15 by DkLwikki [Update to 0.24 changes]
Additions:
The ##-target## compiler option can be used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries and cross compilation tools (assembler, linker) must be installed in the lib/ and bin/ directories for cross compilation to work.

//platform// is the system name that is prefixed to the names of the compilation tools and also the name of the lib/ directory. It can be a system triplet such as ##i686-pc-mingw32## as known from gcc/binutils, or something as simple as ##dos## or ##win32##. The compiler expects to find compilation tools and libraries named after this //platform// name.

For example, in order to use ##-target dos## with the FB-win32 fbc, there must be ##bin/dos-{as,ar,ld}.exe## and ##dos-lib/*## (with the FB DOS libraries) installed in the FB-win32 directory.

For example, to cross-compile from Debian to ""Win32"":
- Install Debian's mingw32 cross-compiling toolchain (##gcc-mingw32##), so the ##i586-mingw32msvc-{as,ar,ld,gcc,dlltool}## tools are available.
- Install FB win32 libraries in ##lib/i586-mingw32msvc-freebasic/##. Those can be built from the FB source via ##make TARGET=i586-mingw32msvc##, or they can be taken from the FB win32 release, as long as it's the same FB version.
- Now you can use ##-target i586-mingw32msvc## to cross-compile.

""FreeBASIC"" generally supports these target systems at the moment: Cygwin, Darwin, DOS (DJGPP), ""FreeBSD"", Linux, ""NetBSD"", ""OpenBSD"", ""Win32"" (""MinGW""), Xbox.
Deletions:
The ##-target## compiler option is used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries and cross compilation tools (assembler, linker) must be installed in the /lib/ and /bin/ directories for cross compilation to work.
This option is only available if the compiler was built with cross compilation support.
Possible targets:
##cygwin##
##darwin##
##dos##
##freebsd##
##linux##
##netbsd##
##openbsd##
##win32##
##xbox##
{{fbdoc item="target"}}
- Only available in versions fbc that have had cross compilation support enabled at configure time before building the compiler. Not all binary distributions will have the same cross compilation targets supported.
- The FreeBASIC package for DOS can be used as a cross compilation tool set when compiling from Windows to a DOS target.


Revision [14227]

Edited on 2009-08-20 02:53:23 by CountingPine [updated]
Additions:


Revision [13724]

Edited on 2008-09-14 09:35:16 by JeffMarshall [+netbsd]
Additions:
##netbsd##


Revision [13701]

Edited on 2008-09-07 08:34:49 by JeffMarshall [add darwin and openbsd targets]
Additions:
##darwin##
##openbsd##


Revision [13542]

Edited on 2008-07-21 10:13:41 by JeffMarshall [minor edits]
Additions:
The ##-target## compiler option is used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries and cross compilation tools (assembler, linker) must be installed in the /lib/ and /bin/ directories for cross compilation to work.
Deletions:
The ##-target## compiler option is used to create an executable for a platform which is different from the host on which the source code is being compiled and linked. Appropriate libraries cross compilation tools must be installed in the /lib/ and /bin/ directories for cross compilation to work.


Revision [12737]

The oldest known version of this page was created on 2008-03-20 17:52:22 by JeffMarshall [minor edits]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode