Wrong version of cl.exe for x64

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrong version of cl.exe for x64

tonka tonka

Hey,

I have recently switched to cmake (instead of plain visual studio).
Now i discovered a problem.cmake choose the wrong cl.exe for my x64 project.
Cmake choose bin/x86_amd64/cl.exe which is the “x64 Cross Tools“. This create x64 binaries, but with my big project I reach a out of memory linker error, because the cl.exe is wrong (this cl.exe is an 32bit compiler which can create x64 binaries).
Cmake should choose bin/amd64/cl.exe to use a “real“ x64 compiler.

Does anybody know how I can tell cmake to do that?

Compiler: visual studio 2010 sp1
OS: win 7 x64
Cmake: 3.4.3

Greetings
Tonka


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

Kristian
Did you already tried to use the "Visual Studio 10 2010 Win64" generator?

https://cmake.org/cmake/help/v3.6/manual/cmake-generators.7.html

2016-08-22 9:27 GMT+02:00 tonka tonka <[hidden email]>:

Hey,

I have recently switched to cmake (instead of plain visual studio).
Now i discovered a problem.cmake choose the wrong cl.exe for my x64 project.
Cmake choose bin/x86_amd64/cl.exe which is the “x64 Cross Tools“. This create x64 binaries, but with my big project I reach a out of memory linker error, because the cl.exe is wrong (this cl.exe is an 32bit compiler which can create x64 binaries).
Cmake should choose bin/amd64/cl.exe to use a “real“ x64 compiler.

Does anybody know how I can tell cmake to do that?

Compiler: visual studio 2010 sp1
OS: win 7 x64
Cmake: 3.4.3

Greetings
Tonka


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

tonka tonka

Yes, i definitely choose the Win64 version.


Am 22.08.2016 09:50 schrieb "Kristian" <[hidden email]>:
Did you already tried to use the "Visual Studio 10 2010 Win64" generator?

https://cmake.org/cmake/help/v3.6/manual/cmake-generators.7.html

2016-08-22 9:27 GMT+02:00 tonka tonka <[hidden email]>:

Hey,

I have recently switched to cmake (instead of plain visual studio).
Now i discovered a problem.cmake choose the wrong cl.exe for my x64 project.
Cmake choose bin/x86_amd64/cl.exe which is the “x64 Cross Tools“. This create x64 binaries, but with my big project I reach a out of memory linker error, because the cl.exe is wrong (this cl.exe is an 32bit compiler which can create x64 binaries).
Cmake should choose bin/amd64/cl.exe to use a “real“ x64 compiler.

Does anybody know how I can tell cmake to do that?

Compiler: visual studio 2010 sp1
OS: win 7 x64
Cmake: 3.4.3

Greetings
Tonka


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

Nils Gladitz-2
In reply to this post by tonka tonka
On 08/22/2016 09:27 AM, tonka tonka wrote:

> Hey,
>
> I have recently switched to cmake (instead of plain visual studio).
> Now i discovered a problem.cmake choose the wrong cl.exe for my x64
> project.
>

I don't think CMake chooses the compiler when using the visual studio
generators.
Visual Studio chooses and CMake just records that choice in
CMAKE_<LANG>_COMPILER.

Nils
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

J Decker
Maybe you need a diferent parameter to vcvarsall before running cmake


On Mon, Aug 22, 2016 at 1:01 AM, Nils Gladitz <[hidden email]> wrote:
On 08/22/2016 09:27 AM, tonka tonka wrote:

Hey,

I have recently switched to cmake (instead of plain visual studio).
Now i discovered a problem.cmake choose the wrong cl.exe for my x64 project.


I don't think CMake chooses the compiler when using the visual studio generators.
Visual Studio chooses and CMake just records that choice in CMAKE_<LANG>_COMPILER.

Nils

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

Nils Gladitz-2

On 08/22/2016 10:28 AM, J Decker wrote:

Maybe you need a diferent parameter to vcvarsall before running cmake



The visual studio command line environments should have no effect when using the visual studio generators.
They should only be relevant when you use one of the command line generators (e.g. makefiles or ninja).

Nils

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

J Decker


On Mon, Aug 22, 2016 at 1:33 AM, Nils Gladitz <[hidden email]> wrote:

On 08/22/2016 10:28 AM, J Decker wrote:

Maybe you need a diferent parameter to vcvarsall before running cmake


>
How to: Enable a 64-Bit Visual C++ Toolset on the Command Line

 

To run vcvarsall.bat to use a 64-bit toolset

  1. At the command prompt, change to the Visual C++ installation directory. (The location depends on the system and the Visual Studio installation, but a typical location is C:\Program Files (x86)\Microsoft Visual Studio version\VC\.) For example, enter:

