# Troubleshooting AOSP build error...



## codesplice (Oct 21, 2011)

Hey guys,

I had gotten pretty good/comfortable with building AOKP JB from source, picking cherries, targeting multiple devices, and even making some modifications of my own. I decided I wanted to try my hand at something a bit more challenging, so I opted to start from a pure AOSP base and slowly start bringing in just the modifications and features that I want in my "perfect" ROM. I've spent about the past week working on this project and learning about what changes I needed to make to be able to build my own ROM. I've pored through the "build" branch of rascarlo's rasbeanjelly github and paid special attention to any deviations from the stock format to make sure I brought in what I needed. I also based a vendor tree loosely upon racarlo's (while consulting the example here. Right now, the only real changes I've made are adding in a few prepackaged applications and build.prop settings. I was pretty stoked on Friday when the build process finally made it past the initial checks!

Unfortunately, about three hours later the build failed with the following error:



> target Executable: toolbox (out/target/product/maguro/obj/EXECUTABLES/toolbox_intermediates/LINKED/toolbox)
> /media/build/andy_jb/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld: out/target/product/maguro/obj/EXECUTABLES/toolbox_intermediates/toolbox.o: in function tools:toolbox.c(.data.rel.ro.tools+0x204): error: undefined reference to 'r_main'
> collect2: ld returned 1 exit status
> make: *** [out/target/product/maguro/obj/EXECUTABLES/toolbox_intermediates/LINKED/toolbox] Error 1


I'm a bit lost on this, as I haven't changed anything in any of the "prebuilts" projects. Just to confirm, I did a "repo sync" on just the project tree referenced in the error (prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6) against android.googlesource.com and repeated the built attempt - same thing.

This morning, I'm firing off a completely stock maguro build bypassing my vendor modifications to see if it is still affected but it will likely be ~3 hours before I know for sure. Has anyone encountered a similar issue and can maybe provide some ideas on figuring out where I'm going wrong? I'll buy you a beer if you can help me 

Cheers,
John

(edit Well the stock build compiled without error, so I guess there's something screwy in or referenced by the files in my vendor tree. I'll dig a bit deeper there.


----------



## changyuheng (Aug 19, 2013)

I think that is because you modified the makefile or changed lunched device-varient so that the object cannot be linked properly.


----------

