Page 1 of 2

C/C++ crosscompiler on a Windows PC ?

Posted: Wed Oct 28, 2015 8:13 pm
by davenull
hey,
which crosscompiler can I use for my Raspi on a Windows PC ?
FTM I'm using Geany, compiling on-board the Raspi, but that's excruciatingly slow.

I have absolutely no clue of ssh or putty, and I hate the Eclipse monster.
I also don't wish to have a Linux system or virtual machine on my PC.
How should I do it by a simple IDE on my PC, by a IDE similar to Geany and an easy Raspi-PC-interfacing (by USB ?) for uploading compiled files and then starting them remotely?

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Thu Oct 29, 2015 1:03 am
by yasriady
Do you make use of gnuToolchain?

Check it on http://gnutoolchains.com/raspberry/, seem the project is promising.
Now available for Jessie ...............

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Thu Oct 29, 2015 7:54 am
by davenull
I'm using just what is already installed of gpp on Raspbian,
and on my PC I'm using what is installed by the Arduino IDE (gnu C/C++ crosscompiler for AVR and ARM), there surly must be something, but nothing additional or specific - what are toolchains actually? Are you experienced in using them?

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Thu Oct 29, 2015 9:57 am
by yasriady
If you're using windows, go and download Windows toolchain for Raspberry/PI (http://gnutoolchains.com/raspberry/) and then configure your IDE to use this compiler. Toolchain is sets of application to build and compile your source codes into target binary format.
Codeblocks is one of prominent IDE, be it on Windows or Linux as well.
I'm currently using Netbeans Linux IDE configured with cross compile toolchain generated by buildroot...

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Thu Oct 29, 2015 10:08 am
by davenull
I have no IDE on Windows so far to be used for Raspi purposes...
which should I choose?
Codeblocks, Visual Studio and Eclipse are far too complicated.
is there a Geany IDE for Windows?
At least it must be as simple as Geany :

just 1 editor screen,
1 compiler message screen,
1 menu for compiler and makefile settings/ preferences and how to interface the Raspi