To configure this Command Prompt window for 64-bit command-line builds that target x86 platforms, at the command prompt, enter:

vcvarsall amd64_x86

*shjrug* the article spells it out. 

The visual studio command line environments should have no effect when using the visual studio generators.
They should only be relevant when you use one of the command line generators (e.g. makefiles or ninja).

Nils


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

tonka tonka

Does cmake call vcvarall.bat itself?

Always call vcvarall.bat before cmake itself is not really a nice solution.

Setting/override CMAKE_CXX_COMPILER to the x64 toolchain could work, but it depends on the question “does cmake call vcvarall.bat internally“


Am 22.08.2016 10:36 schrieb "J Decker" <[hidden email]>:


On Mon, Aug 22, 2016 at 1:33 AM, Nils Gladitz <[hidden email]> wrote:

On 08/22/2016 10:28 AM, J Decker wrote:

Maybe you need a diferent parameter to vcvarsall before running cmake


>
How to: Enable a 64-Bit Visual C++ Toolset on the Command Line

 

To run vcvarsall.bat to use a 64-bit toolset

  1. At the command prompt, change to the Visual C++ installation directory. (The location depends on the system and the Visual Studio installation, but a typical location is C:\Program Files (x86)\Microsoft Visual Studio version\VC\.) For example, enter:

To configure this Command Prompt window for 64-bit command-line builds that target x86 platforms, at the command prompt, enter:

vcvarsall amd64_x86

*shjrug* the article spells it out. 

The visual studio command line environments should have no effect when using the visual studio generators.
They should only be relevant when you use one of the command line generators (e.g. makefiles or ninja).

Nils


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

Albrecht Schlosser
In reply to this post by Nils Gladitz-2
On 22.08.2016 10:33 Nils Gladitz wrote:

> The visual studio command line environments should have no effect when
> using the visual studio generators.

Are you sure? Or what does "should" mean here? ;-)

I know of a case where running CMake (3.2.1) from the installed desktop
link does not find some headers that are found if I run CMake from
within a "Developer Command Prompt for VS2015".

Note: I did not use vcvarsall.bat explicitly.

Shall I post an example CMake file?

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

Nils Gladitz-2
On 08/22/2016 12:18 PM, Albrecht Schlosser wrote:

> On 22.08.2016 10:33 Nils Gladitz wrote:
>
>> The visual studio command line environments should have no effect when
>> using the visual studio generators.
>
> Are you sure? Or what does "should" mean here? ;-)

Yes. The Visual Studio generators are meant to work outside of the
visual studio command line environments while the command line
generators (makefiles, ninja) are meant to work from within the visual
studio command line environment.

What that means is that the Visual Studio generators must work without it.

You can of course create manual dependencies from your project e.g. when
you manually run "cl" from a custom command but such use should
obviously be avoided since it is non-obvious and there is nothing that
prevents you from running e.g. the x86 environment while your visual
studio solution (which will ignore that environment) is targeting amd64.

Nils
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

Albrecht Schlosser
On 22.08.2016 12:54 Nils Gladitz wrote:

> On 08/22/2016 12:18 PM, Albrecht Schlosser wrote:
>
>> On 22.08.2016 10:33 Nils Gladitz wrote:
>>
>>> The visual studio command line environments should have no effect when
>>> using the visual studio generators.
>>
>> Are you sure? Or what does "should" mean here? ;-)
>
> Yes. The Visual Studio generators are meant to work outside of the
> visual studio command line environments while the command line
> generators (makefiles, ninja) are meant to work from within the visual
> studio command line environment.
>
> What that means is that the Visual Studio generators must work without it.

Okay, I posted a simple example CMake file to show what happens in my
case. See new thread:

"Visual Studio generator does not find some header files"

Basically some special (SDK?) header files are not found when executing
CMake w/o the Visual Studio environment.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

Nils Gladitz-2
On 08/22/2016 01:30 PM, Albrecht Schlosser wrote:

> On 22.08.2016 12:54 Nils Gladitz wrote:
>> On 08/22/2016 12:18 PM, Albrecht Schlosser wrote:
>>
>>> On 22.08.2016 10:33 Nils Gladitz wrote:
>>>
>>>> The visual studio command line environments should have no effect when
>>>> using the visual studio generators.
>>>
>>> Are you sure? Or what does "should" mean here? ;-)
>>
>> Yes. The Visual Studio generators are meant to work outside of the
>> visual studio command line environments while the command line
>> generators (makefiles, ninja) are meant to work from within the visual
>> studio command line environment.
>>
>> What that means is that the Visual Studio generators must work
>> without it.
>
> Okay, I posted a simple example CMake file to show what happens in my
> case. See new thread:
>
> "Visual Studio generator does not find some header files"
>
> Basically some special (SDK?) header files are not found when
> executing CMake w/o the Visual Studio environment.
>

