Porting to OS/2: Install newer gcc and binutils by Paul Smedley
newer gcc builds
In many cases, gcc 3.3.5 shipped with kLIBC is enough although it's a bit old. However, some cases such as multimedia projects, require newer gcc.
Fortunately, Paul Smedley maintain thoes new gcc builds. He maintains many version of gcc from 4.3.x to 4.9.x, which is latest. But among them, I think, 4.4.6 build is most stable.
If you use more recent version of gcc, then try to the latest version if possible. However, current 4.9.0 build is known to have a bug in codes generated by it. This is not OS/2 specific, but gcc itself. So you'd better wait to 4.9.1 build or later.
Anyway install gcc 4.4.6 first.
Unzip this into your gcc directory. We installed gcc into x:\gcc. So do this.
- unzip gcc-4.4.6-os2-20130714.zip -d x:\gcc
Then your gcc is installed in x:\gcc\usr\local446.
Get gcc4.cmd to set up environments for newer gcc builds.
Copy this into x:\gcc\usr\bin.
And create a forwarder batch file, gcc4.cmd, in x:\usr\bin like gccenv.cmd forwarder.
1 2 3 4 5 | @echo off set GCCOPT=-pipe -static-libgcc x:\gcc\usr\bin\gcc4.cmd x:\gcc\usr WLINK set EMXOMFLD_RC_TYPE=WRC set EMXOMFLD_RC=wrc.exe |
// ----- 2014/09/09
At line 2, -static-libgcc is used to link against libgcc statically. Otherwise, the executables depend on gccxxx.dll.
// -----
Then you can use gcc 4.4.6 with gcc4.cmd as well as gcc 3.3.5 with gccenv.cmd.
If you use another version of gcc, then just change 'gcc446' at line 68 to your gcc version. For examples, 'gcc491' if gcc 4.9.1.
If you want, any gcc 4.x builds can coexit with any other gcc 4.x builds.
newer binutils
Newer binutils supports newer assermbler instructions. So, you'd better maintain them at up-to-date if possible.
You can get this here,
Unzip it, and rename ld.exe in i386-pc-os2-emx\bin to another such as ld.exe.sav or remove it. Because it is not compatible with OS/2. Then copy the unzipped directory to x:\gcc\usr.
- unzip binutils-2.23.2-os2-20130907.zip -d binutils
- ren binutils\i386-pc-os2-emx\bin\ld.exe ld.exe.sav
- xcopy /s/e/v/h/t/r binutils x:\gcc\usr\
댓글
댓글 쓰기