Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

error - compiled exe is 16bit

olslewfoot
Beginner
7,847 Views

I have a 64 bit Windows7 Enterprise PC with icore7 and 2.4Ghz.

I have Intel Parallel Studio XE2013 alongside MS Visual Studio 2010 which I'm a new-be with!

When I compile my fortran code the compilation completes but when the application launches I get a Windows OS message saying that the application is 16bit and will not run on the 64 bit PC.

I'm using the ia32 compiler which I understood would be ok on the 64 bit PC.

Can you suggest what I've got wrong or what I can do to rectify this please?

Thanks

John

0 Kudos
43 Replies
olslewfoot
Beginner
2,221 Views

Both the components were purchased at the same time - from the same supplier in UK (in late March) and licensed directly from Intel.

The two components were installed twice - the second time with service pack 3 for the fortran composer which was ommitted the first time.

The LIB env variable in the Composer command prompt is :

LIB=C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib;C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib\ia32;C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\ia32;C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib\ia32;

What is the best way to find out if all th components are latest and compatible (Microsoft V Intel)?

0 Kudos
IanH
Honored Contributor III
2,221 Views

You are missing the Visual Studio directories. It's been a while since I've done an install, so I don't remember the details - but if you bought Visual Studio as a stand-alone product (which is what I think you've done, based on your reply -- did you get a physically separate DVD or whatever for VS?) - when you installed it did you install the C++ support?  (Forgetting to do that used to be a problem with older VS versions, VS2010 installation defaults might be different.)

Within Visual Studio - choose Help > About Microsoft Visual Studio, then select the Copy Info button and paste or attach the results here.  That dialog should tell you what sort of Visual Studio edition you purchased.

If you have the stand-alone professional edition or similar, and if Microsoft Visual C++ doesn't appear as a product in the list, then see if you can add it via the Programs and Features control panel applet (find Microsoft Visual Studio 2010 in the list, then choose "Uninstall/Change" and then see if you can turn on C++).  After this you might need to "repair" your ifort installation.

If you are relying on the shell edition that comes bundled with the ifort installation then you won't see C++ in the list (but you will see "Shell" rather prominently in the header of the Help > About dialog!).

VS installation issues used to come up quite often here - you may find that searching the forum shows you responses from Intel folk that are more categoric than my vague suggestions.  (Now we know that its an installation issue they might jump in here... nudge, nudge...). 

0 Kudos
Lorri_M_Intel
Employee
2,221 Views

Your LIB environment variable does not contain the Microsoft C/C++ runtime library directories.

I'm guessing there's an "interesting" configuration issue here, and we just need to ferret it out.  

First - your components are certainly compatible.  You're using Microsoft Visual Studio 2010 and Composer XE 2013, right?  That's definitely supported; in fact, I have that on one of the systems available to me right now.  I'm using it to double-confirm some of what I'm saying here.

When you bring up the command window, do you use:

 Intel Parallel Studio -> Command Prompt -> Parallel Studio with Intel Compiler 13.1 -> IA-32 Visual Studio 2010 mode

What is in the title of the window?  Does it say Intel Composer 2013 IA-32 Visual Studio 2010 ?

Does the first few lines of the new window have banner info something like this:

Intel(R) Parallel Studio XE 2013
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Intel(R) Composer XE 2013 Update 3 (package 171)
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

Right here, please check the value of LIB.   I have IMSL and the Intel C compiler installed too, so my LIB is more "cluttered" than yours should be, but the one in my window is (slightly edited for readability here):

C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib;C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib\ia32;
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB;                                   <<-- the primary VC lib area
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB;                      <<-- secondary VC lib area
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib;
C:\Program Files (x86)\VNI\imsl\fnl600\IA32\LIB;C:\Program Files (x86)\Intel\MPI-RT\4.1.0.021\\IA32\LIB;
C:\Program Files (x86)\Intel\Composer XE 2013\ipp\lib\ia32;
C:\Program Files (x86)\Intel\Composer XE 2013\ipp\..\compiler\lib\ia32;
C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\ia32;
C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib\ia32;
C:\Program Files (x86)\Intel\Composer XE 2013\tbb\bin\..\lib\ia32\vc10;

Now that I look at this again, I'm surprised that your LIB does not have the C:\Program Files (x86)\Intel\MPI-RT\4.1.0.021\\IA32\LIB directory. That should be part of any default Intel Fortran installation, and I would expect it in your LIB.

I think we can confirm, then, that there is something crazy with your configuration.  Let's see if the answers to my questions above can help us figure out what's going on.

