[CMake] Cross compiling arm-elf on Windows host
Alexander Neundorf
a.neundorf-work at gmx.net
Sun Sep 20 12:53:08 EDT 2009
On Sunday 20 September 2009, Harald Kipp wrote:
> Hi all,
>
> I'm considering CMake for our Ethernut project
> http://www.ethernut.de
>
> In a first step I tried to build a simple library for an arm-elf target.
> I tried to follow
> http://www.itk.org/Wiki/CMake_Cross_Compiling
> as well as
> http://www.itk.org/Wiki/CmakeEcos
>
> Unfortunately nothing worked here. :-(
>
> The eCos sample is obviously targeted for Linux hosts.
Yes.
When I was working with eCos, we used either Linux or cygwin as development
platform. Not sure if there may be issues with the eCos tools if you are not
using cygwin.
> After several hours of trial and error I managed to get a few things
> working, but still no library build.
>
> I decided to cut everything back to pure minimum.
>
> My toolchain file:
>
> --- C:\ethernut-4.9.6\toolchain-generic.cmake ---
> INCLUDE(CMakeForceCompiler)
> SET(CMAKE_SYSTEM_NAME Generic)
> SET(CMAKE_SYSTEM_PROCESSOR arm7tdmi)
> CMAKE_FORCE_C_COMPILER(arm-elf-gcc GNU)
> CMAKE_FORCE_CXX_COMPILER(arm-elf-g++ GNU)
> -------------------------------------------------
>
> My top CMakeLists:
>
> --- C:\ethernut-4.9.6\nut\CMakeLists.txt ---
> cmake_minimum_required(VERSION 2.6)
> add_subdirectory(fs)
> --------------------------------------------
>
> My subdir CMakeLists:
>
> --- C:\ethernut-4.9.6\nut\fs\CMakeLists.txt ---
> add_library(nutfs STATIC basename dirent dirname)
This command means that you want to build a library called "nutfs" from the
source files "basename", "dirent" and "dirname". Is this what you want ?
> -----------------------------------------------
>
> My command sequence:
>
> cd C:\ethernut-4.9.6
> mkdir nutbld
> cd nutbld
>
> then
>
> cmake -G "Unix Makefiles"
> -DCMAKE_TOOLCHAIN_FILE=c:\ethernut-4.9.6\toolchain-generic.cmake
> c:\ethernut-4.9.6\nut
>
> So far the result is
>
> -- Configuring done
> -- Generating done
> -- Build files have been written to: C:/ethernut-4.9.6/nutbld
>
> However, when trying to run make, I get
What "make" is it ? cygwin ? mingw ?
> Scanning dependencies of target nutfs
> [ 33%] Building C object fs/CMakeFiles/nutfs.dir/basename.c.obj
> Das System kann den angegebenen Pfad nicht finden.
Try "VERBOSE=1 make" to see the full command which is executed.
> make[2]: *** [fs/CMakeFiles/nutfs.dir/basename.c.obj] Error 1
> make[1]: *** [fs/CMakeFiles/nutfs.dir/all] Error 2
> make: *** [all] Error 2
>
> Furthermore, when
>
> cd fs
> make -n
>
> gives
>
> cd C:/ethernut-4.9.6/nutbld && "C:/Programm....
>
> I think that this will not work on Windows. cd requires backslashes.
I think this depends on the type of makefiles you generate and on the type of
make/shell you use to execute them.
You might try the nmake makefiles in case you have nmake.
Alex
More information about the CMake
mailing list