2
votes

Fair warning I am somewhat new to GCC development.

I am currently trying to do a personal port of Box2D to android (tech arm). I create a standalone toolchain, export the following....

export PATH=/tmp/my-android-toolchain/bin:$PATH

export CC=arm-linux-androideabi-gcc

export CXX=arm-linux-androideabi-g++

Then I run Make, everything "seems" to be running fine, however, at the end I see...

/private/tmp/my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: bin/Debug/libBox2D.a: no archive symbol table (run ranlib) /private/tmp/my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: obj/Debug/HelloWorld/Helloworld.o: in function main:../../HelloWorld/Helloworld.cpp:38: error: undefined reference to 'b2World::b2World(b2Vec2 const&)' /private/tmp/my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: obj/Debug/HelloWorld/Helloworld.o: in function main:../../HelloWorld/Helloworld.cpp:47: error: undefined reference to 'b2World::CreateBody(b2BodyDef const*)' /private/tmp/my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: obj/Debug/HelloWorld/Helloworld.o: in function main:../../HelloWorld/Helloworld.cpp:53: error: undefined reference to 'b2PolygonShape::SetAsBox(float, float)'

If I open up a new terminal (essentially killing the exports) and delete the bin and obj folder everything compiles fine. A quick Google search suggests this could be related to it using the llvm compiler instead of GCC (although with my CC I think this less likely). There are the following instructions for llvm in the standalone toolchain doc...

If you wish, add --llvm-version=3.1 to also copy clang/llvm 3.1.

Should I add llvm? Is this an issue with bionic being different?

Thanks!

1

1 Answers

8
votes

You are likely using the OSX version of ar. Can't tell for sure from you log. Try setting export AR=arm-linux-androideabi-ar