davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

C/C++ crosscompiler on a Windows PC ?

Wed Oct 28, 2015 8:13 pm

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?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
yasriady
Posts: 27
Joined: Wed Apr 08, 2015 2:37 am
Location: Indonesia
Contact: Website

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

Thu Oct 29, 2015 1:03 am

Do you make use of gnuToolchain?

Check it on http://gnutoolchains.com/raspberry/, seem the project is promising.
Now available for Jessie ...............
MyRaspberryPi : Cross Compile, wxWidgets/C++ and Linux Journal at http://yasriady.blogspot.com

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Thu Oct 29, 2015 7:54 am

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?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
yasriady
Posts: 27
Joined: Wed Apr 08, 2015 2:37 am
Location: Indonesia
Contact: Website

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

Thu Oct 29, 2015 9:57 am

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...
MyRaspberryPi : Cross Compile, wxWidgets/C++ and Linux Journal at http://yasriady.blogspot.com

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Thu Oct 29, 2015 10:08 am

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.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
yasriady
Posts: 27
Joined: Wed Apr 08, 2015 2:37 am
Location: Indonesia
Contact: Website

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

Thu Oct 29, 2015 10:24 am

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 ....
MyRaspberryPi : Cross Compile, wxWidgets/C++ and Linux Journal at http://yasriady.blogspot.com

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Thu Oct 29, 2015 10:26 am

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?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
stephj
Posts: 80
Joined: Thu Jun 21, 2012 1:20 pm
Location: Lancashire, UK

Geany for Windows

Thu Oct 29, 2015 11:08 am

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.
Attachments
Geany.JPG
Screenshot
Geany.JPG (52 KiB) Viewed 4698 times

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Thu Oct 29, 2015 11:14 am

thank you al lot, no idea why I missed to find the windows files :oops:
I'll download and install immediately ! 8-)
Last edited by davenull on Thu Oct 29, 2015 7:29 pm, edited 1 time in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Thu Oct 29, 2015 11:18 am

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 ?)
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Thu Oct 29, 2015 7:31 pm

now what do I have to do for Windows-Geany IDE to compile to Raspi executables?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
stephj
Posts: 80
Joined: Thu Jun 21, 2012 1:20 pm
Location: Lancashire, UK

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

Fri Oct 30, 2015 12:00 pm

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
Attachments
Geany.JPG
Geany
Geany.JPG (54.06 KiB) Viewed 4563 times
Build.JPG
Geany - Build
Build.JPG (61.52 KiB) Viewed 4563 times
Last edited by stephj on Fri Oct 30, 2015 2:28 pm, edited 3 times in total.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Fri Oct 30, 2015 12:27 pm

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
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
stephj
Posts: 80
Joined: Thu Jun 21, 2012 1:20 pm
Location: Lancashire, UK

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

Fri Oct 30, 2015 12:44 pm

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.........

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Fri Oct 30, 2015 2:25 pm

that actually does not sound as if it was a walk in the park, regrettably... :roll:
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Fri Oct 30, 2015 7:05 pm

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... :-/
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

User avatar
stephj
Posts: 80
Joined: Thu Jun 21, 2012 1:20 pm
Location: Lancashire, UK

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

Fri Oct 30, 2015 10:08 pm

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.
Last edited by stephj on Mon Nov 09, 2015 11:18 am, edited 1 time in total.

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Sat Oct 31, 2015 8:58 am

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? ) ?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Fri Nov 06, 2015 9:13 am

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?
Last edited by davenull on Fri Nov 06, 2015 9:21 am, edited 1 time in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

ghans
Posts: 7867
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

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

Fri Nov 06, 2015 9:20 am

Not without paying lots of money or switching to a full-blown industry-standard IDE.

ghans
Last edited by ghans on Fri Nov 06, 2015 9:27 am, edited 1 time in total.
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Fri Nov 06, 2015 9:22 am

that's really a pity, because editing and compiling on the Raspi itself is slow and confusing... :(
Last edited by davenull on Sun Nov 08, 2015 6:30 pm, edited 1 time in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

ghans
Posts: 7867
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

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

Fri Nov 06, 2015 9:33 am

Edited my post.
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Fri Nov 06, 2015 9:44 am

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.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1159
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

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

Sat Nov 07, 2015 1:13 pm

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
Last edited by davenull on Sun Nov 08, 2015 6:30 pm, edited 1 time in total.
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23052
Joined: Sat Jul 30, 2011 7:41 pm

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

Sat Nov 07, 2015 3:26 pm

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.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Return to “C/C++”