[CMake] Problem with linker on win32

uruloki at free.fr uruloki at free.fr
Mon Sep 5 08:28:36 EDT 2011


Ok, i've found the problem

I wanted to use the same options for the compiler that those we use in the actual tool chain.
Some of those options are not compatible, but msvc compiler doesn't always complain.
The one which caused me headaches was /c, it suppresses the implicit call to the linker, which i presume is used to produce the executable.


So what i've done:
- define CMAKE_LINKER to be sure to use link.exe for building dlls (else cmake detects ld.exe and it's troubleful)
- get rid of any conflictual options for the compiler.

thank you for your support, now I have to learn how to use Cmake properly and to persuade the managers to make the leap of faith

regards 

Nicolas

----- Mail Original -----
De: uruloki at free.fr
À: "David Cole" <david.cole at kitware.com>
Cc: cmake at cmake.org
Envoyé: Vendredi 2 Septembre 2011 16h13:30 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [CMake] Problem with linker on win32

When i delete the exeUtg.cxx.obj file, it is recompiled without problem

I'm not sure if i can put the file online due to company policy, but it's a plain ansi text file of 60 lines, nothing special about it.

There is somewhere in the process where cmake get confused and uses cl for linking a binary file, and that's why it makes an error

where is defined the linker? I assumed it was in CMAKE_LINKER variable. Is there a variable per language?
or how is it resolved?

regards

Nicolas
----- Mail Original -----
De: "David Cole" <david.cole at kitware.com>
À: uruloki at free.fr
Cc: cmake at cmake.org
Envoyé: Vendredi 2 Septembre 2011 15h13:31 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [CMake] Problem with linker on win32

See also the questions here, also regarding "error C2018" :

  http://stackoverflow.com/questions/1169670/how-to-interpret-error-c2018-unknown-character-0x40


On Fri, Sep 2, 2011 at 9:12 AM, David Cole <david.cole at kitware.com> wrote:
> If you delete "CMakeFiles/exeUtg.dir/exeUtg.cxx.obj" and try again, do
> you get the same error? (Maybe the obj file got built corrupted
> somehow the first time around...?)
>
>
> On Fri, Sep 2, 2011 at 9:11 AM, David Cole <david.cole at kitware.com> wrote:
>> Is there a funky hard-coded string constant in exeUtg.cxx ?
>>
>> Can you send the contents of that source file or is it private?
>>
>>
>> On Fri, Sep 2, 2011 at 8:43 AM,  <uruloki at free.fr> wrote:
>>>
>>> Hello
>>>
>>> We are using PCCTS compiler to build a parser for config files.  *.o files are the results of the language definition.
>>> I have not integrated this part of the build in CMake yet so i'm just linking with .o files built with the previous production toolchain. Those files are linked in the dll.
>>>
>>> Here is the problem i'm referring to when the executable is linked:
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> Linking CXX executable exeUtg.exe
>>> cd E:/devlop/test_cmake/UTG/exeUtg && O:/DevStudio/VC98/Bin/CL.EXE   @CMakeFiles/exeUtg.dir/objects1.rsp  /c /TP  /DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR /MD  -DWIN32 -D_WINNT -D_WIN32_WINNT=0x0501 -D_RWTOOLSDLL -D_AFXDLL /nologo /D_DEBUG /MD /Zi  /Ob0 /Od /GZ /FeexeUtg.exe /FdE:/devlop/test_cmake/UTG/exeUtg/exeUtg.pdb -link /implib:exeUtg.lib /version:0.0    /subsystem:console  libUtg.lib
>>> exeUtgLibelles.cxx.obj
>>> CMakeFiles/exeUtg.dir/exeUtg.cxx.obj(1) : error C2018: unknown character '0x1'
>>> CMakeFiles/exeUtg.dir/exeUtg.cxx.obj(1) : error C2018: unknown character '0x1f'
>>> CMakeFiles/exeUtg.dir/exeUtg.cxx.obj(1) : error C2018: unknown character '0xab'
>>> CMakeFiles/exeUtg.dir/exeUtg.cxx.obj(1) : error C2146: syntax error : missing ';' before identifier 'k'
>>> CMakeFiles/exeUtg.dir/exeUtg.cxx.obj(1) : error C2501: 'L' : missing storage-class or type specifiers
>>> CMakeFiles/exeUtg.dir/exeUtg.cxx.obj(1) : fatal error C1004: unexpected end of file found
>>> make[2]: *** [exeUtg/exeUtg.exe] Error 2
>>> make[1]: *** [exeUtg/CMakeFiles/exeUtg.dir/all] Error 2
>>> make: *** [all] Error 2
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> You can see make uses CL to link and build the executable, and it fails.
>>> Could it be because of the file extension we are using for c++ file?  soureces are hxx and cxx files.
>>>
>>> Thank you for your support
>>>
>>> Nicolas
>>>
>>>
>>> ----- Mail Original -----
>>> De: "David Cole" <david.cole at kitware.com>
>>> À: uruloki at free.fr
>>> Cc: cmake at cmake.org
>>> Envoyé: Vendredi 2 Septembre 2011 13h21:12 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
>>> Objet: Re: [CMake] Problem with linker on win32
>>>
>>> What is the error output?
>>>
>>> How are the *.o files that are in your source tree built?
>>>
>>
>


More information about the CMake mailing list