wyattwong
Posts: 19
Joined: Fri Mar 15, 2013 3:18 pm
Location: Hong Kong

Should include the same version of gcc as the linux kernel

Sun Feb 22, 2015 3:29 pm

I found that the latest Raspbian Debian Wheezy (updated on 16-Feb-2015) linux kernel was built with gcc-4.8.3

pi@raspberrypi / $ cat /proc/version
Linux version 3.18.7-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015

However, the bundled gcc is version 4.6.3. It would be nice to always bundled the *SAME* version of gcc as what the linux kernel was built with so that people can use it to build applications or device drivers.

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: Should include the same version of gcc as the linux kern

Sun Feb 22, 2015 3:37 pm

wyattwong wrote:I found that the latest Raspbian Debian Wheezy (updated on 16-Feb-2015) linux kernel was built with gcc-4.8.3

pi@raspberrypi / $ cat /proc/version
Linux version 3.18.7-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015

However, the bundled gcc is version 4.6.3. It would be nice to always bundled the *SAME* version of gcc as what the linux kernel was built with so that people can use it to build applications or device drivers.
+1

It is a pain when you want to build a module for your own hardware and you have to find and install the appropriate gcc. The version SHOULD match. I don't ever remember them being out of step on any other platform.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

enedil
Posts: 80
Joined: Sat Feb 21, 2015 4:22 pm
Location: Toruń, Poland
Contact: Website

Re: Should include the same version of gcc as the linux kern

Sun Feb 22, 2015 9:00 pm

And why it's done that way?

Answer is simple:
Debian version used to create Raspbian is Wheezy, which is currently stable. Which means that there won't be non-security updates. So the GCC version released is 4.6. However, newer compilers provide better binary files (faster, smaller). That's the reason of compiling Linux kernel with GCC 4.8.
- What Can a Thoughtful Man Hope for Mankind on Earth, Given the Experience of the Past Million Years?
- Nothing.

Kurt Vonnegut, Cat's Cradle

sbp
Posts: 128
Joined: Wed Sep 26, 2012 7:54 pm

Re: Should include the same version of gcc as the linux kern

Mon Feb 23, 2015 9:58 am

I agree.

Please fix this.
piCorePlayer webpage: https://sites.google.com/site/picoreplayer/home

wyattwong
Posts: 19
Joined: Fri Mar 15, 2013 3:18 pm
Location: Hong Kong

Re: Should include the same version of gcc as the linux kern

Mon Feb 23, 2015 2:40 pm

enedil wrote:And why it's done that way?

Answer is simple:
Debian version used to create Raspbian is Wheezy, which is currently stable. Which means that there won't be non-security updates. So the GCC version released is 4.6. However, newer compilers provide better binary files (faster, smaller). That's the reason of compiling Linux kernel with GCC 4.8.
But if the kernel is built by gcc-4.8.3, the Raspbian image should include the SAME version of gcc so that user can use the same gcc for building other softwares and device drivers. I don't see any reason for not including gcc-4.8.3 into the Raspbian image.
Last edited by wyattwong on Tue Feb 24, 2015 5:28 am, edited 1 time in total.

User avatar
jojopi
Posts: 3317
Joined: Tue Oct 11, 2011 8:38 pm

Re: Should include the same version of gcc as the linux kern

Mon Feb 23, 2015 4:18 pm

I believe this is the toolchain used to build the Foundation's kernels: https://github.com/raspberrypi/tools/tr ... spbian-x64

Since it requires an x86-64 host, there would be little point including it in a Raspbian image. You cannot use it to compile "other software" without first setting up target libraries to match those in Raspbian.

If you need extra modules, compile the whole kernel and modules using the same config. Use whatever compiler you prefer.

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: Should include the same version of gcc as the linux kern

Mon Feb 23, 2015 6:11 pm

jojopi wrote:I believe this is the toolchain used to build the Foundation's kernels: https://github.com/raspberrypi/tools/tr ... spbian-x64

