gcc C++ with -mx32 switch – how to get going on Ubuntu 20.04

  32bit-64bit, c++, gcc, ubuntu-20.04, wxwidgets

I have a substantial C++ implementation of 32-bit Forth for robot control, running on an emedded ESP32 (xtensa) platform. The target is cross compiled using gcc.

I would like to provide an emulator, running on 64-bit Ubuntu 20.04 LTS, using as much of the same source code as possible, and concluded that the -mx32 option would result in 32-bit integers and 32-bit pointers – perfect.

I find that not even the simplest ‘Hello, World’ console program will compile with the -mx32 switch, and the references I find to getting this option to work look highly complicated, from recompiling the C/C++ libraries to even recompiling the Linux kernel.

Also, I am using the wxWidgets library for GUI support.

Has anyone any experience in getting the 32-bit pointer option to work with gcc C++, and if so, are there any serious pitfalls? Or is this just a bad idea?

Thanks in advance, Peter.

Source: Windows Questions C++