Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Tue Jul 31, 2012 9:20 pm

I wrote a simple batch script which is executed in Eclipse "Post-build Step". The script takes the executable name as an input and, by using Putty (SSH shell connectivity), copies the binary file on raspberry pi.

By using Putty it should be possible to run the gdbserver on the raspberry (still working on that). At the moment the biggest problem would be to cross compile, as Ian said, gdb..

IanLinsdell
Posts: 21
Joined: Fri Jun 29, 2012 9:34 pm

Re: Cross-Compiler for Windows

Wed Aug 01, 2012 2:45 pm

Have just built a cross compile version of gdb (softfp), will also build hardfp version and upload as soon as I get time.

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Wed Aug 01, 2012 2:54 pm

IanLinsdell wrote:Have just built a cross compile version of gdb (softfp), will also build hardfp version and upload as soon as I get time.
Thank you very much Ian, I'm looking forward to it!

I also tried to build my own toolchain by following your guide but without any luck. It fails with this error:
[ERROR] make[4]: *** [Grid_Generator_System.lo] Error 1
[ALL ] In file included from /myCross/.build/src/ppl-0.11.1/src/Init.defs.hh:84,
[ALL ] from /myCross/.build/src/ppl-0.11.1/src/Init.cc:26:
[ALL ] /myCross/.build/src/ppl-0.11.1/src/Init.inlines.hh: In function `void Parma_Polyhedra_Library::restore_pre_PPL_rounding()':
[ERROR] /myCross/.build/src/ppl-0.11.1/src/Init.defs.hh:78: error: `Parma_Polyhedra_Library::fpu_rounding_direction_type Parma_Polyhedra_Library::Init::old_rounding_direction' is private
[ERROR] /myCross/.build/src/ppl-0.11.1/src/Init.inlines.hh:42: error: within this context
[ALL ] /myCross/.build/src/ppl-0.11.1/src/checked.inlines.hh:632: confused by earlier errors, bailing out
[ALL ] Makefile:1158: recipe for target `Init.lo' failed
It doesn't matter which PPL version I select from crosstool-ng menu or which GCC flavour. Did you have the same error?

I'm using crosstool-ng 1.15.3 with Linaro GCC (tried many Linaro version + Vanilla GCC 4.6.3).

IanLinsdell
Posts: 21
Joined: Fri Jun 29, 2012 9:34 pm

Re: Cross-Compiler for Windows

Wed Aug 01, 2012 4:57 pm

Humm... I did not have that error with PPL,(CT_PPL_VERSION="0.11.2")

There is a softfloat version of the crosscompiler and gdb now at: https://github.com/IanLinsdell/Raspberrypi

I was unable to use the Linario compiler as I was continually getting URL error when trying to pull source from the Linario repository.
I looked at their site and it looked like they had chosen to maintain the cross compile environment themselves with their own version of crosstool-ng which might explain the error when crosstools tried to download.

IanLinsdell
Posts: 21
Joined: Fri Jun 29, 2012 9:34 pm

Re: Cross-Compiler for Windows

Wed Aug 01, 2012 5:48 pm

Added hardfloat version for Raspbian Image also at same location:
https://github.com/IanLinsdell/Raspberrypi

I have verified that the softfp version compiles and runs with a sample GTK application on QEMU

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Thu Aug 02, 2012 5:47 am

IanLinsdell wrote:Humm... I did not have that error with PPL,(CT_PPL_VERSION="0.11.2")

There is a softfloat version of the crosscompiler and gdb now at: https://github.com/IanLinsdell/Raspberrypi

I was unable to use the Linario compiler as I was continually getting URL error when trying to pull source from the Linario repository.
I looked at their site and it looked like they had chosen to maintain the cross compile environment themselves with their own version of crosstool-ng which might explain the error when crosstools tried to download.
Thank you very much for your efforts, I'll test the hardfp ASAP.

Sadly, I'm using the very same PPL version. By the way, to use the Linaro compiler, I simply googled for the tar.bz2 file crosstool-ng was looking for and copied it inside the \tarballs subfolder. I issued again a crosstool-ng build command and it didn't try to download gcc anymore and used the one I provided. I'm on another machine now, I'll try to rebuild the toolchain here!

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Thu Aug 02, 2012 1:19 pm

Ian, your GDB works flawlessly! Simply perfect!

I was able to remotely debug my software from my Windows 7 machine! :-) Awesome!

I'm writing a little tutorial with all the settings I used.

IanLinsdell
Posts: 21
Joined: Fri Jun 29, 2012 9:34 pm

Re: Cross-Compiler for Windows

Thu Aug 02, 2012 4:02 pm

Hi Dexterp37,

Glad the GDB worked out.

I would be interested in your gdb tutorial and Eclipse settings.

Would be great if you could post it when you are done ?

Ian

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Fri Aug 03, 2012 8:56 am

IanLinsdell wrote:Hi Dexterp37,

Glad the GDB worked out.

I would be interested in your gdb tutorial and Eclipse settings.

Would be great if you could post it when you are done ?

Ian
Here we got :-) It took me a while to write everything down, I sincerely hope I did not miss anything important.

Remote cross-debugging from Windows to Raspberry Pi

Please let me know if does or doesn't work for you and again, thank you for your GCC compilers. Even on my home machine, I still have the PPL library problem so I'm not able to compile the Linaro tool chain. :(

IanLinsdell
Posts: 21
Joined: Fri Jun 29, 2012 9:34 pm

Re: Cross-Compiler for Windows

Fri Aug 03, 2012 1:23 pm

Thanks Dexterp37,

Nice article :)

james968
Posts: 29
Joined: Tue Jul 17, 2012 8:52 am

Re: Cross-Compiler for Windows

Fri Aug 03, 2012 1:54 pm

You might want to install qemu and qemu-arm on windows, you can then run a virtual RaspPi.

James

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Wed Aug 08, 2012 11:40 am

Just a last message: I finally compiled the whole Linaro tool chain!

You can find it at this address: https://github.com/Dexterp37/raspi-ar/t ... /toolchain

:)

It contains hardfp version of linaro gcc and linaro gdb! Hope this helps!

feverish
Posts: 497
Joined: Wed Jun 27, 2012 2:29 pm

Re: Cross-Compiler for Windows

Fri Aug 10, 2012 2:23 pm

Toad King wrote:Does anybody know of any method for cross-compiling Ras-Pi programs/libraries from Windows? I know there are some Linux/Unix methods, but I can't find any from Windows. Am I going to be forced to use a virtual machine for it?
Do you think it would be cheating to write the programme using Lazarus in windows and then install and use it with Lazarus on the RasPi?
If discrimination is not challenged then we are effectively in collusion with the perpetrators of such behaviour:-Oxford dictionaries

User avatar
CasaDelGato
Posts: 49
Joined: Mon Jul 16, 2012 9:36 pm

Re: Cross-Compiler for Windows

Sat Aug 11, 2012 8:11 pm

CopperPhil wrote:Hi Dexterp37,

- install Eclipse with CDT
- install Cygwin
- extract cross-arm-gcc-softfpV1 somewhere (let's say in "...\toolchain")
:?
So, where do I get this "cross-arm-gcc-softfp V1" package?
Worlds only All Electric Ford F250

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Sun Aug 12, 2012 7:55 am

CasaDelGato wrote: So, where do I get this "cross-arm-gcc-softfp V1" package?
From HERE. If you are interested, I've compiled an hard floating point Linaro tool-chain (an ARM optimized version of GCC, GDB). You can find it HERE.

User avatar
CasaDelGato
Posts: 49
Joined: Mon Jul 16, 2012 9:36 pm

Re: Cross-Compiler for Windows

Sun Aug 12, 2012 2:33 pm

Thanks.
I downloaded the .cmake file ok, but the .rar file seems to be corrupt? 30KB and WinRar can't open it.
Worlds only All Electric Ford F250

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Sun Aug 12, 2012 5:25 pm

The cmake file is needed if you are trying to build a cmake project with Cygwin.

For the toolchain, you need to download arm-unknown-linux-gnueabi_hardfp.rar

User avatar
CasaDelGato
Posts: 49
Joined: Mon Jul 16, 2012 9:36 pm

Re: Cross-Compiler for Windows

Sun Aug 12, 2012 6:02 pm

As I said, the ...hardfp.rar file at github.com/Dexterp37 seems to be corrupt.
With the way this forum hides links, I hadn't realized 2 different links were provided in the earlier msg.
So I tried the .zip file from github.com/IanLinsdell/, and that also comes down as corrupt.
Either something is really hosed with my Firefox downloads, or both those files aren't really in the format they are saying they are in.
Would someone else please check to see that they can be downloaded AND opened with WinRar under MS WIndows?
Worlds only All Electric Ford F250

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Sun Aug 12, 2012 6:10 pm

Try to download the compressed repository from HERE. You will find the file in the toolchain folder.

Otherwise, use a git client to download it and you should have no problems!

User avatar
CasaDelGato
Posts: 49
Joined: Mon Jul 16, 2012 9:36 pm

Re: Cross-Compiler for Windows

Sun Aug 12, 2012 6:15 pm

Thanks, that worked!
Worlds only All Electric Ford F250

User avatar
CasaDelGato
Posts: 49
Joined: Mon Jul 16, 2012 9:36 pm

Re: Cross-Compiler for Windows

Tue Sep 04, 2012 12:16 am

I'm finally getting back to trying to set this up.
This may sound odd but, in Step 2, you said:
IanLinsdell wrote:
2. Extract the cross compiler (If usnig QEMU to test your app use the soft float version) into the /opt
directory. e.g. C:\cygwin\opt\

Your expanded cross compiler should be expanded into the following directory:
e.g. C:\cygwin\opt\cross\x-tools\arm-unknown-linux-gnueabi
}
Exactly where do we get the Cross Compiler?
It sounds like we have multiple choices?
Worlds only All Electric Ford F250

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Tue Sep 04, 2012 7:39 am

The ones from Ian Linsdell can be downloaded from https://github.com/IanLinsdell/Raspberrypi

In my previous post I've also provided a link to the ones I've compiled. To recap

Ian Linsdell ( https://github.com/IanLinsdell/Raspberrypi )

- Soft fp Cross Compilers
- Hard fp Cross Compilers

Me (https://github.com/Dexterp37/raspi-ar/tree/development)

- Hard fp Linaro Cross Compilers (with GDB)

RedPenguin
Posts: 3
Joined: Mon Aug 27, 2012 9:30 pm

Re: Cross-Compiler for Windows

Mon Mar 04, 2013 7:40 am

I have been using the Cygwin arm-unknown-linux-gnueabi- and have noticed a bizzare issue.

I was attempting to make a librtmp.so.0 file for XBMC and I have compiled OpenSSL & zlib with no problem according to this site:

https://www.daphne-emu.com:9443/mediawi ... osscompile

The problem is that files seem to have strange sizes.

The librtmp.so.0 ends up 1.78MB according to ls in Cygwin and Windows, and the file seems it's normally to be around KBs not MBs.

I mean the outputed files seem to work but since I sometimes share my compiled files, people may end up thinking my files are infected or something is wrong with the strange file sizes.
Last edited by RedPenguin on Mon Mar 04, 2013 8:16 am, edited 1 time in total.

Dexterp37
Posts: 21
Joined: Mon Jul 30, 2012 7:51 pm
Location: Italy

Re: Cross-Compiler for Windows

Mon Mar 04, 2013 7:45 am

Try to run this command

Code: Select all

strip librtmp.so.0
if the file contains debug informations, it strips them.

RedPenguin
Posts: 3
Joined: Mon Aug 27, 2012 9:30 pm

Re: Cross-Compiler for Windows

Mon Mar 04, 2013 3:59 pm

Thank you.

I did that and it did shrink it down to 1.5MB which I still don't understand.

I compiled librtmp the same way on the Pi itself with Raspbmc, libssl-dev, and zlib1g-dev, and it compiles to less than 200KB, so I am not sure why the cross-compiler makes it so much bigger.

I looked at the Windows, Linux, iOS version of librtmp and none are that big.

Return to “General discussion”