...that's all I want.

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Thu Oct 29, 2015 10:24 am
by yasriady
For Windows IDE, you may download:
- Netbeans C++ (http://download.netbeans.org/netbeans/8 ... p-linux.sh)
- gnuToolchain compiler (http://sysprogs.com/files/gnutoolchains ... c4.9.2.exe)

Then configure your netbeans with that gnuToolchain...

Netbeans->Tools->Options->C/C++
Tool Collection -> Add
Add new Toolchain there ....

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Thu Oct 29, 2015 10:26 am
by davenull
netbeans is for Linux, isn't it?

- edit now I found it... also for Windows and almost as huge as Eclipse, but unfortunately also the Java SDK is needed which is one thing that I really hate to have on my PC.

No really simple IDE like Geany out there?

Geany for Windows

Posted: Thu Oct 29, 2015 11:08 am
by stephj
http://www.geany.org/Download/Releases

The Windows binaries are in the middle of the page.

It needs the GTK 2.24 runtime but it is included as part of the installation.

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Thu Oct 29, 2015 11:14 am
by davenull
thank you al lot, no idea why I missed to find the windows files :oops:
I'll download and install immediately ! 8-)

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Thu Oct 29, 2015 11:18 am
by davenull
done. :)
Search:
Results of search for Windows Raspberry:
0 pages found out of 243 pages searched.
how can I make the settings to make it run as a cross-compiler for the Raspi (compile targeting the Raspi ARM cpu, upload binaries/executables to the Raspi? via USB? or via LAN/WiFi ?)

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Thu Oct 29, 2015 7:31 pm
by davenull
now what do I have to do for Windows-Geany IDE to compile to Raspi executables?

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Oct 30, 2015 12:00 pm
by stephj
Assuming you have downloaded and installed the GNU ARM toolchain, (as mentioned by yasriady in post #2 above), to its default directory, then change the 'Compile' and 'Build' commands in Geany to use:

C:\SysGCC\Raspberry\bin\arm-linux-gnueabihf-gcc

As per the image below.

'Build' creates the file 'test' in the same directory as test.c

In theory, get this file over to your Pi and it should work. Haven't got a Pi here at the moment..............

Looking promising....... at least the file 'test' has an ELF header offset 0x12 of value 0x28, which denotes it is an ARM executable.

Tip: to view the images below at their correct resolution, copy/paste them into Paint or similar

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Oct 30, 2015 12:27 pm
by davenull
thanks, now I understand how this would work in principle!

As I have several additional libs to be included, where do I put them on my PC?
e.g., my current make command is

Geany (Raspi) settings for make:
g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o "%e" "%f" -lshapes -lshape_plus -L/opt/vc/lib -lOpenVG -lEGL -lpthread -lrt -lwiringPi

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Oct 30, 2015 12:44 pm
by stephj
Could get quite messy. I would probably read this first then have a good think about it.

http://wiki.geany.org/howtos/configurebuildmenu

You could get into a version control nightmare.

One way could be to duplicate the linux directory structure on your PC and simply reverse the slashes, or take just the copies of the libraries you need and dump them all in one directory.

Pros and cons either way.........

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Oct 30, 2015 2:25 pm
by davenull
that actually does not sound as if it was a walk in the park, regrettably... :roll:

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Oct 30, 2015 7:05 pm
by davenull
no solution out-of-the-box yet for a Windows-to-Raspi-cross compiler ?
That's weird, IMO, that no one else should have needed such a thing so far...except me... :-/

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Oct 30, 2015 10:08 pm
by stephj
Update: Copied the 'test' output file to a USB stick and mounted it on the Pi.

At the console:

sudo mount -t vfat /dev/sda1 /mnt

I entered /mnt/test and hit the enter key.

"Hello World!" appeared on the next line.

Result! End the week on a good note.

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Sat Oct 31, 2015 8:58 am
by davenull
sorry, I don't understand:
additionally to pthread, wiringPi and pigpio I have to #include (and dynamically link) also openvg and shapes_plus libs (partially by passing absolute path names) which is done by the following compiler/build setting:

g++ -Wall -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -o "%e" "%f" -lshapes -lshape_plus -L/opt/vc/lib -lOpenVG -lEGL -lpthread -lrt -lwiringPi

how can I have all those libs to be linked and compiled on my PC,
then transfered (by LAN/USB wire or WiFi) to the Raspi,
and then the program remotely started
(just as if F8, F9, F5 was pressed on Raspi-Geany? ) ?

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Nov 06, 2015 9:13 am
by davenull
so is there no all-in-one cross compiler available for Windows to Raspi? Also for complicated long compile- and build- -L and -I and whatever parameters strings to be called?

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Nov 06, 2015 9:20 am
by ghans
Not without paying lots of money or switching to a full-blown industry-standard IDE.

ghans

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Nov 06, 2015 9:22 am
by davenull
that's really a pity, because editing and compiling on the Raspi itself is slow and confusing... :(

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Nov 06, 2015 9:33 am
by ghans
Edited my post.

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Fri Nov 06, 2015 9:44 am
by davenull
lot of money of course is no option,
and monsters like Eclipse or Visual Studio will also never see my harddisk.
It must be a simple IDE, suitable for C beginners, hobbyists, laymen, comparable to Geany or the Arduino IDE which actually also provides such a very convenient crosscompiler to AVR and even to ARM (Zero, Due, Tian, Teensy), Atheros (Yun), and Intel (Galileo, Edison) boards.

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Sat Nov 07, 2015 1:13 pm
by davenull
ps,
slowly I'm really despairing having to work for compile and all that on the Raspi itself..



Image A KINGDOM OF HEAVEN FOR A CROSS COMPILER !! Image

Re: C/C++ crosscompiler on a Windows PC ?

Posted: Sat Nov 07, 2015 3:26 pm
by jamesh
I use a cross compiler for big builds, but on Linux. That works well using Eclipse. Using cygwin you could make it work on Windows.

Cross compiling is not as simple as simply having a cross compiler - you also need all the libraries you might ant to use compiled as well.

Use make -j4 on the Pi to improve compilation speeds (uses all four cores). Not sure why you are finding compiles so slow on the Pi, most home made programs compile quickly for me.