[CMake] make didn't compile

Alexander Neundorf a.neundorf-work at gmx.net
Thu Mar 3 13:33:05 EST 2011


On Thursday 03 March 2011, Enrique Izaguirre wrote:
> Hello friends,
>
> As far as I have been investigating this problem, seems that GNU compilers
> have a problem when combining -c flag with multiple files and -o flag to
> generate an executable.
>
> The problem is that CMake somehow is generating the compile command, and
> assembling it wrongly. Is there any way to overcome this issue?
>
> Thanks
>
> Best Regards
>
> Enrique
>
>
>
> On Wed, Mar 2, 2011 at 10:51 AM, Enrique Izaguirre <
>
> enrique.izaguirre at gmail.com> wrote:
> > Thank you Michael,
> >
> > This is the output:
> >
> >
> > /usr/bin/cmake.exe -H/home/x0148488/myprjflash
> > -B/home/x0148488/myprjflash/cmake_build --check-build-system
> > CMakeFiles/Makefile.cmake 0
> > /usr/bin/cmake.exe -E cmake_progress_start
> > /home/x0148488/myprjflash/cmake_build/CMakeFiles
> > /home/x0148488/myprjflash/cmake_build/CMakeFiles/progress.marks
> > make -f CMakeFiles/Makefile2 all
> > make[1]: Entering directory `/home/x0148488/myprjflash/cmake_build'
> > make -f CMakeFiles/myprj.dir/build.make CMakeFiles/myprj.dir/depend
> > make[2]: Entering directory `/home/x0148488/myprjflash/cmake_build'
> > cd /home/x0148488/myprjflash/cmake_build && /usr/bin/cmake.exe
> > -Ecmake_depends "Unix Makefiles" /home/x0148488/myprjflash
> >  /home/x0148488/myprjflash /home/x0148488/myprjflash/cmake_build
> > /home/x0148488/myprjflash/cmake_build
> > /home/x0148488/myprjflash/cmake_build/CMakeFiles/myprj.dir/DependInfo.cma
> >ke --color=
> > make[2]: Leaving directory `/home/x0148488/myprjflash/cmake_build'
> > make -f CMakeFiles/myprj.dir/build.make CMakeFiles/myprj.dir/build
> > make[2]: Entering directory `/home/x0148488/myprjflash/cmake_build'
> > /usr/bin/cmake.exe -E cmake_progress_report
> > /home/x0148488/myprjflash/cmake_build/CMakeFiles 1
> > [ 12%] Building CXX object
> > CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o /bin/g++-linux  
> > -D_BSD_SOURCE -DWIN32 -D_DEBUG -D_CONSOLE
> > -D_CRT_SECURE_NO_WARNINGS -DNO_ZIP -I/home/x0148488/myprjflash
> > /cmake_build -I/home/x0148488/myprjflash
> > -I/home/x0148488/myprjflash/common/inc -I/home/x0148488/myprjflash/../inc
> > -I/home/
> > x0148488/myprjflash/target/src/boot -I"C:/Program /Files/Microsoft
> > /SDKs/Windows/v6.0A/Include" -I/usr/include/w32api   -
> > Wall -pedantic -Werror -o CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o
> > -c /home/x0148488/myprjflash/comdriver/src/StdAf
> > x.cpp
> >
> > i686-unknown-linux-gnu-g++: cannot specify -o with -c or -S and multiple
> > compilations
> > make[2]: *** [CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o] Error 1
> > make[2]: Leaving directory `/home/x0148488/myprjflash/cmake_build'

I see only one -c and one -o in that command.
The include path with "C:" and a space is unusual.
I'd suggest you take the compile command
/bin/g++-linux -D_BSD_SOURCE -DWIN32 -D_DEBUG -D_CONSOLE -D_CRT_SECURE_NO_WARNINGS -DNO_ZIP -I/home/x0148488/myprjflash/cmake_build -I/home/x0148488/myprjflash -I/home/x0148488/myprjflash/common/inc -I/home/x0148488/myprjflash/../inc-I/home/x0148488/myprjflash/target/src/boot -I"C:/Program 
Files/Microsoft/SDKs/Windows/v6.0A/Include" -I/usr/include/w32api -Wall -pedantic -Werror -o 
MakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o -c /home/x0148488/myprjflash/comdriver/src/StdAfx.cpp

and try to execute it manually and fiddle around with it until you see what is 
going on.

Alex


More information about the CMake mailing list