Trouble finding linker and AR when cross-compiling...

Discuss any Chipmunk bugs here.

Trouble finding linker and AR when cross-compiling...

Postby Spork Schivago » 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.
Spork Schivago
 
Posts: 2
Joined: Thu Dec 19, 2013 9:32 pm

Re: Trouble finding linker and AR when cross-compiling...

Postby slembcke » Fri Dec 20, 2013 12:28 pm

Hmm. Unfortunately I don't have any CMake advice for you as I've never tried cross compiling with it before.

Honestly it might just be easier to make a brand new makefile. Chipmunk doesn't have particularly complex build requirements if you aren't building the demo app. It only links against the stdlib and math lib, and sets some optimization flags like --ffast-math. A lot of people just dump the Chipmunk source into the same compile phase as their main source files since it's a fairly small library.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Trouble finding linker and AR when cross-compiling...

Postby Spork Schivago » Fri Dec 20, 2013 2:27 pm

slembcke wrote:Hmm. Unfortunately I don't have any CMake advice for you as I've never tried cross compiling with it before.

Honestly it might just be easier to make a brand new makefile. Chipmunk doesn't have particularly complex build requirements if you aren't building the demo app. It only links against the stdlib and math lib, and sets some optimization flags like --ffast-math. A lot of people just dump the Chipmunk source into the same compile phase as their main source files since it's a fairly small library.


Unfortunately, I think that might be a bit beyond my capabilities. I've never really been good at understanding Makefiles. I can edit and modify them. Just not very good at creating them. I think I'll just have to use the work-around I talked about earlier. :( Thanks for the help and information though. I really appreciate it.
Spork Schivago
 
Posts: 2
Joined: Thu Dec 19, 2013 9:32 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests