[CMake] problem using a new toolchain

Daniel Franzini daniel.franzini at gmail.com
Thu May 19 12:16:34 EDT 2011


hi

I'm trying to create a CMake build environment for a medium sized
application. The application is getting ported to several plataforms and I
would like to have just one build environment.

The host plataform is WinVista/Linux. The first target plataform I'm trying
to create a build for is PSP. PSP have a toolchain (PSPSDK) which is based
in GNU tools. I'm trying to write a new toolchain file for using the PSPSDK.

-----------------------------PSPSDK-Toolchain.cmake-----------------------------
# the name of the host operating system
SET(CMAKE_SYSTEM_NAME "Generic")

# here the target toolchain is located for cross compilation
SET( CMAKE_FIND_ROOT_PATH "C:\\pspsdk\\bin" )

# which compilers to use for C and C++
SET( CMAKE_C_COMPILER psp-gcc )
SET( CMAKE_CXX_COMPILER psp-g++ )
SET( CMAKE_MAKE_PROGRAM make )
SET( CMAKE_RC_COMPILER psp-ar )
-----------------------------PSPSDK-Toolchain.cmake-----------------------------

It seems that CMake can find the psp-gcc and psp-g++ but the configure
process fails because it cannot find some basic libraries needed.

The log of the configure process is:

----------------------------------------------------------------------------------------------
The C compiler identification is GNU

The CXX compiler identification is GNU

Check for working C compiler: C:/pspsdk/bin/psp-gcc.exe

Check for working C compiler: C:/pspsdk/bin/psp-gcc.exe -- broken

CMake Error at C:/Program Files/CMake
2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):

The C compiler "C:/pspsdk/bin/psp-gcc.exe" is not able to compile a simple

test program.

 It fails with the following output:

 Change Dir:
C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp

  Run Build Command:C:/FPC/2.4.0/bin/i386-win32/make.exe

"cmTryCompileExec/fast"

 C:/FPC/2.4.0/bin/i386-win32/make.exe -f

CMakeFiles/cmTryCompileExec.dir/build.make

CMakeFiles/cmTryCompileExec.dir/build

 make.exe[1]: Entering directory

`C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp'

 "C:/Program Files/CMake 2.8/bin/cmake.exe" -E cmake_progress_report

C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp/CMakeFiles

1

 "Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj"

 C:/pspsdk/bin/psp-gcc.exe -o

CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj -c

C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp/testCCompiler.c

 "Linking C executable cmTryCompileExec"

 C:/pspsdk/bin/psp-gcc.exe

"CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj" -o cmTryCompileExec

 c:/pspsdk/bin/../lib/gcc/psp/4.3.3/../../../../psp/lib/crt0.o: In function

`_start':

 ../../../../pspsdk/src/startup/crt0.c:149: undefined reference to

`sceKernelCreateThread'

 ../../../../pspsdk/src/startup/crt0.c:150: undefined reference to

`sceKernelStartThread'

 c:/pspsdk/bin/../lib/gcc/psp/4.3.3/../../../../psp/lib/crt0.o: In function

`_main':

 ../../../../pspsdk/src/startup/crt0.c:68: undefined reference to `strlen'

 ../../../../pspsdk/src/startup/crt0.c:83: undefined reference to `atexit'

 ../../../../pspsdk/src/startup/crt0.c:89: undefined reference to `exit'

 collect2: ld returned 1 exit status

 make.exe[1]: *** [cmTryCompileExec] Error 1

 make.exe[1]: Leaving directory

`C:/Users/danielt3/code/bennugd-monolithic-dev/build/CMakeFiles/CMakeTmp'

 make.exe: *** [cmTryCompileExec/fast] Error 2

    CMake will not be able to correctly generate this project.

Call Stack (most recent call first):

CMakeLists.txt:9 (project)

 Configuring incomplete, errors occurred!
----------------------------------------------------------------------------------------------

It is clear that it can find the compiler but cannot find the
libraries...some are common C functions (strlen, etc); other are PSP
specific (sceKernelCreateThread, etc). How can I ask CMake to link some
libraries to every executable which is using this particular toolchain? Will
I have to manually set in CMakeLists.txt


Also, it is using the wrong make.exe program (is there a variable where I
can force it to use a specific make)?


-- 
Daniel

"Let us change our traditional attitude to the construction of programs.
Instead of imagining that our main task is to instruct a computer what to
do, let us concentrate rather on explaining to human beings what we want a
computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (
http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while
I'm not good at painting, drawing, or music, I can write software."
(Yukihiro Matsumoto, a.k.a. ``Matz'')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110519/abe21dfb/attachment-0001.htm>


More information about the CMake mailing list