Since it requires an x86-64 host, there would be little point including it in a Raspbian image. You cannot use it to compile "other software" without first setting up target libraries to match those in Raspbian.

If you need extra modules, compile the whole kernel and modules using the same config. Use whatever compiler you prefer.
Nonsense ! The correct version is available natively in the jessie repo so only a matter of back porting it into the current Raspbian. On my A+ I have it installed because I'm building I2S modules.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

enedil
Posts: 80
Joined: Sat Feb 21, 2015 4:22 pm
Location: Toruń, Poland
Contact: Website

Re: Should include the same version of gcc as the linux kern

Mon Feb 23, 2015 6:41 pm

GCC is a critical component. No one can tell that v4.8 is enough stable and bug-free to enter stable stage. Nobody wants to guarantee the non-tested software. That's why GCC 4.8 is not included. And installing GCC 4.8 is quite easy, so no need of.
- What Can a Thoughtful Man Hope for Mankind on Earth, Given the Experience of the Past Million Years?
- Nothing.

Kurt Vonnegut, Cat's Cradle

wyattwong
Posts: 19
Joined: Fri Mar 15, 2013 3:18 pm
Location: Hong Kong

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 5:45 am

enedil wrote:GCC is a critical component. No one can tell that v4.8 is enough stable and bug-free to enter stable stage. Nobody wants to guarantee the non-tested software. That's why GCC 4.8 is not included. And installing GCC 4.8 is quite easy, so no need of.
I am sure no one (I mean anyone, everyone) can guarantee **ANY** software (be it GCC, Visual C++, Windows, OS X, Office, etc.) are stable enough and bug-free to enter stable stage. And someone use this gcc-4.8-3 (maybe not stable enough?) to build the Linux kernel for Raspbian Debian Wheezy, what is the logic behind then ?

Installed gcc-4.8 to Raspbian is different from gcc-4.8.3, I need to follow the steps in the following URL to successfully installed to my Raspbian Debian Wheezy Linux. But why the fuss that I need to do so if gcc-4.8.3 was bundled *NATIVELY* with the Raspbian Debian Wheezy Linux ?

https://github.com/notro/rpi-source/wiki

Anyway, it is ONLY my suggestion.

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 8:05 am

Code: Select all

Discontinued
2015-02-11
I haven't got the time to maintain this anymore. If anyone want's to pick it up, please do.
It doesn't work with the Pi2 kernel.

rpi-source installs the kernel source used to build rpi-update kernels and the kernel on the Raspian image.
OH :o :shock: That is bad news. I have not tried it yet on a Pi2 as my module work is on an A+, but I'm sure at some point I will want to build a module for a Pi2. Do you know if he stopping maintaining it because of the gcc version mismatch or are there other PI2 kernel issues (such as ARM version change) or is it just the time needed ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
AndyD
Posts: 2334
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 8:29 am

PeterO wrote:... Do you know if he stopping maintaining it because of the gcc version mismatch or are there other PI2 kernel issues (such as ARM version change) or is it just the time needed ?
The development of fbtft has moved into the Linux Kernel, so notro probably isn't using the Raspberry Pi kernel source any longer.

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 8:33 am

AndyD wrote: The development of fbtft has moved into the Linux Kernel, so notro probably isn't using the Raspberry Pi kernel source any longer.
Ah I see, I just tried to PM him on this forum but he has PMs disabled .... I would be interested in keeping it maintained if he can offer to "hand hold" for a few months.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

wyattwong
Posts: 19
Joined: Fri Mar 15, 2013 3:18 pm
Location: Hong Kong

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 11:49 am

