OS2 World Community Forum
OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: KO Myung-Hun on February 15, 2026, 06:29:44 pm
-
Hi/2.
Here is the cross compiler for OS/2 on x86_64 Linux.
This consists of the three parts.
1. binutils v2.33.1
2. LIBCn v0.1.14
3. gcc/g++ v9.2.0
This provides the following:
1. binutils + emxexp, emximp, emxbind and OS/2 ld.
2. static libgcc.a
3. ability to build .EXEs and .DLLs with the ld linker which supports a.out object files only
This does *NOT* provide the following:
1. emxomf* family
2. shared libgcc_so_d.a(Currently, this is the symbolic link to libgcc.a)
3. ability to build .EXEs and .DLLs with the OMF linkers which supports OMF object files
How to use:
1. Download the following file:
https://www.os2.kr/komh/testcase/os2emx-cross-toolchain-test.tar.xz
2. Extract files from it with `tar xvJf ' to some dir
3. Files are in some_dir/opt/os2emx/
4. Prepend some_dir/opt/os2emx/bin to your $PATH like:
export PATH=/path/to/your/opt/os2emx:$PATH
5. Now, you can cross-compile C/C++ sources with i686-pc-os2-emx-gcc/g++
Report your experiences, please...
Thanks!
KO Myung-Hun
-
Hello
Sorry if don't understand this. Is the idea is that with this set of tools you can compile software for OS2 from a Linux machine?
Is the benefit of this to overcome some limitation we are getting on OS/2 to compile complex software?
Regards
-
Hello
Sorry if don't understand this. Is the idea is that with this set of tools you can compile software for OS2 from a Linux machine?
Is the benefit of this to overcome some limitation we are getting on OS/2 to compile complex software?
Regards
Hi Martin.
Cross compiling can be a great help when you have to compile really big projects, where an OS/2 machine can fail due to resource exhaustion.
Currently I don't have a linux machine at home with which to try this, but I'm eager to follow these experiments and maybe I'll try ASAP to do something.
But for now, onto some ports I still have to test.
Mentore
-
Yes, it is this. I have to build the Dosbox-X cores one at a time, because even building two in parallel would result in constant out of memory compiler crashes. The rest of Dosbox-X is then build in parallel.
-
Hi/2.
Here is the second test version:
https://www.os2.kr/komh/testcase/os2emx-cross-toolchain-test2.tar.xz
Added support of emxomf tools such as emxomf, emxomfar, emxomfld, emxomfstrip, listomf and stripomf.
Added support of -Zomf option with watcom tools such as wlink and wrc.
Fixed directory hierachy problem.
KO Myung-Hun
-
@Martin: As Mentore and Jochen said, it's possible to overcome 4GB memory problem of 32-bit OS/2 with this cross compiler, and to utilize various development environments of Linux.
-
Downloaded the latest tar.xv and untarred it under ~ Trying simple commands fail,
dave@dave-ThinkCentre-M910s:~$ export PATH=~/opt/os2emx/bin:$PATH
dave@dave-ThinkCentre-M910s:~$ i686-pc-os2-emx-gcc --version
bash: /home/dave/opt/os2emx/bin/i686-pc-os2-emx-gcc: cannot execute binary file: Exec format error
dave@dave-ThinkCentre-M910s:~$ i686-pc-os2-emx-g++ --version
bash: /home/dave/opt/os2emx/bin/i686-pc-os2-emx-g++: cannot execute binary file: Exec format error
dave@dave-ThinkCentre-M910s:~$ echo $PATH
/home/dave/opt/os2emx/bin:/home/dave/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
ls -la does show the files with the x bit set.
Edit: This is current Linux Mint
Edit2:
dave@dave-ThinkCentre-M910s:~/opt/os2emx/bin$ file i686-pc-os2-emx-gcc
i686-pc-os2-emx-gcc: POSIX tar archive (GNU)
and looking at the file, it does look like the exe tarred with ustar by komh.
I'll try different untar commands and/or installing ustar
-
OK, seems mc screwed up the untar. Running from the command line seems to have properly worked.
Now seems I have the wrong libiconv
dave@dave-ThinkCentre-M910s:~$ i686-pc-os2-emx-g++ --version
i686-pc-os2-emx-g++: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
And I don't seem to have iconv installed,
dave@dave-ThinkCentre-M910s:~$ sudo apt install iconv
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package iconv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'iconv' has no installation candidate
-
OK, got pissed off chasing a libiconv package so downloaded the source and installed it in /usr/local, remembered to run sudo ldconfig and,
dave@dave-ThinkCentre-M910s:~$ i686-pc-os2-emx-g++ --version
i686-pc-os2-emx-g++ (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Have to play with it later and look up cross-compiling.
Edit: Now I get,
/home/dave/opt/os2emx/bin/../libexec/gcc/i686-pc-os2-emx/9/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
Looks like libmpfr.so.4 is old and no package available. Have to build version 3 by the looks of it. Current is 4.2.2
Edit2: Ok, built a simple C program using configure and it runs on OS/2, both with -Zomf and without.
Test G++ next.
BTW, used,
export CC=i686-pc-os2-emx-gcc
./configure --host=i686-pc-os2-emx --build=x86_64-linux-gnu LDFLAGS=-Zomf
Edit3: g++ also worked fine.
-
@Dave:
Good to hear that!
Usually, --host is enough. setting CC and --build option are not necessary.
And for other people, here are the missing files which you said:
libiconv: https://www.os2.kr/komh/testcase/os2emx-cross-toolchain-libiconv.tar.gz
libmpfr: https://www.os2.kr/komh/testcase/os2emx-cross-toolchain-libmpfr.tar.gz
Extract the above files to any dir listed in your LD_LIBRARY_PATH.
Thanks!