E.g. CMake find_path() uses the INCLUDE environment variable (which is
provided by the visual studio command line environment) if set.

So yes this can influence CMake itself but not Visual Studio.
Since the paths in the INCLUDE environment variable are not used by
Visual Studio this can result in obvious conflicts.

Since CMake does not (I don't know if it (easily) could) know the
implicit include directories Visual Studio uses it can not use them in
find_*() calls either.

In case of the OpenGL library (which on windows is part of the
windows/platform SDK) cmake e.g. assumes (within the FindOpenGL.cmake
module) that the header is in an implicit include directory and does not
try to locate it.

Assuming this matches your use case I would suggest you do the same.

Nils
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

Albrecht Schlosser
On 22.08.2016 14:12 Nils Gladitz wrote:

> On 08/22/2016 01:30 PM, Albrecht Schlosser wrote:
>
>> On 22.08.2016 12:54 Nils Gladitz wrote:
>>> On 08/22/2016 12:18 PM, Albrecht Schlosser wrote:
>>>
>>>> On 22.08.2016 10:33 Nils Gladitz wrote:
>>>>
>>>>> The visual studio command line environments should have no effect when
>>>>> using the visual studio generators.
>>>>
>>>> Are you sure? Or what does "should" mean here? ;-)
>>>
>>> Yes. The Visual Studio generators are meant to work outside of the
>>> visual studio command line environments while the command line
>>> generators (makefiles, ninja) are meant to work from within the visual
>>> studio command line environment.
>>>
>>> What that means is that the Visual Studio generators must work
>>> without it.
>>
>> Okay, I posted a simple example CMake file to show what happens in my
>> case. See new thread:
>>
>> "Visual Studio generator does not find some header files"
>>
>> Basically some special (SDK?) header files are not found when
>> executing CMake w/o the Visual Studio environment.
>>
>
> E.g. CMake find_path() uses the INCLUDE environment variable (which is
> provided by the visual studio command line environment) if set.
>
> So yes this can influence CMake itself but not Visual Studio.
> Since the paths in the INCLUDE environment variable are not used by
> Visual Studio this can result in obvious conflicts.

Okay, I see.

> Since CMake does not (I don't know if it (easily) could) know the
> implicit include directories Visual Studio uses it can not use them in
> find_*() calls either.

Understood. Thanks for the information.

> In case of the OpenGL library (which on windows is part of the
> windows/platform SDK) cmake e.g. assumes (within the FindOpenGL.cmake
> module) that the header is in an implicit include directory and does not
> try to locate it.

Well, that's a pity. This makes it necessary to use platform specific
code in CMake files unless you can completely rely on modules that do
already include such platform specify code.

> Assuming this matches your use case I would suggest you do the same.

Indeed our case in FLTK (www.fltk.org), a cross platform GUI library
(for those that don't know it) is related to OpenGL (GL/gl.h and
GL/glu.h), but also locale.h. We need to know if we can #include these
(and other) header files in the library code.

I took a look into our old bundled IDE files and found that we _assumed_
that these headers existed even in our oldest supported Visual C++ IDE
(the provided config.h file was edited accordingly).

So, the conclusion is: since CMake can't figure it out we have to
_assume_ that the header files can be #included in MSVC projects (MinGW
works well), hence we should set the corresponding CMake variable to
true, maybe something like:

if (MSVC)
   set (HAVE_GL_GL_H 1)
endif (MSVC)

Is this what you suggest?

This would work, but it's very unfortunate to have to do this. It would
be much better if find_file() or find_path() would be able to work
really cross platform w/o special assumptions. But I see your point.


I'll take another look in our CMake files to see if find_package(OpenGL)
would get us to
a better solution.

Thanks for your support.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Wrong version of cl.exe for x64

Nils Gladitz-2
On 22.08.2016 19:34, Albrecht Schlosser wrote:

>
> So, the conclusion is: since CMake can't figure it out we have to
> _assume_ that the header files can be #included in MSVC projects
> (MinGW works well), hence we should set the corresponding CMake
> variable to true, maybe something like:
>
> if (MSVC)
>   set (HAVE_GL_GL_H 1)
> endif (MSVC)
>
> Is this what you suggest?

I suppose I'd go with if(WIN32).

Nils


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake