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:
- Run
sudo apt-get install gfortran
on a 64-bit machine which will install the GNU Fortran Compiler - 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
Cannot Get Qwindow::Fromwinid to Work Properly
Using for Loop to Move Files from Subdirectories to Parent Directories
Running Linux Container on Docker Windows
How to Test Your Own Linux Module
Getting Kernel Version from The Compressed Kernel Image
Why Is My Core File Not Overwritten
Accessing Apache2 Residing Inside Docker Container from Host Machine Web Browser
Linux/Glibc. How to Use Fprintf in Signal Handler
Reusing Compression Dictionary
Is It Efficient to Use Epoll with Devices (/Dev/Event/...)
How to Inject a Raw L2 Packet as an Incoming Packet to an Interface on Linux
Path Environment Variable in Linux
Ansible - Winrm or Requests Is Not Installed
Pg_Dump Not Been Killed Inside Script with Kill Command
How to Sort The String Array in Linux Bash Shell