Oh, also I googled the error you were getting, and I suspect it's all related to the configuration problems we're chasing here.  I rather suspect that an unexpected object file or library is being picked up at link time, resulting in an executable that the image loader thinks is 16-bit.  

           --Lorri

0 Kudos
IanH
Honored Contributor III
2,221 Views

(There's no MPI bizzo in my LIB, with a full Fortran Studio XE 2013 install on IA32.)

0 Kudos
olslewfoot
Beginner
2,221 Views

Lorri - In answer to your questions

When I load the Intel Composer Command Prompt the banner looks like this

Intel(R) Parallel Studio XE 2013
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Intel(R) Composer XE 2013 Update 3 (package 171)
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
ERROR: Cannot determine the location of the VS Common Tools folder.

So - is missing the VS Common Tools folder?

My LIB environment is

LIB=C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib;

C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib\ia32;

C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\ia32;

C:\Program Files (x86)\Intel\Composer XE 2013\compiler\lib\ia32;

So no Visual Studio elements listed either.

I suspect the install (carried out by my companies' IT department!).

Can you suggest a remedy?

John

0 Kudos
TimP
Honored Contributor III
2,221 Views

Does the 32-bit CL run in the 32-bit ifort command prompt window, as it should if you installed against VS Pro or higher?  If it does, ifort should find the same link.exe on PATH.  If answer to either of these is no, the installation is broken.

If you have an additional link.exe on PATH , you may require the -Qlocation,link option to specify the correct one, but this problem would not raise the complaint about not finding Visual Studio tools.

If you can't install the CL from Visual Studio, your ifort should be installed with the VS Shell provided with ifort.

0 Kudos
olslewfoot
Beginner
2,221 Views

Dear Intel

Thanks for your comments but I'm at a bit of a loss here?

I hoped to have bought and licensed software (MS Visual Studio 2010 and Intel Visual Fortran) to satisfy pre-requisites for two separate hydrodynamic modelling systems I hoped to run on a high performance laptop. They both work prmarily in Fortran (for the hydrodynamic computation) whilst one of them also needs C++ for its GUI. The other doesn't have a GUI - just runs fortran from the command line.

(incidentally I also run these systems successfully on a linux parallel cluster - but thought it would be great to have the capability to run on windows and easier to debug through VS2010)

I have:  Microsoft Visual Studio 2010 Version 10.0.40219.1 SP1Rel and also Intel(R) Visual Fortran Composer XE 2013 Update 3 Integration for Microsoft Visual Studio* 2010, 13.0.3624.2010,

The install was done by my IT department (as they have the license details) so I don't know the detail of what they did but they obviuously got something wrong.

It seems the system is broken - can you advise me the correct way that these products should be installed and how I can get a clean system before re-doing this please?

John

0 Kudos
Lorri_M_Intel
Employee
2,221 Views

John, have faith, we'll get you going ... :-) 

RE: Ian and mpi-rt.   Hmm ... sorry, I must have been mistaken.

Back to John:  Let's look at your MSVC install.  In the Start menu, there should be "Microsoft Visual Studio 2010" -> Visual Studio Tools
That should bring up a box with several "command line" options.  Is there one labelel "Visual Studio Command Prompt (2010)"?  And, what happens when you click there?

If it succeeds, can you invoke "cl" in that window?  Don't worry about not having a source file, we just want to see if you can invoke the Microsoft C compiler.

       

0 Kudos
olslewfoot
Beginner
2,221 Views

Hi Lorri

Thanks - Yes - There are several versions of the MSVC command prompt.

When I start one  and run cl the following output is given:

Setting environment for using Microsoft Visual Studio 2010 x86 tools.
ERROR: Cannot determine the location of the VS Common Tools folder.

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>

John

0 Kudos
SergeyKostrov
Valued Contributor II
2,221 Views
Duplicate - Deleted
0 Kudos
SergeyKostrov
Valued Contributor II
2,221 Views
Please take a look at my comments: >>When I start one and run cl the following output is given: >> >>Setting environment for using Microsoft Visual Studio 2010 x86 tools. >>ERROR: Cannot determine the location of the VS Common Tools folder. 1. The following bat-file is executed: %ComSpec% /k ""C:\VS.2010\VC\vcvarsall.bat"" x86 in that case 2. The error message: ERROR: Cannot determine the location of the VS Common Tools folder. is displayed from ..\VC\Bin\vcvars32.bat 3. If you look inside of that bat-file you will see: ... @REM ----------------------------------------------------------------------- :error_no_VS100COMNTOOLSDIR @echo ERROR: Cannot determine the location of the VS Common Tools folder. @goto end ... 4. Something is wrong with VS100COMNTOOLSDIR environment variable ( by some reason it is Not set! ). 5. Here is an example of how some environment variables are set on my Windows XP 32-bit development computer: ... VS100COMNTOOLS=C:\VS.2010\Common7\Tools\ VS80COMNTOOLS=C:\VS.2005\Common7\Tools\ VS90COMNTOOLS=C:\VS.2008\Common7\Tools\ ...
0 Kudos
Steven_L_Intel1
Employee
2,221 Views

My guess is that it isn't really a 16-bit executable. Rather, the EXE is corrupted or otherwise not loadable and Windows, unhelpfully, suggests that it's 16-bit. This can happen if the static code and data size approaches 2GB.

Please do this - add the option to create a linker map file and attach a ZIP of the .map file to a reply here.

0 Kudos
SergeyKostrov
Valued Contributor II
2,221 Views
The original message says '... I get a Windows OS message saying that the application is 16bit and will not run on the 64 bit PC...' and I would be glad to see an exact text of the error message. In case of corrupted executable a message '[ program ] is not a valid Win32 application.' has to be displayed ( I just reproduced it ). However, I would also look inside of the executable or try to use MS Depends to verify its integrity.
0 Kudos
olslewfoot
Beginner
2,221 Views

Steve

Unfortunately - when I run a test app from the command line (hello world for instance) it doesn't link due to error so I can't get a .map file.

When I run the hydrodynamic model with /map as an compilier option I don't get the map file unfortunately. Not sure how else to do this

However - I have attached the compiled executable which doesn't run due to it being reported as 16bit. Can this be used to indicate where the bug is? Have just zipped the executable.

JOhn

0 Kudos
IanH
Honored Contributor III
2,221 Views

[plain]>dumpbin bord_ks.exe
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file bord_ks.exe

File Type: LIBRARY[/plain]

Your exe is a library.  Something is pretty confused with your application's build process!

0 Kudos
SergeyKostrov
Valued Contributor II
2,221 Views
>>...Your exe is a library... This is correct. The bord_ks.exe is a Win32 library ( Microsoft format ) and if you open the file in a binary mode you will see a classic signature: ![arch]... Open Project Settings in Visual Studio and on the main propery page change a type of the output file to executable. MS Depends shows the error message and the text is: No DOS or PE signature found. This file is not a valid 32-bit or 64-bit Windows module.
0 Kudos
olslewfoot
Beginner
2,221 Views

Ok - understood!

I'm using the suggested Intel compiler options for the windows OS from the hydrodynamic model developer and the build process seems to run successfully, do you know how this is happening or what mechanism could cause this?

If I use a gfortran compiler (with its own suggested compiler options settings) on exactly same source code it builds and executes without a problem.

JOhn

0 Kudos
SergeyKostrov
Valued Contributor II
2,221 Views
>>...do you know how this is happening or what mechanism could cause this? I could only assume that you're dealing with some strange project upgrade issue. I don't think it is possible to say more clearly without looking at how the project conversion was done.
0 Kudos
Steven_L_Intel1
Employee
2,221 Views

Would you please attach a ZIP of the .vfproj file for the project, or whatever you are using to build this executable?

0 Kudos
olslewfoot
Beginner
2,193 Views

Steve

I am not compiling through a vfproject, this code it is compiled via python script which incoprorates the build process of the new fortran subroutines (I have written) into the many modules of the existing fortran hydrodynamic modelling suite to provide an executable modified at runtime. The file I uploaded (bord_ks.exe) was that ccompiled executable - but it seems to be a library which is why it won't run?

The Telemac suite is tried and tested by several specialist modelling users worldwide and the code compiles and runs perfectly when I use a gfortran compiler.

It seems that my Visual studio/Intel composer installation is broken. I can't use the command line of Composer due to the errors started earlier - (it doesn't find VS Common tools?).

Perhaps I should start from there.

0 Kudos
SergeyKostrov
Valued Contributor II
2,193 Views
>>...The file I uploaded (bord_ks.exe) was that ccompiled executable - but it seems to be a library which is why it won't run? Yes, it can not be executed. >>It seems that my Visual studio/Intel composer installation is broken. I can't use the command line of Composer due to the errors >>started earlier - (it doesn't find VS Common tools?)... I don't see your follow up on: >>... >>4. Something is wrong with VS100COMNTOOLSDIR environment variable ( by some reason it is Not set! ). >>... Did you have a chance to verify it? Use SET command prompt command to view all environment variables. Also, if something is broken a Repair option of the installer could be used, or try to Uninstall and then Install everything again.
0 Kudos
Reply