His steps work in my RPi 2 and I can installed gcc-4.8.3 to my RPi 2 (I got RPi 1 B+ but haven't try his steps yet). Unfortunately I was unable to build a workable rtl8188eu for my Mercury 150Mbps wifi dongle using gcc-4.8.3. Luckily someone had kindly built it and provided a binary version for me and it works. Maybe I should save the website just in case it will be gone in the near future.

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 3:08 pm

notro has accepted my offer of help to keep rpi-source up to date.
It will be after the Brithday Party before I get time to "get on board" though.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

wyattwong
Posts: 19
Joined: Fri Mar 15, 2013 3:18 pm
Location: Hong Kong

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 3:59 pm

You mean you will take over to maintain the page for him ?

User avatar
jojopi
Posts: 3317
Joined: Tue Oct 11, 2011 8:38 pm

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 7:52 pm

PeterO wrote:Nonsense ! The correct version is available natively in the jessie repo so only a matter of back porting it into the current Raspbian.
Not really. Linaro 2014.03 is branched from prerelease GCC 4.8.3, but it is not the same compiler as upstream. In fact, it is significantly different, especially in the area of ARM code generation, or there would be no reason for it to exist at all. Debian GCC is not upstream either, and it happens to include patches derived from Linaro, but jessie's 4.8.3-13 was released in October, so it is probably closer to Linaro 2014.11.

Quite simply, the reason the GCC version in Raspbian does not match the kernel is that the Foundation do not compile their kernels on Raspbian. It is illogical to expect them to make available a compiler that is not the one they use and could not be guaranteed to be functionally identical.

Of course, it probably works fine to compile modules with a different GCC and then load them in the Foundation kernel. Or you can compile the whole kernel and modules together, as I recommend. Compiler version is not even the biggest issue with additional or out of tree modules. They only work when the module has no non-module prerequisite configuration options.

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 8:20 pm

So you seem to be saying that there are multiple different compilers all claiming to be 4.8.3 ? If this is true then some need shooting as that is a totally indefensible situation !
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: Should include the same version of gcc as the linux kern

Tue Feb 24, 2015 10:08 pm

wyattwong wrote:You mean you will take over to maintain the page for him ?
And maintain the code as well as I've been using it to build a couple of very simple modules for an I2S audio input codec break out board.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

wyattwong
Posts: 19
Joined: Fri Mar 15, 2013 3:18 pm
Location: Hong Kong

Re: Should include the same version of gcc as the linux kern

Wed Feb 25, 2015 5:29 am

jojopi wrote:
PeterO wrote:Nonsense ! The correct version is available natively in the jessie repo so only a matter of back porting it into the current Raspbian.
Not really. Linaro 2014.03 is branched from prerelease GCC 4.8.3, but it is not the same compiler as upstream. In fact, it is significantly different, especially in the area of ARM code generation, or there would be no reason for it to exist at all. Debian GCC is not upstream either, and it happens to include patches derived from Linaro, but jessie's 4.8.3-13 was released in October, so it is probably closer to Linaro 2014.11.

Quite simply, the reason the GCC version in Raspbian does not match the kernel is that the Foundation do not compile their kernels on Raspbian. It is illogical to expect them to make available a compiler that is not the one they use and could not be guaranteed to be functionally identical.

Of course, it probably works fine to compile modules with a different GCC and then load them in the Foundation kernel. Or you can compile the whole kernel and modules together, as I recommend. Compiler version is not even the biggest issue with additional or out of tree modules. They only work when the module has no non-module prerequisite configuration options.
So you mean we cannot build gcc-4.8.3 into binaries from the GNU source (http://www.gnu.org/software/gcc/) in Raspberry Pi because the Raspberry Pi Linux kernel is built with a different gcc source (i.e Linaro 2014.03) ? And using the Linaro 2014.03 source can we build the correct Raspberry Pi Linux kernel (with ARM code).

If we need to build a gcc-4.8.3 for use in Raspberry Pi, we should to use a PC or Mac for cross-build the compiler and then transfer the binary into Rapsberry Pi ?

Furthermore, if we have to build some device drivers for use in Raspberry Pi, we should build the device driver as well as the whole Linux kernel in Raspberry Pi instead of just building the device drivers into binaries. And we need to deploy both the kernel.img and the device driver binaries to Raspberry Pi to guarantee that the device driver work as expected ?

If that is so, I think the building of device drivers is more complicated in Raspberry Pi

Return to “Raspberry Pi OS”