Author Topic: Please test os2emx-cross-toolchain  (Read 676 times)

KO Myung-Hun

  • Jr. Member
  • **
  • Posts: 95
  • Karma: +14/-0
    • View Profile
Please test os2emx-cross-toolchain
« 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

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5633
  • Karma: +50/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Please test os2emx-cross-toolchain
« Reply #1 on: February 16, 2026, 11:45:40 pm »
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
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Mentore

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +18/-0
    • View Profile
Re: Please test os2emx-cross-toolchain
« Reply #2 on: February 19, 2026, 09:08:04 am »
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

Jochen Schäfer

  • Sr. Member
  • ****
  • Posts: 409
  • Karma: +33/-0
    • View Profile
Re: Please test os2emx-cross-toolchain
« Reply #3 on: February 19, 2026, 09:25:49 am »
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.

KO Myung-Hun

  • Jr. Member
  • **
  • Posts: 95
  • Karma: +14/-0
    • View Profile
Re: Please test os2emx-cross-toolchain
« Reply #4 on: February 19, 2026, 07:32:14 pm »
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

KO Myung-Hun

  • Jr. Member
  • **
  • Posts: 95
  • Karma: +14/-0
    • View Profile
Re: Please test os2emx-cross-toolchain
« Reply #5 on: February 19, 2026, 07:36:05 pm »
@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.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5695
  • Karma: +148/-1
    • View Profile
Re: Please test os2emx-cross-toolchain
« Reply #6 on: February 20, 2026, 12:15:59 am »
Downloaded the latest tar.xv and untarred it under ~ Trying simple commands fail,
Code: [Select]
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:
Code: [Select]
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
« Last Edit: February 20, 2026, 12:34:04 am by Dave Yeo »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5695
  • Karma: +148/-1
    • View Profile
Re: Please test os2emx-cross-toolchain
« Reply #7 on: February 20, 2026, 01:02:44 am »
OK, seems mc screwed up the untar. Running from the command line seems to have properly worked.
Now seems I have the wrong libiconv
Code: [Select]
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,
Code: [Select]
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

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5695
  • Karma: +148/-1
    • View Profile
Re: Please test os2emx-cross-toolchain
« Reply #8 on: February 20, 2026, 01:36:23 am »
OK, got pissed off chasing a libiconv package so downloaded the source and installed it in /usr/local, remembered to run sudo ldconfig and,
Code: [Select]
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,
Code: [Select]
/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,
Code: [Select]
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.
« Last Edit: February 20, 2026, 07:30:15 am by Dave Yeo »

KO Myung-Hun

  • Jr. Member
  • **
  • Posts: 95
  • Karma: +14/-0
    • View Profile
Re: Please test os2emx-cross-toolchain
« Reply #9 on: February 21, 2026, 03:05:33 pm »
@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!