XIX
Posts: 7
Joined: Wed Jun 06, 2012 9:14 pm

How is cross compiler formed?

Thu Jun 07, 2012 2:41 pm

Hiya,

I was hoping it might be simple enough to just install the gnueabihf cross compiler in ubuntu and use

arm-linux-gnueabihf-gcc -march=armv6zk -mfpu=vfp -mfloat-abi=hard -marm -mcpu=arm1176jzf-s -mtune=arm1176jzf-s helloworld.c

This works, except where it crashes instantly when run under raspbian :)

I'm assuming this is a linking with a default crt built the wrong way, sort of problem, is this right?

Also tried the 32bit compiler from https://github.com/raspberrypi/tools/tr ... rm-bcm2708 however that isn't hardfloat so fails to link.

Any suggestions?

I really don't want to have to build on the device or in VM which seems to be the current solution.

plugwash
Forum Moderator
Forum Moderator
Posts: 3748
Joined: Wed Dec 28, 2011 11:45 pm

Re: How is cross compiler formed?

Thu Jun 07, 2012 4:02 pm

I would agree that most likely your problem is you are linking against an armv7 libgcc and therefore contaminating your binaries with armv7 code. You need to swap that out somehow.

Another option may be to modify the cross compiler package so it builds raspbian compatible code and libraries by default.

XIX
Posts: 7
Joined: Wed Jun 06, 2012 9:14 pm

Re: How is cross compiler formed?

Mon Jun 11, 2012 2:51 pm

Well I tried but I think I'm going to give up on wrangling arm-linux-gnueabihf-gcc to link itself with another crt / libs

No amount of messing with its spec files or options seems to be able to convince it to find/link with another bunch of libs. So I guess its got some hard coded paths somewhere else.

Which is a shame, I guess the next step is trying to build a working cross compiler from source.

Return to “Raspberry Pi OS”