Preparing GCC Build: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
m remove extra -
m Replace deprecated enclose attributes
 
(10 intermediate revisions by 7 users not shown)
Line 17:
* Texinfo
* ISL (optional)
* CLooG (optional)
 
=== Installing Dependencies ===
Line 53 ⟶ 52:
|N/A
|'''<tt>build-essential</tt>'''
|'''<tt>sysdev-develbuild/make</tt>'''
|'''<tt>make</tt>'''
|'''<tt>make</tt>'''
Line 112 ⟶ 111:
|'''<tt>texinfo</tt>'''
|'''<tt>base-devel</tt>'''
|-
|[https://www.cloog.org/ CLooG] (Optional)
|[https://www.cloog.org/ CLooG]
|'''<tt>libcloog-isl-dev</tt>'''
|'''<tt>dev-libs/cloog</tt>'''
|'''<tt>cloog-devel</tt>'''
|'''<tt>libcloog-isl-devel</tt>'''
|N/A
|N/A
|-
|[http://isl.gforge.inria.fr/ ISL] (Optional)
Line 132 ⟶ 122:
|}
 
You need to have Texinfo installed to build Binutils. You need to have GMP, MPC, and MPFR installed to build GCC. GCC optionally can make use of the CLooG and ISL librarieslibrary.
 
For instance, you can install '''<tt>libgmp3-dev</tt>''' on Debian by running the shell command: '''<tt>sudo apt install libgmp3-dev</tt>'''
Line 138 ⟶ 128:
'''Note:''' Version 5.x (or later) of Texinfo is known to be incompatible with the current Binutils 2.23.2 release (and older). You can check your current version using <tt>makeinfo --version</tt>. If your version is too new and you encounter problems during the build, you will need to either use Binutils 2.24 release (or newer) or install an older version of Texinfo - perhaps through building from source - and add it to your <tt>PATH</tt> prior and during the Binutils build.
 
'''Note:''' GCC has dropped support for CLooG in the 5.x releases [https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=r5-2770-geae1a5d419d30e], and many distributions have dropped the CLooG package (e.g. Gentoo in December 2022).
'''Note:''' Version 0.13 (or later) of ISL is incompatible with the current CLooG 0.18.1 release (and older). Use version 0.12.2 of ISL or the build '''will''' fail.
 
'''Note:''' GCC requires at least ISL version 0.15.
 
'''Note:''' If you are using '''Cygwin''', it is recommended to install the <tt>'''libintl-devel'''</tt> package (I couldn't build a cross-compiler without this package)
 
=== Downloading the Source Code ===
Line 176 ⟶ 170:
Install a new version (compile it yourself or use MacPorts) and add <tt>--with-libiconv-prefix=/opt/local</tt> (or <tt>/usr/local</tt> if you compiled it yourself) to GCC's <tt>./configure</tt> line. Alternatively you may place the libiconv source as gcc-x.y.z/libiconv and it will be compiled as part of the GCC compilation process. (This trick also works for MPFR, GMP, and MPC).
 
The makefiles of Binutils and GCC use the <sourcesyntaxhighlight lang="make" enclose="none"inline>$(CC)</sourcesyntaxhighlight> variable to invoke the compiler. On OS X, this resolves to <sourcesyntaxhighlight lang="text" enclose="none"inline>gcc</sourcesyntaxhighlight> by default, which is actually <sourcesyntaxhighlight lang="bash" enclose="none"inline>clang</sourcesyntaxhighlight>. Prior to OS X 10.8, the Clang that came with Xcode's Command Line Tools package was not able to build a working GCC. Users running OS X 10.7 or below may need to find and install GCC, either from [https://brew.sh Homebrew], or from somewhere on Apple's website. You can try with the old GCC that comes preinstalled on some macOS versions.
 
<sourcesyntaxhighlight lang="bash">
# This is only necessary for OS X users running 10.7 or below.
export CC=/usr/bin/gcc-4.2
Line 184 ⟶ 178:
export CPP=/usr/bin/cpp-4.2
export LD=/usr/bin/gcc-4.2
</syntaxhighlight>
</source>
 
You will want to unset these exports once you compiled and installed the cross compiler.
Line 208 ⟶ 202:
 
'''Note:''' There is an issue with port's GMP, so the version from OS X from /usr is used instead.
'''Note2:''' If you still have some errors, try making a case-sensitive APFS disk image using disk utility app and build from there
 
=== Windows Users ===
Line 224 ⟶ 219:
=== OpenBSD Users ===
OpenBSD users might need to install "gcc" package from ports because base system's GCC is very outdated. If you want to build GCC, try to use the ports' version instead of the latest version available and apply all patches from ports to your build. Also, if the build fails during compiling lto-plugin, a temporary solution is to disable LTO altogether during configure stage of building GCC by adding <tt>--disable-lto</tt>
 
[[Category:Compilers]]