Gfortran: Compiling 32-Bit Executable in 64-Bit System

gfortran: compiling 32-bit executable in 64-bit system

The 64-bit libraries /usr/lib/gcc/x86_64-linux-gnu/... don't apply to your 32-bit compile. You need to install the multilib compiler packages (see https://help.ubuntu.com/community/InstallingCompilers). For example:

sudo apt-get install gfortran-multilib

Now gfortran -m32 foo.f should work.

Fortran Package Manager build 32 bit code

Compiler flags can be managed via the --flag option:

fpm build --flag "-m32"

32-bit Fortran on 64-bit Server

I'm not sure if this was an oversight on my part or something else; but here are the two steps that fixed it all:

  1. Run sudo apt-get install gfortran on a 64-bit machine which will install the GNU Fortran Compiler
  2. Recompile the application, on the 64-bit machine, using gfortran.

The strange part was that at this point I was still not able to just copy/paste the application file to other 64-bit machines and run it. Rather, I first had to separately install gfortran on each machine, even if I wasn't planning on compiling anything. Once gfortran was installed, the application would run, no matter where it was compiled... I presume that the libgfortran3 must have been some dependency...

How to compile 32-bit programs with Intel Fortran? `ifortvars.bat ia32 VS2015` fails

First, try the compiler option /Qm32 (actually already mentioned by @vladimir and @Pierre de Buyl yesterday).

You might check if the executable exists: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017\windows\bin\ia32\ifort.exe. If not, you should probably reinstall.

Even better, instead of calling ifortvars.bat, open the Intel command prompt from the Windows menu: Start > Intel Parallel Studio XE 2017 > Compiler 17.0 Update 2 for IA-32 Visual Studio 2015 environment. This will properly setup the PATH/environment.

FWIW, I've never used ifortvars.bat. Instead, I pin the Intel command prompt to the taskbar.

Why won't my 32-bit Fortran/C DLL compile in MSYS2?

No one seems to have wanted to post the answer which we figured out in the comments on the question, so I'm posting it to just tie things up.

I needed to start the shell with the C:\msys64\mingw32.exe executable. See the comments for more details.



Related Topics



Leave a reply



Submit