Trouble finding linker and AR when cross-compiling...
Posted: Thu Dec 19, 2013 9:55 pm
I don't think this is a bug. I think I have something wrong with my CMake file. I'm trying to cross compile Chipmunk Physics for the PS3. All the toolchain files start with powerpc64-ps3-elf-x where x is gcc, g++, cpp, ar, ld, etc. Here is a copy of my Toolchain-ps3.cmake file:
# this one is important
SET(CMAKE_SYSTEM_NAME Generic)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR powerpc64)
# SET(PS3DEV ${PS3DEV}/)
SET(PSL1GHT ${PSL1GHT}/)
# specify the cross compiler
SET(CMAKE_PREFIX_PATH "${PS3DEV}/portlibs/ppu")
SET(CMAKE_C_COMPILER powerpc64-ps3-elf-gcc)
SET(CMAKE_CXX_COMPILER powerpc64-ps3-elf-g++)
SET(CMAKE_C_FLAGS "-mcpu=cell -I${PSL1GHT}/ppu/include -I${PS3DEV}/portlibs/ppu/include")
SET(CMAKE_CXX_FLAGS "-mcpu=cell -I${PSL1GHT}/ppu/include -I${PS3DEV}/portlibs/ppu/include")
SET(CMAKE_AR powerpc64-ps3-elf-ar)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH ${PS3DEV}/ppu)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Whether or not I set CMAKE_AR doesn't make a difference. It seems to compile fine, but when it tries to link, it fails saying: Error running link command: No such file or directory
make[2]: *** [src/libchipmunk.a] Error 2
make[1]: *** [src/CMakeFiles/chipmunk_static.dir/all] Error 2
make: *** [all] Error 2
There's a link.txt file in the src/CMakeFiles/chipmunk_static.dir/ directory. The first word in it is:
CMAKE_AR-NOTFOUND cr
when I don't set CMAKE_AR in the Toolchain file. When I set it on the command line, if I don't put in the full path, it shows:
home/spork/src/my_EFL-PS3/EFL-PS3/build/Chipmunk-6.2.1/build-ppu/powerpc64-ps3-elf-ar
instead of /usr/local/ps3dev/ppu/bin/powerpc64-ps3-elf-ar (it finds the compilers just fine)...
and if I set it in the Toolchain-ps3.cmake file, it shows:
"" cr in the link.txt file. Any ideas what I'm doing wrong? Why does CMake pick up on the compilers just fine but not the archiver?
I have tried everything I can think of. I even removed the SET(CMAKE_PREFIX_PATH "${PS3DEV}/ppu") but it didn't help. Thanks.
# this one is important
SET(CMAKE_SYSTEM_NAME Generic)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR powerpc64)
# SET(PS3DEV ${PS3DEV}/)
SET(PSL1GHT ${PSL1GHT}/)
# specify the cross compiler
SET(CMAKE_PREFIX_PATH "${PS3DEV}/portlibs/ppu")
SET(CMAKE_C_COMPILER powerpc64-ps3-elf-gcc)
SET(CMAKE_CXX_COMPILER powerpc64-ps3-elf-g++)
SET(CMAKE_C_FLAGS "-mcpu=cell -I${PSL1GHT}/ppu/include -I${PS3DEV}/portlibs/ppu/include")
SET(CMAKE_CXX_FLAGS "-mcpu=cell -I${PSL1GHT}/ppu/include -I${PS3DEV}/portlibs/ppu/include")
SET(CMAKE_AR powerpc64-ps3-elf-ar)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH ${PS3DEV}/ppu)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Whether or not I set CMAKE_AR doesn't make a difference. It seems to compile fine, but when it tries to link, it fails saying: Error running link command: No such file or directory
make[2]: *** [src/libchipmunk.a] Error 2
make[1]: *** [src/CMakeFiles/chipmunk_static.dir/all] Error 2
make: *** [all] Error 2
There's a link.txt file in the src/CMakeFiles/chipmunk_static.dir/ directory. The first word in it is:
CMAKE_AR-NOTFOUND cr
when I don't set CMAKE_AR in the Toolchain file. When I set it on the command line, if I don't put in the full path, it shows:
home/spork/src/my_EFL-PS3/EFL-PS3/build/Chipmunk-6.2.1/build-ppu/powerpc64-ps3-elf-ar
instead of /usr/local/ps3dev/ppu/bin/powerpc64-ps3-elf-ar (it finds the compilers just fine)...
and if I set it in the Toolchain-ps3.cmake file, it shows:
"" cr in the link.txt file. Any ideas what I'm doing wrong? Why does CMake pick up on the compilers just fine but not the archiver?
I have tried everything I can think of. I even removed the SET(CMAKE_PREFIX_PATH "${PS3DEV}/ppu") but it didn't help. Thanks.