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

Porting to 64-bit

dannycat
New Contributor I
1,285 Views

Am I correct in my understanding that you can compile and link a 64-bit program (to run on a target 64-bit machine/OS) on a 32-bit machine with Core 2 Duo Processor. When I try it the compilation is fine but it stops with the following link error:

Error1 fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'x64\Debug/menuupdate.obj

The name of the object file can vary in the message.

I get the same problem when I tried to rebuild a static library. Why should the linker be called at all?

What is causing the linker to be used?

I am running Visual Studio 2008 with Version 11.0.039 beta Intel FORTRAN for windows.

0 Kudos
1 Solution
Steven_L_Intel1
Employee
1,285 Views

You can add CONFIG=WIN64 under project Properties > Fortran > Preprocessor

View solution in original post

0 Kudos
12 Replies
Steven_L_Intel1
Employee
1,285 Views

Yes, you can, but the process of targeting x64 is somewhat convoluted in Visual Studio - so much so that some people try to do it a different way that gets them into trouble.

The correct way is to do Build > Configuration Manager and create a "New" platform of type X64. Make sure that all your projects appear with X64 as the platform type in this dialog. This process is described in the Fortran documentation.

The incorrect way is to go to Tools > Options > Intel Fortran > Compilers and try to change the compiler paths to those for Intel64.

Another way you can run into trouble, especially if you are converting a CVF project, is to have the /machine linker/librarian option set under the Command Line property page. This should be removed.

You must also make sure that you have the "X64 Compiler and Tools" option installed for Visual Studio. This is not the default with a Professional or Team System Edition install.

The librarian is actually the linker wearing a disguise.

0 Kudos
dannycat
New Contributor I
1,285 Views

Yes, you can, but the process of targeting x64 is somewhat convoluted in Visual Studio - so much so that some people try to do it a different way that gets them into trouble.

The correct way is to do Build > Configuration Manager and create a "New" platform of type X64. Make sure that all your projects appear with X64 as the platform type in this dialog. This process is described in the Fortran documentation.

The incorrect way is to go to Tools > Options > Intel Fortran > Compilers and try to change the compiler paths to those for Intel64.

Another way you can run into trouble, especially if you are converting a CVF project, is to have the /machine linker/librarian option set under the Command Line property page. This should be removed.

You must also make sure that you have the "X64 Compiler and Tools" option installed for Visual Studio. This is not the default with a Professional or Team System Edition install.

The librarian is actually the linker wearing a disguise.

Steve,

I'd already installed X64 Compiler & Tools (I have some C code in the project) and set the platform type in Configuration Manager to x64.

I removed the /machine linker/librarian option and now I get the following message.

Error1 fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'LIBCMTD.lib(chkstk.obj)

0 Kudos
Steven_L_Intel1
Employee
1,285 Views
I'd guess that your library paths are not set correctly and you are linking in 32-bit libraries in a 64-bit build. Can you paste in the buildlog from the project that gets this error?
0 Kudos
dannycat
New Contributor I
1,285 Views
I'd guess that your library paths are not set correctly and you are linking in 32-bit libraries in a 64-bit build. Can you paste in the buildlog from the project that gets this error?

Steve,

The build log is quite a large file. How do you add a file using the Add Files option. It does not seem to work?

0 Kudos
Steven_L_Intel1
Employee
1,285 Views

Click on Add Files

If you have not previously created a file folder here, fill in a new folder name and click Create Folder

Click on the name of the folder you just created

Click the Browse button to browse for the file, click Upload

Click on the name of the file you uploaded

Optional: edit the Title field

Click Add as Attachment

If the file is very large, feel free to ZIP it first.

0 Kudos
dannycat
New Contributor I
1,285 Views

Steve,


I don't see a Browse button on the Add Files dialog box. The only option is to search but this just selects one of the directories that have been created. Each directory has a tick box, what purpose do they serve?

0 Kudos
Steven_L_Intel1
Employee
1,285 Views

There should be a Browse button to the left of the Upload button. Ignore the tick boxes.

If you're unable to do this, then please open an issue with Intel Premier Support and attach the project files there.

0 Kudos
dannycat
New Contributor I
1,285 Views

There should be a Browse button to the left of the Upload button. Ignore the tick boxes.

If you're unable to do this, then please open an issue with Intel Premier Support and attach the project files there.

Steve,

I got a browse button when I double clicked the folder name I'd created. So hopefully there should be a build log file attached which shows the problem I mentioned above.

0 Kudos
Steven_L_Intel1
Employee
1,285 Views

That worked.

The problem is the following option:

/LIBPATH:"C:Program FilesMicrosoft Visual Studio 9.0VClib"

I don't know where this is coming from - it may be a property set in your project. The correct value would be:

/LIBPATH:"C:Program FilesMicrosoft Visual Studio 9.0VClibamd64"

You should not need to specify this explicitly at all - if you have properly created an "x64" configuration it should be implicit.

0 Kudos
dannycat
New Contributor I
1,285 Views

That worked.

The problem is the following option:

/LIBPATH:"C:Program FilesMicrosoft Visual Studio 9.0VClib"

I don't know where this is coming from - it may be a property set in your project. The correct value would be:

/LIBPATH:"C:Program FilesMicrosoft Visual Studio 9.0VClibamd64"

You should not need to specify this explicitly at all - if you have properly created an "x64" configuration it should be implicit.

Thanks Steve,

The definition was specified in the Additional Libraries setting for link. I put it in when I was struggling to get the IMSL routines to link last week.

I've now got to the point now where I need to remove all references to F90SQL. CanI use a "Global" 'define' for compiler preprocessor (eg!DEC$ DEFINE CONFIG WIN64) whereby all source files can recognise itand consequentlyI can use the same source for both 32 and 64 bit versions? If not I will have specific copies.

0 Kudos
Steven_L_Intel1
Employee
1,286 Views

You can add CONFIG=WIN64 under project Properties > Fortran > Preprocessor

0 Kudos
dannycat
New Contributor I
1,285 Views

You can add CONFIG=WIN64 under project Properties > Fortran > Preprocessor

That's excellent, thanks again Steve

0 Kudos
Reply