0

My environment is arm-linux-androideabi (Android 2.2 on a Toshiba AC100). I have 2 sets of GCC compilers for my environment(installed at separate locations on the device):

  1. 4.4.3 (Android NDK on Android)
  2. 4.6.0 (R + GCC on Android)

The problem I face is that the gcc-4.6.0 segfaults whenever it runs (however it runs every task successfully, just segfaulting at the end,probably in the exit routines), while ld-4.4.3 and ar-4.4.3 fail to run on my environment. On the other hand gcc-4.4.3 runs beautifully, as does ld-4.6.0 and ar-4.6.0.

Thus, while building on my device, if I run configure using 4.4.3, it'll fail at the configure step because even if the configure test programs are compiled successfully, gcc segfaults and returns a non-zero value(139). However if I run configure with 4.6.0, configure runs well enough, but the build (make all) fails miserably at linking and static library creation.

My questions are:

  1. Is it possible to use gcc-4.4.3 to compile my object files (gcc-4.4.3 -c input.c) and then link with ld-4.6.0 (ld-4.6.0 -o input input.o -lc )? That is, I'll remove the problematic binaries and use a combination of the working binaries to build projects.
  2. If there are caveats, then what are they?
Samveen
  • 3,482
  • 35
  • 52
  • Didn't try it but i wonder what libraries (headers) would compiler use and what linker will link. Probably you will have to tell them... – dbrank0 May 06 '12 at 08:33
  • As soon as I posted this question, I realised I could have tried it and seen. However, as your comment demonstrates, there are a lot of caveats that I need to look into. – Samveen May 06 '12 at 08:37

1 Answers1

-1

You can call gcc using a shell script, to hide the bad exit code.

gfour
  • 959
  • 6
  • 9
  • I already do that. However, it has a drawback that gcc wrapper will return true even if the compilation should fail, as the exit code is consistently the one returned for segmentation fault (139). – Samveen May 08 '12 at 04:13
  • Maybe you could check if an executable was produced and return success, otherwise return an error code? Of course, the whole thing continues to be a hack... – gfour May 08 '12 at 08:43