Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: Dermiste on October 27, 2014, 12:34:33 PM

Title: m68k cross compiler // stdio.h missing
Post by: Dermiste on October 27, 2014, 12:34:33 PM
Hi there,

Using the utility in tools I create a cross compiler targeted for m68k family processors.
When I try to compile a simple hello world exemple I get the following:
helloworld.c:1:19: fatal error: stdio.h: No such file or directory

I guess it's missing all the basic libraries. Is there any way I can recompile the cross compiler so it includes them? Or maybe I need to add something to that command:
/usr/local/bin/m68k-elf-gcc -Wall helloworld.c -o hello


To make it work properly?

Thanks in advance
Title: Re: m68k cross compiler // stdio.h missing
Post by: saratoga on October 27, 2014, 02:03:40 PM
I don't know if you can use our compilers to build for something other than Rockbox.

Title: Re: m68k cross compiler // stdio.h missing
Post by: Dermiste on October 27, 2014, 02:12:50 PM
But this utility, rockboxdev.sh, allows to create a cross compiler right?
I am not yet at the point where I need to check the relevance of the target, first the compiler is missing the basics lib stdio.h.
When I compile using gcc (I am on osx) it works fine, so it means I have to add params or sth.

Any idea?
Title: Re: m68k cross compiler // stdio.h missing
Post by: saratoga on October 27, 2014, 02:40:20 PM
Its not missing those; we just don't use many of them.

Edit: take a look at the make file for an m68k target. It should list the actual headers iirc.
Title: Re: m68k cross compiler // stdio.h missing
Post by: Dermiste on October 27, 2014, 02:59:08 PM
Ok so there is a way a can modify the way the cross compiler is made to include those?
When you say the make file for a m68k target you mean a makefile for an existing project of mine? Or the makefile used in RockBox, in which case I don't know where to find it
Title: Re: m68k cross compiler // stdio.h missing
Post by: saratoga on October 27, 2014, 03:01:54 PM
To be honest I don't even know what you expect that command to do. Compile your program for a 68k build of osx? Or compile it for a Rockbox command line interface that doesn't exist? Something else?
Title: Re: m68k cross compiler // stdio.h missing
Post by: Dermiste on October 27, 2014, 03:06:52 PM
Yeh actually I'm sorry I didn't even specify what I was hoping to do with that.

I've put my hand on a source code for a Coldfire 5272 processor. It's an electronic project and this will make a Quadricopter fly :)
Only thing is, the actual source code can be compiled only on a linux computer at my university, because everything is setup over there to do so.
As I am on osx, I want to be able to build for my computer too. My teacher told me that I had to download binutils and gcc and create a cross compiler to compile for a m68k target, from OSX. I believe the rockboxdev.sh script does create this cross compiler for the right target.

So, If I am right, if I find the missing libraries I will be able to compile my project.
Right?
Title: Re: m68k cross compiler // stdio.h missing
Post by: saratoga on October 27, 2014, 03:09:45 PM
That's definitely not going to work. You might be able to modify our build script to work but its probably easier to start with a compiler targeting m68k Linux.
Title: Re: m68k cross compiler // stdio.h missing
Post by: Dermiste on October 27, 2014, 03:13:06 PM
Why not ? In a few words :D I am quite new to this C world, although I am a web developer
Title: Re: m68k cross compiler // stdio.h missing
Post by: saratoga on October 27, 2014, 08:45:54 PM
the output of a given compiler target a specific system. This is the reason you can't use a windows compiler to build Mac programs. You will need to setup a compiler that targets whatever your device runs.

I think you should ask your teacher for help.
Title: Re: m68k cross compiler // stdio.h missing
Post by: [Saint] on October 27, 2014, 09:59:05 PM
the output of a given compiler target a specific system. This is the reason you can't use a windows compiler to build Mac programs. You will need to setup a compiler that targets whatever your device runs.

OP seems to be at least partially aware of this fact, and appears to be attempting to do exactly this, hence the mention of cross compilation of the toolchain that targets his specific architecture.

But, then again, its quite possible I'm getting it wrong too.

I believe it is clear what OP is trying to achieve, but there is a clear disconnect between what OP wants to achieve and the roadmap s/he believes will allow him/her to arrive at this destination.

I think you should ask your teacher for help.

This.

Support for compiling generic non-Rockbox things is quite firmly out of the scope of this support channel. Even if one is attempting to use our tool set to do so.

Your teacher/instructor/spirit guide/whatever is much better suited to answer this question for you, and at the same time you can ask him or her why they seem to have completely failed you in assisting you with your assigned task and supplying you with a firm grounding of understanding of which to work from.


[Saint]

Title: Re: m68k cross compiler // stdio.h missing
Post by: Dermiste on December 28, 2014, 01:59:33 PM
Hi all,

Just for the record, I did manage to fix my issues which were only related to the way I was including libs.
Turns out that using rockboxdev.sh it is possible to create a cross compiler to target a coldfire uController on a quadricopter :D