[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ARM "file format not recognised" mess



Phil Endecott wrote:
file not recognized: File format not recognized
collect2: ld returned 1 exit status

No replies yet; any ideas anyone?


There's another possibility. A while ago I converted my target hardware [an NSLU2 and another similar XScale board, both running Debian] to use an NFS root filesystem. So I could just mount this under /usr/arm-linux-gnu/ on my cross-compilation PC. Would this make things simpler?

I thought that I had seen some mention of this approach before, but maybe I was mistaken. Isn't it essentially the same as running non-cross apt/dpkg inside a chroot? Anyway, I've been investigating; there are various obstacles but they seem surmountable:

1. I can't just mount the ARM filesystem's root at /usr/arm-linux-gnu because /usr/arm-linux-gnu/bin contains the x86 cross-assembler, linker etc. as invoked by /usr/bin/arm-linux-gnu-gcc. This raises the question of "what is /usr/arm-linux-gnu for?". It seems that e.g. /usr/bin/arm-linux-gnu-as and /usr/arm-linux-gnu/bin/as are hard links to each other. Why does /usr/bin/arm-linux-gnu-gcc call /usr/arm-linux-gnu/bin/as, not /usr/bin/arm-linux-gnu-as? Anyway, I have instead mounted the ARM filesystem's /usr/include and /usr/lib as /usr/arm-linux-gnu/include and /usr/arm-linux-gnu/lib, leaving /usr/arm-linux-gnu/bin as-is.

2. I then get the problem that the ARM filesystem has both /lib and /usr/lib, while there is only one /usr/arm-linux-gnu/lib that the compiler looks in. So I have mounted the ARM /lib elsewhere and giving the compiler another -L. (A "transparent mount" feature would help with this.)

3. But the ARM /usr/lib includes some symlinks to /lib (e.g. libm.so), which of course now point to the x86 /lib. One option is to replace them with hard links.

4. That just leaves the ARM /usr/lib/libc.so, which is a linker-script fragment that refers to /lib/libc.so.6 and /usr/lib/libc_nonshared.a. I can't use a hard-link to replace that. It would be nice if I could use a relative symlink, but that ends up pointing to the wrong place. Hmm. Presumably the -cross packages fix these issues during the conversion process, but I need for the ARM system to still work simultaneously.


Any comments would be much appreciated.


Regards,

Phil.






Reply to: