OpenWrt Forum Archive

Topic: How do I install GCC into OpenWrt?

The content of this topic has been archived on 4 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm running OpenWrt on a 667Mhz x86 Single Board Computer with 256M of ram and a 512M or bigger flash card or hard drive....

I cannot seem to find a package for GCC to install so that I can use it to develope code on.

Is this possible?

(Yeah, yeah, I know, I know, most folks routers couldn't even hold GCC... [double wide grin])

Thanks very much,

-Jesse

Thanks very much, Charlie!

Setting up a build environment is something I haven't yet ventured to do....!

I'll have to give that a try, when I stumble upon directions.

Thanks again,

-Jesse

ciscostu wrote:

I think you'll have to build your own package (with the OpenWrt buildroot or SDK).

The Makefile is here-

https://dev.openwrt.org/browser/packages/devel/gcc

Hope this helps,
Charlie

Could someone please be so kind as to direct me to working instructions on how to make buildlroot work?
I've never done it before (although I've been compiling stuff for slackware linux for years).

Every tutorial I find so far on how to do buildroot doesn't work. They all fail with something like:

svn co https://svn.openwrt.org/openwrt/branches/whiterussian/openwrt/ whiterussian
svn: PROPFIND request failed on '/openwrt/branches/whiterussian/openwrt'
svn: PROPFIND of '/openwrt/branches/whiterussian/openwrt': 405 Not Allowed (https://svn.openwrt.org)

(from https://forum.openwrt.org/viewtopic.php?id=8410)


or:

svn co https://svn.openwrt.org/openwrt/trunk/
svn: PROPFIND request failed on '/openwrt/trunk'
svn: PROPFIND of '/openwrt/trunk': 405 Not Allowed (https://svn.openwrt.org)

(from http://downloads.openwrt.org/docs/build … tion.html)

Admittedly, I don't often use svn.. (Usually I just get the tarball.)

What am I doing wrong?

Thank you very much,

-Jesse

Hi Jesse.

First of all, don't use whiterussian - it's outdated, unmaintained and not supported anymore. The reason why every single tutorial seems to fails for you is that openwrt.org changed it's svn location recently, it now uses svn:// instead of https:// . So the right command for checkout would be:

  svn co svn://svn.openwrt.org/openwrt/trunk/

For the next steps I recommend reading this forum post outlining the usual steps:

  https://forum.openwrt.org/viewtopic.php?id=16599

Regards,
JoW

Thanks very much, Jow.

I followed your suggestion and the link you provided and everything went fine until "make world V=99" when it said it could not download RT2870_Firmware_V8.zip and after getting 404 at three mirrors, it gave up.

Unfortunately the exact errors went off the top of my scrollback buffer in screen - so I'm re-running make world V=99 to get them again and I'll paste them in here then.

Should I disable RT2870, or try to download the file it's missing? If so how/where?

Thanks very much,

-Jesse

PS: Here's the exact error:

rm -rf /big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/root-x86/tmp-libiw
touch /big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/root-x86/stamp/.libiw_installed
make[3]: Leaving directory `/big/usr/src/openwrt/trunk/package/wireless-tools'
make[3]: Entering directory `/big/usr/src/openwrt/trunk/package/mac80211'
mkdir -p /big/usr/src/openwrt/trunk/dl
/big/usr/src/openwrt/trunk/scripts/download.pl "/big/usr/src/openwrt/trunk/dl" "RT2870_Firmware_V8.zip" "a7aae1d8cfd68e4d86a73000df0b6584" http://www.ralinktech.com.tw/data/drivers
--10:00:44--  http://www.ralinktech.com.tw/data/drivers/RT2870_Firmware_V8.zip
           => `-'
Resolving www.ralinktech.com.tw... 211.75.121.149
Connecting to www.ralinktech.com.tw|211.75.121.149|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
10:00:47 ERROR 404: Not Found.

Download failed.
--10:00:47--  http://mirror2.openwrt.org/sources/RT2870_Firmware_V8.zip
           => `-'
Resolving mirror2.openwrt.org... 88.198.39.176
Connecting to mirror2.openwrt.org|88.198.39.176|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
10:00:48 ERROR 404: Not Found.

Download failed.
--10:00:48--  http://downloads.openwrt.org/sources/RT2870_Firmware_V8.zip
           => `-'
Resolving downloads.openwrt.org... 78.24.191.177
Connecting to downloads.openwrt.org|78.24.191.177|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
10:00:49 ERROR 404: Not Found.

Download failed.
No more mirrors to try - giving up.
make[3]: *** [/big/usr/src/openwrt/trunk/dl/RT2870_Firmware_V8.zip] Error 2
make[3]: Leaving directory `/big/usr/src/openwrt/trunk/package/mac80211'
make[2]: *** [package/mac80211/compile] Error 2
make[2]: Leaving directory `/big/usr/src/openwrt/trunk'
make[1]: *** [/big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/stamp/.package_compile] Error 2
make[1]: Leaving directory `/big/usr/src/openwrt/trunk'
make: *** [world] Error 2

(Last edited by jesseg on 15 Sep 2009, 18:01)

Solve own problem:

https://dev.openwrt.org/ticket/5834

Follow the directions, download the file you need, and put it in the dl/ folder.

If you just download what looks like the link to the filename you'll get more HTML - so you need to first click the link, then download the file that is titled "Try downloading".

The url to the actual zip file is:

https://dev.openwrt.org/raw-attachment/ … are_V8.zip

By the way, I don't know if this is a bug that really matters, but putting an invalid zip file in the dl/ directory does not cause "make world V=99" to fail until it goes to copy a file which doesn't exist because the zip file didn't create it when unzipped.
(The first time I tried the above file, I saved the HTML (named *.zip) into the dl/ dir and then ran "make world V=99" and it continued until it was time to copy the contents of the zip file. It might be better if it had bailed out when it found one of the zip files was corrupted.)

Note that I actually had to manually unzip the above mentioned firmware zip file and copy its contents to build_dir/linux-x86_generic/compat-wireless-2009-08-20/ to get it to compile.
But that may be because I had first tried with an invalid zipfile and it somehow cached the invalid results and then neglected to install it again.


I'll see how that works out..

-Jesse

(Last edited by jesseg on 15 Sep 2009, 19:09)

Stuck again, and no idea how to proceed: Getting:
make[4]: /big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/host/bin/g++-uc: Command not found

Any clues?

Thanks,

-Jesse

mkdir -p /big/usr/src/openwrt/trunk/dl
/big/usr/src/openwrt/trunk/scripts/download.pl "/big/usr/src/openwrt/trunk/dl" "l7-protocols-2009-05-28.tar.gz" "91be154d12134dcdbc560cc7aa7fe4ce" @SF/l7-filter
--11:13:01--  http://downloads.sourceforge.net/l7-filter/l7-protocols-2009-05-28.tar.gz
           => `-'
Resolving downloads.sourceforge.net... 216.34.181.59
Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://softlayer.dl.sourceforge.net/project/l7-filter/Protocol%20definitions/2009-05-28/l7-protocols-2009-05-28.tar.gz [following]
--11:13:02--  http://softlayer.dl.sourceforge.net/project/l7-filter/Protocol%20definitions/2009-05-28/l7-protocols-2009-05-28.tar.gz
           => `-'
Resolving softlayer.dl.sourceforge.net... 74.86.229.28
Connecting to softlayer.dl.sourceforge.net|74.86.229.28|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 142,050 (139K) [application/x-gzip]

100%[=============================================================================================================>] 142,050       41.56K/s    ETA 00:00

11:13:16 (41.54 KB/s) - `-' saved [142050/142050]

gzip -dc /big/usr/src/openwrt/trunk/dl/l7-protocols-2009-05-28.tar.gz | /usr/local/bin/tar -C /big/usr/src/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/l7-protocols-2009-05-28/.. -xf -

Applying ./patches/100-testing_crosscompile.patch using plaintext:
patching file testing/Makefile

Applying ./patches/101-testing-timeit.patch using plaintext:
patching file testing/timeit.sh

Applying ./patches/102-testing-doallspeeds.patch using plaintext:
patching file testing/doallspeeds.sh
touch /big/usr/src/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/l7-protocols-2009-05-28/.prepared_c94635ed9b74e1b05d72467bd644bbff
touch /big/usr/src/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/l7-protocols-2009-05-28/.configured_
cd /big/usr/src/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/l7-protocols-2009-05-28/testing && make AR=i486-openwrt-linux-uclibc-ar AS="i486-openwrt-linux-uclibc-gcc -c -O2 -pipe -march=i486 -funit-at-a-time -fhonour-copts" LD=i486-openwrt-linux-uclibc-ld NM=i486-openwrt-linux-uclibc-nm CC="i486-openwrt-linux-uclibc-gcc" GCC="i486-openwrt-linux-uclibc-gcc" CXX="i486-openwrt-linux-uclibc-g++" RANLIB=i486-openwrt-linux-uclibc-ranlib STRIP=i486-openwrt-linux-uclibc-strip OBJCOPY=i486-openwrt-linux-uclibc-objcopy OBJDUMP=i486-openwrt-linux-uclibc-objdump SIZE=i486-openwrt-linux-uclibc-size CXX="/big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/host/bin/g++-uc"
make[4]: Entering directory `/big/usr/src/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/l7-protocols-2009-05-28/testing'
i486-openwrt-linux-uclibc-gcc -O2 -o randchars randchars.c
<built-in>:0: note: someone does not honour COPTS correctly, passed 0 times
i486-openwrt-linux-uclibc-gcc -O2 -o randprintable randprintable.c
<built-in>:0: note: someone does not honour COPTS correctly, passed 0 times
i486-openwrt-linux-uclibc-gcc -o test_speed-kernel test_speed-kernel.c
<built-in>:0: note: someone does not honour COPTS correctly, passed 0 times
/big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/host/bin/g++-uc -Wall -o test_speed-userspace test_speed-userspace.cpp l7-parse-patterns.cpp
make[4]: /big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/host/bin/g++-uc: Command not found
make[4]: *** [test_speed-userspace] Error 127
make[4]: Leaving directory `/big/usr/src/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/l7-protocols-2009-05-28/testing'
make[3]: *** [/big/usr/src/openwrt/trunk/build_dir/target-i386_uClibc-0.9.30.1/l7-protocols-2009-05-28/.built] Error 2
make[3]: Leaving directory `/big/usr/src/openwrt/trunk/feeds/packages/net/l7-protocols'
make[2]: *** [package/feeds/packages/l7-protocols/compile] Error 2
make[2]: Leaving directory `/big/usr/src/openwrt/trunk'
make[1]: *** [/big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/stamp/.package_compile] Error 2
make[1]: Leaving directory `/big/usr/src/openwrt/trunk'
make: *** [world] Error 2
jesseg@stats:/big/usr/src/openwrt/trunk$

This is probably off-topic, I know, but If you are running x86 hardware, why don't you just use Slackware?  Or, perhaps copy gcc from slackware (along with any required libraries).  If we can run Slackware on the Bifferboard (32MB of RAM), you can surely run it on your hardware.

Biff.

bifferos wrote:

This is probably off-topic, I know, but If you are running x86 hardware, why don't you just use Slackware?  Or, perhaps copy gcc from slackware (along with any required libraries).  If we can run Slackware on the Bifferboard (32MB of RAM), you can surely run it on your hardware.

Biff.

Biff,

Because OpenWrt is just so cool!

There are a couple other reasons too - I don't know yet how to set up the filesystem for slackware myself so that it doesn't constantly wear the flash card out. (But slackware definitely my favorite for my regular computers! I've been using it for around 10 years I suppose.)

(OpenWrt has a really cool filesystem configuration which, as far as I know, never writes to the flash memory unless there's an actual need to, thus preventing constant wear of my CF card. )

Also, it's just so easy to get OpenWrt to fit on a really cheap half gig CF card.. It takes a good bit more work to get Slackware to fit inside there with some room left over.

And, slackware has no package feed system - which isn't a huge problem - but for little boxes a package feed system is just so nice.

As to just copying gcc binaries from slackware to my OpenWrt box - I did try copying a simple Hello World C binary over and it wouldn't run for the want of some libraries and I guess I just figured that it'd be such a foxhunt trying to figure out what all libraries I needed. And GCC would probably need so many more then my HelloWorld program. But if you've done such a copy and it was quite feasible, then I would like to know about it - and I will try too!

Having said that, if anyone can point me to instructions on how to set up a filesystem scheme that is read/write for all practical purposes and yet never writes to the flash card except when a file actually needs to be saved, I would be most happy and grateful!

Thanks very much,

-Jesse

(Last edited by jesseg on 16 Sep 2009, 17:39)

Thanks for the info on the RT2870_Firmware_V8.zip file. I was trying to compile last night and this error popped up, went to Google and this was the first link that showed up. :-)

jesseg wrote:

Stuck again, and no idea how to proceed: Getting:
make[4]: /big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/host/bin/g++-uc: Command not found

Any clues?

I've got the same problem with the terminal output looking almost identical to yours, how did you resolve it?  I'm using Debian.

Thanks

Ed

edpgc wrote:
jesseg wrote:

Stuck again, and no idea how to proceed: Getting:
make[4]: /big/usr/src/openwrt/trunk/staging_dir/target-i386_uClibc-0.9.30.1/host/bin/g++-uc: Command not found

Any clues?

I've got the same problem with the terminal output looking almost identical to yours, how did you resolve it?  I'm using Debian.

Thanks

Ed

Sorry, Ed. I finally gave up.

Sincerely,

-Jesse

OK I ran

make package/symlinks

And that seemed to fix it, but I now have another issue...

(Last edited by edpgc on 21 Jan 2010, 21:29)

The discussion might have continued from here.