PDA

View Full Version : gcc 3.3.4 toolchain and 7.2 kernel build scripts



Jamie
12-03-2005, 01:11 PM
Here's some scripts to build a gcc-3.3.4 mips toolchain and to build the 7.2 tivo kernels from source using that toolchain. Works for me on fedora core 4. YMMV. Please read and understand the scripts and tweak appropriately for your environment.

The build_mips_x_compiler.sh script is based on the one from http://tivoutils.sourceforge.net.

The toolchain installs in /usr/local/mips-tivo72. That directory needs to be writable by the user running the build_mips_x_compiler.sh script.

The build_kernel.sh script builds both a Series2 and Gen04 kernel. These can be used directly on a PROM modded tivo, or as monte target kernels. Do not copy the kernels directly to your kernel partition unless you have a PROM mod. If you don't understand this, read up on the chain of trust (http://www.dealdatabase.com/forum/showthread.php?p=192565#post192565).

You might want to add ADH's mems= patch (http://www.dealdatabase.com/forum/showthread.php?p=198985#post198985) if the kernel may be used on a box with upgraded memory.

My kernel configs add EXT3 and turn off NETFILTER and BLK_DEV_INITRD. Adjust to taste. Without NETFILTER, iptables won't work, but it does improve network performance.

garyd9
12-18-2005, 01:52 AM
FYI - build_mips_x_compiler.sh script on sourceforge didn't work on my linux box, but this one does. It might have something to do with the base toolchain on my machine (gentoo/current on amd64 - gcc 3.4.4, binutils 2.16 with kernel 2.6.14)

I'm not using it for rebuilding the tivo kernel, but no problems with busybox or other random things I've tried to compile.

Jamie
01-29-2006, 10:47 PM
I replace the attachment in the first post with a new version that also works under the current version of cygwin. This allows you to build a tivo cross-compilation toolchain and custom kernels within cygwin.

cheer
01-30-2006, 01:35 PM
Thank you very much, Jamie...built without error, and I successfully compiled a "Hello world" program to make sure it's building the right target, etc.

Very cool! Now to cause real trouble...compiling my own kernel when I have no f'ing idea what I'm doing. :)

rbautch
02-06-2006, 05:36 PM
Thanks Jamie. I had been trying for weeks to build a mips cross-compiler on Cygwin using various incarnations of the tmesis build script, but never made it past the INSIGHT build (looks like cheer figured out the issue there). I gave your gcc-3.3.4 toolchain script a whirl, but it's failing the final gcc build. The problems seem to start with this:
../../gcc-3.3.4/gcc/unwind-pe.h:78: warning: implicit declaration of function `abort'
In file included from gthr-default.h:1,
from ../../gcc-3.3.4/gcc/gthr.h:98,
from ../../gcc-3.3.4/gcc/unwind-dw2.c:31:
../../gcc-3.3.4/gcc/gthr-posix.h:37:21: pthread.h: No such file or directory
../../gcc-3.3.4/gcc/gthr-posix.h:38:20: unistd.h: No such file or directory.

More output is attached. I'm using a full Cygwin install. Any nudge in the right direction is appreciated.

Jamie
02-06-2006, 07:01 PM
Thanks Jamie. I had been trying for weeks to build a mips cross-compiler on Cygwin using various incarnations of the tmesis build script, but never made it past the INSIGHT build (looks like cheer figured out the issue there). ...[/CODE].

More output is attached. I'm using a full Cygwin install. Any nudge in the right direction is appreciated.You didn't post enough of the log. Post the entire build log. I know it's large, but I'll bet it will be under the attachment size limit if you compress it.

Your build looks to be in the second stage of building gcc, after building glibc. My guess is that the glibc build failed, but the script keeps going anyway. I've seen that before. The last time, I tracked it down to an assumption in the glibc script that assumed a case sensitive file system (.oS and .os needed to be distinct file extensions). I fixed that problem, but apparently your build is still failing at the glibc stage for some other reason.

It did work for me under the very latest cygwin last week... You might update all your cygwin packages to the latest version and try again. Here's the information on the cygwin build I'm using:
% uname -srvmp
CYGWIN_NT-5.1 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 unknown

% gcc -v
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug : (reconfigured)
Thread model: posix
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)

rbautch
02-07-2006, 02:03 AM
Full log is attached. Here is my build information:


$ uname -srvmp
CYGWIN_NT-5.1 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 unknown

$ gcc -v
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir
=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc --enable-nls --without-included-gettext
--enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-de
bug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstd
cxx-debug : (reconfigured)
Thread model: posix
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)

Jamie
02-07-2006, 02:39 AM
Full log is attached. Here is my build information:
Here's the relevant error:

**** patching devenv ****
./chmod build_mips_x_compiler.sh: line 84: devenv-oS.patch: No such file or directoryThis is the code in the script that's failing:
echo "**** patching devenv ****"
patch -p0 < devenv-oS.patchNot sure where the "./chmod" is coming from -- that's not from the script. Are you sure the devenv-oS.patch file is in the same directory with the build_mips_x_compiler.sh script? Do you have the cygwin "patch-2.5.8-8" package installed? I see:
% patch --version
patch 2.5.8
...
How are you invoking the script?

rbautch
02-07-2006, 07:00 PM
Here's the relevant error:

**** patching devenv ****
./chmod build_mips_x_compiler.sh: line 84: devenv-oS.patch: No such file or directoryThis is the code in the script that's failing:Not sure where the "./chmod" is coming from -- that's not from the script. Are you sure the devenv-oS.patch file is in the same directory with the build_mips_x_compiler.sh script? Do you have the cygwin "patch-2.5.8-8" package installed? I see:
% patch --version
patch 2.5.8
...
How are you invoking the script?I got a few permission denied errors early on, so I added a few chmod commands to the script to fix it. I renamed the script with the chmod prefix to distinguish it from the original. I'm ashamed to say I did not have the patch in the same directory as the script. Put it there, and the script ran with out error. Thanks again for this useful script!

rbautch
02-17-2006, 02:30 AM
I was able to successfully compile the small "Hello world!" program. However, I'm having trouble compiling anything with a configure script. I set the following variables in my /etc/profile:

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/mips-tivo72/mips-TiVo-linux/bin
export LIBRARY_PATH=/usr/local/mips-tivo72/lib
export CC=mips-TiVo-linux-gcc
I run configure scripts with the following switches:

./configure --host=mips-TiVo-linux --build=mips-TiVo-linux --prefix=/usr/local/mips-tivo72
Here are the errors I get from the config.log:

configure:1791: checking for mips-TiVo-linux-gcc
configure:1817: result: mips-TiVo-linux-gcc
configure:2099: checking for C compiler version
configure:2102: mips-TiVo-linux-gcc --version </dev/null >&5
./configure: line 2103: mips-TiVo-linux-gcc: command not found
configure:2105: $? = 127
configure:2107: mips-TiVo-linux-gcc -v </dev/null >&5
./configure: line 2108: mips-TiVo-linux-gcc: command not found
configure:2110: $? = 127
configure:2112: mips-TiVo-linux-gcc -V </dev/null >&5
./configure: line 2113: mips-TiVo-linux-gcc: command not found
configure:2115: $? = 127
configure:2138: checking for C compiler default output file name
configure:2141: mips-TiVo-linux-gcc conftest.c >&5
./configure: line 2142: mips-TiVo-linux-gcc: command not found
configure:2144: $? = 127
configure: failed program was:
| /* confdefs.h. */

What am I missing?

Jamie
02-17-2006, 02:39 AM
What am I missing?Looks like mips-TiVo-linux-gcc isn't on your path. It should be in /usr/local/mips-tivo72. It seems that you put /usr/local/mips-tivo72/mips-TiVo-linux/bin on your path instead.

Check out the build_mips_x_compiler.sh script. It uses configure to build glibc and gcc itself, so you should be able to extract the right environment settings from it.

rbautch
02-19-2006, 02:47 AM
Thanks Jamie. I exported the same environmental variables as the build_mips_x_compiler.sh script. Got a little further, but now I'm stuck here:

configure:2216: mips-TiVo-linux-gcc -v </dev/null >&5
Reading specs from /usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/specs
Configured with: ../gcc-3.3.4/configure --target=mips-TiVo-linux --prefix=/usr/local/mips-tivo72 --enable-languages=c,c++
Thread model: posix
gcc version 3.3.4
configure:2219: $? = 0
configure:2221: mips-TiVo-linux-gcc -V </dev/null >&5
mips-TiVo-linux-gcc: `-V' option must have argument
configure:2224: $? = 1
configure:2247: checking for C compiler default output file name
configure:2250: mips-TiVo-linux-gcc conftest.c >&5
configure:2253: $? = 0
configure:2299: result: a.out
configure:2304: checking whether the C compiler works
configure:2310: ./a.out
./a.out: ./a.out: cannot execute binary file
configure:2313: $? = 126
configure:2322: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

Jamie
02-19-2006, 03:25 PM
Thanks Jamie. I exported the same environmental variables as the build_mips_x_compiler.sh script. Got a little further, but now I'm stuck here:It doesn't look like configure was invoked properly for building with a cross compiler. For example, it's trying to run executables created with the cross compiler on the build system.

It may be that you are invoking configure incorrectly for a canadian cross (http://www.airs.com/ian/configure/configure_6.html#SEC39), or it might be that the package you are configuring isn't setup to be cross-compiled.

Another reference is the Goat Book (http://sourceware.org/autobook/), particularly the chapter on cross compilation. (http://sourceware.org/autobook/autobook/autobook_258.html#SEC258)

rbautch
02-19-2006, 11:10 PM
Works! It was indeed how I was invoking the configure script. I used --build=mips-TiVo-linux, which was incorrect. Using --build=i686-pc-linux-gnu worked, as does does leaving out the --build argument altogether. Thanks for the references, they helped.

iMagic
07-23-2006, 01:33 PM
When I am trying to run the script, I get the following error:


...
creating po/Makefile.in
make[3]: Leaving directory `/var/toolchain/build-binutils/bfd/po'
make[3]: Entering directory `/var/toolchain/build-binutils/bfd/po'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/var/toolchain/build-binutils/bfd/po'
make[3]: Entering directory `/var/toolchain/build-binutils/bfd'
rm -f bfd-tmp.h
make[3]: *** No rule to make target `../../binutils-2.13/bfd/../include/ansidecl.h', needed by `archive.lo'. Stop.
make[3]: *** Waiting for unfinished jobs....
cp bfd-in3.h bfd-tmp.h
make[3]: *** Waiting for unfinished jobs....
/bin/sh ../../binutils-2.13/bfd/../move-if-change bfd-tmp.h bfd.h
make[3]: *** Waiting for unfinished jobs....
rm -f bfd-tmp.h
make[3]: *** Waiting for unfinished jobs....
touch stmp-bfd-h
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/var/toolchain/build-binutils/bfd'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/var/toolchain/build-binutils/bfd'
make[1]: *** [all-recursive-am] Error 2
make[1]: Leaving directory `/var/toolchain/build-binutils/bfd'
make: *** [all-bfd] Error 2
**** binutils compile failed


Am I missing some package or something?

I ran this under cygwin on WinXP Pro box. Any guidance is very much appreciated.

iMagic

Jamie
07-25-2006, 02:48 AM
I just did a cygwin update and rebuilt from scratch on an XP box, and it worked fine. I suspect you haven't installed all the cygwin packages you need. The easiest thing to do is to install everything (select "All: Install" in the cygwin setup program).

iMagic
07-25-2006, 09:26 PM
Jamie, Thanks man--I will try that... Or maybe I won't ;)

Basically, since then I reloaded my laptop with fresh copy of XP and I also loaded Fedora Core 5. :cool:

I am assuming your script will work for that too, right?

iMagic

Jamie
07-25-2006, 10:49 PM
Jamie, Thanks man--I will try that... Or maybe I won't ;)

Basically, since then I reloaded my laptop with fresh copy of XP and I also loaded Fedora Core 5. :cool:

I am assuming your script will work for that too, right?It should, as long as you have the necessary development packages installed (gcc, etc).

mnorton
08-02-2006, 04:04 PM
The build_mips_x_compiler.sh script is based on the one from http://tivoutils.sourceforge.net.



Jamie,

Can you talk about the patches for 7.2? Specifically, I'm interested in the changes to the arch/mips/tivo/Makefile that inserted monotime, gen-ioctl and crashallassert.

Thanks,

Mark

Jamie
08-02-2006, 04:19 PM
Can you talk about the patches for 7.2? Specifically, I'm interested in the changes to the arch/mips/tivo/Makefile that inserted monotime, gen-ioctl and crashallassert.It's been a while, but my recollection is that tivo switched to the newer linux 2.5 build system at some point, but this script still uses the old 2.4 build system Makefile, which was stale. The patch in question simply brings the 2.4 Makefile up to date. Compare Makefile to Makefile.in in that directory.

mnorton
08-08-2006, 02:40 PM
Right, looks like these are specific to the source in 7.1. I'm trying to build from the 6.1 source.

mnorton
08-14-2006, 04:16 PM
Here's some scripts to build a gcc-3.3.4 mips toolchain and to build the 7.2 tivo kernels from source using that toolchain. Works for me on fedora core 4. YMMV. Please read and understand the scripts and tweak appropriately for your environment.

The build_mips_x_compiler.sh script is based on the one from http://tivoutils.sourceforge.net.

The toolchain installs in /usr/local/mips-tivo72. That directory needs to be writable by the user running the build_mips_x_compiler.sh script.

The build_kernel.sh script builds both a Series2 and Gen04 kernel. These can be used directly on a PROM modded tivo, or as monte target kernels. Do not copy the kernels directly to your kernel partition unless you have a PROM mod. If you don't understand this, read up on the chain of trust (http://www.dealdatabase.com/forum/showthread.php?p=192565#post192565).

You might want to add ADH's mems= patch (http://www.dealdatabase.com/forum/showthread.php?p=198985#post198985) if the kernel may be used on a box with upgraded memory.

My kernel configs add EXT3 and turn off NETFILTER and BLK_DEV_INITRD. Adjust to taste. Without NETFILTER, iptables won't work, but it does improve network performance.

If anyone is interested, I just built the x-compiler from Jamie's script. Once that was done I had the 7.2 kernels built in about 30 minutes. These scripts work perfectly on Ubuntu 6.06 Desktop after loading the required development packages.

The Gen04 kernel from the 7.2 source works well on the DTivo R10.

FWIW I spent weeks working with various versions of Binutils and GCC in an attempt to build a viable cross compiler. I learned a lot from this experience but after deploying these scripts, there's not a lot to do but customize the kernel.

There is one cool script out there called CrossTool (http://kegel.com/crosstool/) from Dan Kegel that automates the build of the toolchain. If you want to learn more about cross-compiling, you could start with that and the book that Jamie mentioned here: http://sourceware.org/autobook/ (http://sourceware.org/autobook/)

-Mark

singe606
08-19-2006, 03:07 PM
Now, how difficult should it be build a native compiler for the tivo using the cross compiler? I'm having a heck of a time.

I've tried several different configurations, many of which actually produced a final message of "Links are now set up to build a native compiler for mips-TiVo-linux-gnu on a i686-pc-cygwin system." But it doesn't make.


make[1]: *** No rule to make target `auto-build.h', needed by `gengenrtl.o'. Stop.
make[1]: Leaving directory `/usr/tmp/build-gcc/gcc'
make: *** [all-gcc] Error 2

I know there is limited disk space and system resourses on the tivo, and that very well may make this completely pointless. But still... it should be possible to at least compile it, right?

Jamie
08-19-2006, 04:05 PM
Now, how difficult should it be build a native compiler for the tivo using the cross compiler? I'm having a heck of a time.
...I've never tried to build a native compiler for the tivo. I expect it would be really slow. If you really want a native compiler, the easiest route might be to install debian-mips on the tivo.

rbautch
08-31-2006, 12:53 PM
I've had the toolchain working well in Cygwin for awhile, so thought I'd try to build it on my Red Hat Enterprise system too. Duiring the binutills build, I got this error:
creating Makefile
make: Warning: File `Makefile' has modification time 3e+03 s in the future
make: *** No rule to make target `all'. Stop.
**** binutils compile failedThe full output is attached. Any ideas?

Jamie
08-31-2006, 01:17 PM
I've had the toolchain working well in Cygwin for awhile, so thought I'd try to build it on my Red Hat Enterprise system too. Duiring the binutills build, I got this error:
creating Makefile
make: Warning: File `Makefile' has modification time 3e+03 s in the future
make: *** No rule to make target `all'. Stop.
**** binutils compile failedThe full output is attached. Any ideas?Works fine on fedora core 3,4,5 and Ubuntu. Is /share an NFS mount? If so, it may be a clock syncronization problem between the client and server. Just a guess based on the file mod time warning. In any case, check the date/time setting on the server and make sure your clock is set right.

kblackwel
11-28-2006, 07:30 PM
Sorry in advance, but I'm new to this. I've installed the build_mips_x_compiler.sh and I now have a directory called mips-tivo. I have no idea or can find directions on how to build packages in this environment.

Thanks again in advance and sorry if I'm asking in the wrong place.

cheer
11-28-2006, 08:38 PM
In mips-tivo you should find a complete toolchain, including gcc, etc., that will create MIPS binaries.

kblackwel
11-28-2006, 10:47 PM
Yes,

I've had no problem building the chain, I'm trying to find a faq or info on usage.

Thanks

rbautch
11-29-2006, 01:05 AM
Yes,

I've had no problem building the chain, I'm trying to find a faq or info on usage.

ThanksThe easy part is over. Start here (http://compiling.avsnet.com.ar/v0.5/index.html), and keep reading. Jamie also listed some good references earlier in this thread. Are you trying to compile something in particular, or just poking around?

rbautch
01-21-2007, 10:18 PM
Jamie, I noticed you recently compiled procps using this toolchain. I tried for hours, but could not get procps to compile - log attached. Did you modify the makefile to get it to compile? My environmental variables are:
# Environmental variables for mips cross compiling
export HOMEDRIVE=c
export ARCH=mips
export TARGET=mips-TiVo-linux
export PREFIX=/usr/local/$ARCH-tivo72
export TIVOROOT=/tmp/root
export TARGET_CFLAGS="-O2 -mips2 -Wa,--trap -Wa,-xgot"
export CFLAGS="-O2 -mips2 -Wa,--trap -Wa,-xgot"
export PATH=${PATH}:${PREFIX}/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/bin
export PARALLEL=-j2

# Export tivo gcc cross compile path.
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin
export LIBRARY_PATH=/usr/local/mips-tivo72/lib
# export CC=mips-TiVo-linux-gcc
export CC=/usr/local/mips-tivo72/mips-TiVo-linux/bin/gcc.exe

Jamie
01-22-2007, 12:09 AM
/usr/local/mips-tivo72/mips-TiVo-linux/bin/gcc.exe -D_GNU_SOURCE -I proc -I/usr/include/ncurses -fno-common -ffast-math -W -Wall -Wshadow -Wcast-align -Wredundant-decls -Wbad-function-cast -Wcast-qual -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -O2 -s -c -o top.o top.c

In file included from top.c:28:

/usr/include/ncurses/curses.h:66:33: ncurses/ncurses_dll.h: No such file or directoryI don't remember what I did, off hand, but I don't think you want to be using the cross compile hosts /usr/include/ncurses. If ncurses isn't part of your toolchain installation, you might need to add it.

katiebear00
03-11-2007, 10:22 PM
Great build script! I successfully compiled the vmlinux-7.2-Gen04.px kernel for my prom-modded 540 (8.1 software), but I can't seem to get it to boot. My console output is attached. I also tried a fresh 3.1.5 kernel with the initrd replaced, but got the same result. I would appreciate a push in the right direction.

edit: I realize now that I somehow deleted my /etc/rc.d/StageA_PreKickstart/rc.Sequence_050.SetupCoreEnvironement.sh file while trying to enable serial bash. I also realize now that this post is horribly in the wrong place. Still, I'd appreciate it if a kind soul would temporarily post a rc.Sequence_050.SetupCoreEnvironement.sh file for me. :) I have a 6.2a Dtivo also, but kind of doubt they're the same.

Jamie
03-15-2007, 06:41 PM
Great build script! I successfully compiled the vmlinux-7.2-Gen04.px kernel for my prom-modded 540 (8.1 software), but I can't seem to get it to boot. My console output is attached. I also tried a fresh 3.1.5 kernel with the initrd replaced, but got the same result. I would appreciate a push in the right direction.

edit: I realize now that I somehow deleted my /etc/rc.d/StageA_PreKickstart/rc.Sequence_050.SetupCoreEnvironement.sh file while trying to enable serial bash. I also realize now that this post is horribly in the wrong place. Still, I'd appreciate it if a kind soul would temporarily post a rc.Sequence_050.SetupCoreEnvironement.sh file for me. :) I have a 6.2a Dtivo also, but kind of doubt they're the same.I don't feel comfortable posting a file that has a tivo copyright in it. PM me if you want to discuss further.

It's worth pointing out that the full contents of the root partition can be recovered from MFS on the PC side using mfs-utils. Run mfs_dumpobj -r /SwModule and look for the SwModule named GZcore. The "ModuleFile" attribute there is the FSID of a tyfile holding a compressed cpio archive with the stock root partition contents. Something like this:

mfs_uberexport <FSID> | gzip -d | cpio -idwhere <FSID> is the FSID of the ModuleFile for the GZcore SwModule. This will extract everything. There may be a few warnings for files that are symbolic links to files from one of the other SwModules (e.g. GZhpk).

djl
11-17-2007, 11:25 AM
Tivo seems to have changed the location of some of their files on the web site: TiVo-devenv.tar.gz and TiVo-linux-2.4.tar.gz are now at http://dynamic.tivo.com. I've attached an updated copy of build_mips_x_compiler.sh in case anyone has trouble with the one in the first thread. This ran through for me under cygwin with no errors.

jt1134
12-21-2007, 10:04 PM
I'm a bit OCD so I'd like my boxes to be running a kernel version matching their current software. I slightly modified the patches jamie posted here to fit 6.3 source. The only addition is a patch to kernel/ksyms.c to export SYS_CALL_TABLE. The sys_call address is probably different on different machines, so you may not need it since it may not work, just simply remove it from the patch. I compiled it under cygwin FWIW, in case the address is the same if building under cygwin. Maybe someone more knowledgeable than I could shed some light on that. I setup my own .config file, the one for 7.2 appears to work fine, but I haven't compared them to find the differences.

katiebear00
05-03-2008, 11:34 PM
I ‘m having trouble setting up the mips toolchain on my new Ubuntu installation. Nothing in the output really jumps out at me, so I attached a full log. A few errors that came up include:


../../gcc-3.3.4/gcc/gthr-posix.h: At top level:
../../gcc-3.3.4/gcc/gthr-posix.h:40: error: parse error before "__gthread_key_t"
../../gcc-3.3.4/gcc/gthr-posix.h:40: warning: type defaults to `int' in declaration of `__gthread_key_t'
../../gcc-3.3.4/gcc/gthr-posix.h:40: warning: data definition has no type or storage class



../../gcc-3.3.4/gcc/gthr-posix.h:450: error: parse error before '*' token
../../gcc-3.3.4/gcc/gthr-posix.h:450: error: parse error before ')' token
../../gcc-3.3.4/gcc/gthr-posix.h:459: error: parse error before '*' token
../../gcc-3.3.4/gcc/gthr-posix.h:459: error: parse error before ')' token
../../gcc-3.3.4/gcc/gthr-posix.h:465: error: parse error before "key"
../../gcc-3.3.4/gcc/gthr-posix.h:466: warning: function declaration isn't a prototype


../../gcc-3.3.4/gcc/unwind-dw2.c:1225: error: syntax error before "once_regsizes"
../../gcc-3.3.4/gcc/unwind-dw2.c:1226: warning: implicit declaration of function `__gthread_once'
../../gcc-3.3.4/gcc/unwind-dw2.c:1226: error: `once_regsizes' undeclared (first use in this function)
../../gcc-3.3.4/gcc/unwind-dw2.c:1240: warning: implicit declaration of function `memcpy'
make[2]: *** [libgcc/./unwind-dw2.o] Error 1
make[2]: Leaving directory `/usr/local/share/katie_share/toolchain/build-gcc2/gcc'
make[1]: *** [libgcc.a] Error 2
make[1]: Leaving directory `/usr/local/share/katie_share/toolchain/build-gcc2/gcc'
make: *** [all-gcc] Error 2
**** gcc (final stage) build failed

Jamie
05-04-2008, 11:19 AM
Generally, you want to look for the first error. Later errors are likely to be cascading errors from the original problem. The first error I see in your log is this one:
mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/include -isystem /usr/local/mips-tivo72/mips-TiVo-linux/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DHAVE_INITFINI -o /usr/local/share/katie_share/toolchain/build-glibc/csu/version.o
In file included from version.c:32:In file included from version.c:32:
/usr/local/share/katie_share/toolchain/build-glibc/csu/version-info.h:1:1: missing terminating " character
/usr/local/share/katie_share/toolchain/build-glibc/csu/version-info.h:2:1: missing terminating " character
/usr/local/share/katie_share/toolchain/build-glibc/csu/version-info.h:3:1: missing terminating " character
/usr/local/share/katie_share/toolchain/build-glibc/csu/version-info.h:4:1: missing terminating " character
make[2]: *** [/usr/local/share/katie_share/toolchain/build-glibc/csu/version.o] Error 1
make[2]: Leaving directory `/usr/local/share/katie_share/toolchain/devenv/glibc/glibc-2.2.3/csu'
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory `/usr/local/share/katie_share/toolchain/devenv/glibc/glibc-2.2.3'
make: *** [install] Error 2

This leads one to suspect that build-glibc/csu/version-info.h may have a problem. Here's what I see in mine:
"Compiled on a Linux 2.4.4-TiVo-3.0 system on 2006-10-30.\n"
"Available extensions:\n"
" GNU libio by Per Bothner\n"
" crypt add-on version 2.1 by Michael Glad and others\n"
" linuxthreads-0.9 by Xavier Leroy\n"
" BIND-8.2.3-T5B\n"
" libthread_db work sponsored by Alpha Processor Inc\n"
" NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk\n"if you look upstream in the log, you'll see that this file is generated via shell code, along with utilities such as sed. Perhaps something changed in the shell or in sed that broke this?

katiebear00
05-05-2008, 07:32 PM
Thanks, I'm still plugging away at this. On an unrelated note, the downloads from the tivo website are broken. These links:


http://www.tivo.com/linux/72/TiVo-devenv.tar.gz

http://www.tivo.com/linux/72/TiVo-linux-2.4.tar.gz

have changed to:


http://www.tivo.com/linux/download/72/TiVo-devenv.tar.gz

http://www.tivo.com/linux/download/72/TiVo-linux-2.4.tar.gz

djl
05-05-2008, 09:38 PM
I actually fixed those in post #35.



Thanks, I'm still plugging away at this. On an unrelated note, the downloads from the tivo website are broken. These links:



have changed to:

d0ugmac1
01-03-2009, 10:07 AM
Updated the src links...again. Added some patches to insight to cope with the newer GCC compiler versions. You must make sure you have development packages installed for gettext, sunrpc and ncurses. For ncurses, I had to uninstall the pre-baked cygwin versions and compile ncurses-5.7 from scratch to get the curses.h/ncurses.h headers (needed for the gdb tui).

Works for me from soup to nuts on latest cygwin. Enjoy.

djl
03-23-2009, 12:25 PM
Trying to run this latest on cygwin, it bombs out on me here:


make[1]: Entering directory `/var/build-gdb/gdb'
/usr/bin/gcc-3 -c -g -O2 -I. -I../../gdb-6.2/gdb -I../../gdb-6.2/gdb/config
-DLOCALEDIR="\"/usr/local/mips-tivo/share/locale\"" -DHAVE_CONFIG_H -I../../gdb-
6.2/gdb/../include/opcode -I../../gdb-6.2/gdb/../readline/.. -I../bfd -I../../gd
b-6.2/gdb/../bfd -I../../gdb-6.2/gdb/../include -I../intl -I../../gdb-6.2/gdb/..
/intl -DMI_OUT=1 -DTUI=1 -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wforma
t -Wparentheses -Wpointer-arith -Wuninitialized -Wformat-nonliteral -Wunused-lab
el -Wunused-function ../../gdb-6.2/gdb/tui/tui-command.c
In file included from ../../gdb-6.2/gdb/tui/tui-command.c:28:
../../gdb-6.2/gdb/tui/tui-data.h:40: error: parse error before "WINDOW"
../../gdb-6.2/gdb/tui/tui-data.h:40: warning: no semicolon at end of struct or u
nion
../../gdb-6.2/gdb/tui/tui-data.h:52: error: parse error before '}' token
../../gdb-6.2/gdb/tui/tui-data.h:224: error: field `data_window' has incomplete
type
../../gdb-6.2/gdb/tui/tui-data.h:278: error: field `generic' has incomplete type

In file included from ../../gdb-6.2/gdb/tui/tui-command.c:29:
../../gdb-6.2/gdb/tui/tui-win.h:42: error: parse error before "tui_border_ulcorn
er"
../../gdb-6.2/gdb/tui/tui-win.h:42: warning: type defaults to `int' in declarati
on of `tui_border_ulcorner'
../../gdb-6.2/gdb/tui/tui-win.h:42: warning: data definition has no type or stor
age class
../../gdb-6.2/gdb/tui/tui-win.h:43: error: parse error before "tui_border_urcorn
er"
../../gdb-6.2/gdb/tui/tui-win.h:43: warning: type defaults to `int' in declarati
on of `tui_border_urcorner'
../../gdb-6.2/gdb/tui/tui-win.h:43: warning: data definition has no type or stor
age class
../../gdb-6.2/gdb/tui/tui-win.h:44: error: parse error before "tui_border_lrcorn
er"
../../gdb-6.2/gdb/tui/tui-win.h:44: warning: type defaults to `int' in declarati
on of `tui_border_lrcorner'
../../gdb-6.2/gdb/tui/tui-win.h:44: warning: data definition has no type or stor
age class
../../gdb-6.2/gdb/tui/tui-win.h:45: error: parse error before "tui_border_llcorn
er"
../../gdb-6.2/gdb/tui/tui-win.h:45: warning: type defaults to `int' in declarati
on of `tui_border_llcorner'
../../gdb-6.2/gdb/tui/tui-win.h:45: warning: data definition has no type or stor
age class
../../gdb-6.2/gdb/tui/tui-win.h:46: error: parse error before "tui_border_vline"

../../gdb-6.2/gdb/tui/tui-win.h:46: warning: type defaults to `int' in declarati
on of `tui_border_vline'
../../gdb-6.2/gdb/tui/tui-win.h:46: warning: data definition has no type or stor
age class
../../gdb-6.2/gdb/tui/tui-win.h:47: error: parse error before "tui_border_hline"

../../gdb-6.2/gdb/tui/tui-win.h:47: warning: type defaults to `int' in declarati
on of `tui_border_hline'
../../gdb-6.2/gdb/tui/tui-win.h:47: warning: data definition has no type or stor
age class
../../gdb-6.2/gdb/tui/tui-command.c: In function `tui_dispatch_ctrl_char':
../../gdb-6.2/gdb/tui/tui-command.c:51: error: `WINDOW' undeclared (first use in
this function)
../../gdb-6.2/gdb/tui/tui-command.c:51: error: (Each undeclared identifier is re
ported only once
../../gdb-6.2/gdb/tui/tui-command.c:51: error: for each function it appears in.)

../../gdb-6.2/gdb/tui/tui-command.c:51: error: `w' undeclared (first use in this
function)
../../gdb-6.2/gdb/tui/tui-command.c:81: warning: implicit declaration of functio
n `wgetch'
../../gdb-6.2/gdb/tui/tui-command.c:82: error: `ERR' undeclared (first use in th
is function)
../../gdb-6.2/gdb/tui/tui-command.c:89: error: `KEY_PPAGE' undeclared (first use
in this function)
../../gdb-6.2/gdb/tui/tui-command.c:91: error: `KEY_NPAGE' undeclared (first use
in this function)
../../gdb-6.2/gdb/tui/tui-command.c:108: error: `KEY_DOWN' undeclared (first use
in this function)
../../gdb-6.2/gdb/tui/tui-command.c:109: error: `KEY_SF' undeclared (first use i
n this function)
../../gdb-6.2/gdb/tui/tui-command.c:112: error: `KEY_UP' undeclared (first use i
n this function)
../../gdb-6.2/gdb/tui/tui-command.c:113: error: `KEY_SR' undeclared (first use i
n this function)
../../gdb-6.2/gdb/tui/tui-command.c:116: error: `KEY_RIGHT' undeclared (first us
e in this function)
../../gdb-6.2/gdb/tui/tui-command.c:119: error: `KEY_LEFT' undeclared (first use
in this function)
make[1]: *** [tui-command.o] Error 1
make[1]: Leaving directory `/var/build-gdb/gdb'
make: *** [all-gdb] Error 2
**** gdb build failed
Cygwin>/var>

Any ideas?


Updated the src links...again. Added some patches to insight to cope with the newer GCC compiler versions. You must make sure you have development packages installed for gettext, sunrpc and ncurses. For ncurses, I had to uninstall the pre-baked cygwin versions and compile ncurses-5.7 from scratch to get the curses.h/ncurses.h headers (needed for the gdb tui).

Works for me from soup to nuts on latest cygwin. Enjoy.

djl
04-03-2009, 09:21 AM
Besides CC, what needs to be set to run build_mips_x_compiler.sh to completion? I keep running into errors with header files not found. I set HEADER=/usr/include, which helped in some places but I'm now failing when it gets to signal.h.

export CC=/bin/gcc-3
export ARCH=mips
export TARGET=mips-TiVo-linux
export PREFIX=/usr/local/$ARCH-tivo
export TIVOROOT=/tmp/root
export TARGET_CFLAGS="-O2 -mips2 -Wa,--trap -Wa,-xgot"
export PATH=${PATH}:${PREFIX}/bin
export PARALLEL=-j2
export HEADERS=/usr/include
export libs=/lib

woracan
08-25-2009, 01:35 PM
Here's some scripts to build a gcc-3.3.4 mips toolchain ...

Where is your script to build a gcc-3.3.4 mips toolchain? I only see the attachment to build the kernel.

ScanMan
08-25-2009, 02:03 PM
Where is your script to build a gcc-3.3.4 mips toolchain? I only see the attachment to build the kernel.
It's in the same bzip file it's called 'build_mips_x_compiler.sh'

woracan
08-26-2009, 10:28 AM
if it had been a snake...

Found it, thanks. TiVo has changed their download URLs, adding the word "download" to the URL so http://www.tivo.com/linux/72/TiVo-devenv.tar.gz in the script needs to be changed to http://www.tivo.com/linux/download/72/TiVo-devenv.tar.gz

I made the necessary edits to my copy of the script and created the toolchain with no problem.

d0ugmac1
09-03-2009, 11:29 PM
Updated the src links...again. Added some patches to insight to cope with the newer GCC compiler versions. You must make sure you have development packages installed for gettext, sunrpc and ncurses. For ncurses, I had to uninstall the pre-baked cygwin versions and compile ncurses-5.7 from scratch to get the curses.h/ncurses.h headers (needed for the gdb tui).

Works for me from soup to nuts on latest cygwin. Enjoy.

Just tested this again today on current cygwin installed in a virgin VM (I set cygwin setup.exe to INSTALL everything in the Development, Editors, Libs. Loaded and chmod 755 my script which then ran without error (no more issues with gettext, sunrpc, ncurses). Less than an hour later I had a functional toolchain in /usr/local/mips-tivo.

See post #41 (http://www.dealdatabase.com/forum/showpost.php?p=300664&postcount=41) for the script.

D.

AlphaWolf
11-27-2010, 12:05 AM
I'm unable to get gcc to compile in ubuntu 10.04LTS.

Anybody know how to fix this without mucking with the header files?


gcc -g -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -DHAVE_CONFIG_H -I. -I. -I../../gcc-3.3.4/gcc -I../../gcc-3.3.4/gcc/. -I../../gcc-3.3.4/gcc/config -I../../gcc-3.3.4/gcc/../include \
-DTARGET_MACHINE=\"mips-TiVo-linux\" \
-c ../../gcc-3.3.4/gcc/collect2.c -o collect2.o
../../gcc-3.3.4/gcc/collect2.c: In function ‘notice’:
../../gcc-3.3.4/gcc/collect2.c:362: warning: traditional C rejects ISO C style function definitions
../../gcc-3.3.4/gcc/collect2.c: In function ‘fatal_perror’:
../../gcc-3.3.4/gcc/collect2.c:374: warning: traditional C rejects ISO C style function definitions
../../gcc-3.3.4/gcc/collect2.c: In function ‘fatal’:
../../gcc-3.3.4/gcc/collect2.c:392: warning: traditional C rejects ISO C style function definitions
../../gcc-3.3.4/gcc/collect2.c: In function ‘error’:
../../gcc-3.3.4/gcc/collect2.c:408: warning: traditional C rejects ISO C style function definitions
../../gcc-3.3.4/gcc/collect2.c: In function ‘dump_file’:
../../gcc-3.3.4/gcc/collect2.c:515: warning: comparison of unsigned expression < 0 is always false
In file included from /usr/include/fcntl.h:205,
from ../../gcc-3.3.4/gcc/system.h:208,
from ../../gcc-3.3.4/gcc/collect2.c:30:
In function ‘open’,
inlined from ‘collect_execute’ at ../../gcc-3.3.4/gcc/collect2.c:1575:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[1]: *** [collect2.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/jjd/tivodev/toolchain/build-gcc/gcc'
make: *** [all-gcc] Error 2
**** gcc (stage 1) compile failed

Just starting to learn C and wanting to play around.

AlphaWolf
11-28-2010, 11:51 PM
nvm I sorted it out

Thinkdiff
01-08-2011, 02:56 PM
Trying to get a cross compiler working on Linux PPC and I keep running into this problem:


[root lzo-2.04]# $PREFIX/bin/$TARGET-gcc -v -o hello1 hello.c
Reading specs from /usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/specs
Configured with: ../gcc-3.3.4/configure --target=mips-TiVo-linux --prefix=/usr/local/mips-tivo72 --enable-languages=c,c++
Thread model: posix
gcc version 3.3.4
/usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/cc1 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=4 hello.c -quiet -dumpbase hello.c -auxbase hello -version -o /tmp/cch4Yen1.s
GNU C version 3.3.4 (mips-TiVo-linux)
compiled by GNU C version 4.1.2 20071124 (Red Hat 4.1.2-42).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/mips-tivo72/mips-TiVo-linux/sys-include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/include
/usr/local/mips-tivo72/mips-TiVo-linux/include
End of search list.
/usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/../../../../mips-TiVo-linux/bin/as -EB -g0 -32 -v -KPIC -o /tmp/ccoYZBeU.o /tmp/cch4Yen1.s
GNU assembler version 2.13 (mips-TiVo-linux) using BFD version 2.13
/usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/collect2 --eh-frame-hdr -EB -dynamic-linker /lib/ld.so.1 -o hello1 /usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/../../../../mips-TiVo-linux/lib/crt1.o /usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/../../../../mips-TiVo-linux/lib/crti.o /usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/crtbegin.o -L/usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4 -L/usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/../../../../mips-TiVo-linux/lib /tmp/ccoYZBeU.o -lgcc -lgcc_eh -rpath-link /lib:/usr/lib -lc -lgcc -lgcc_eh /usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/crtend.o /usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/../../../../mips-TiVo-linux/lib/crtn.o
/usr/local/mips-tivo72/lib/libc.so.6: undefined reference to `_IO_funlockfile'
/usr/local/mips-tivo72/lib/libc.so.6: undefined reference to `_IO_flockfile'
/usr/local/mips-tivo72/lib/libc.so.6: undefined reference to `funlockfile'
/usr/local/mips-tivo72/lib/libc.so.6: undefined reference to `flockfile'
collect2: ld returned 1 exit status


I've recompiled glibc and still get the exact same results. Any ideas?

Edit: I'm not sure why that install didn't work, but I just tried again in a new VM running CentOS 5.5. Everything is working perfectly. I'll save the Linux PPC install problems for another weekend.

woracan
06-09-2012, 10:54 PM
I'm trying to build a toolchain with the latest version of cygwin and it fails:



In file included from ../../gcc-3.3.2/gcc/read-rtl.c:24:0:
../../gcc-3.3.2/gcc/rtl.h:132:3: warning: type of bit-field ‘code’ is a GCC extension
../../gcc-3.3.2/gcc/rtl.h:135:3: warning: type of bit-field ‘mode’ is a GCC extension
../../gcc-3.3.2/gcc/read-rtl.c: In function ‘fatal_with_file_and_line’:
../../gcc-3.3.2/gcc/read-rtl.c:52:1: warning: traditional C rejects ISO C style function definitions
../../gcc-3.3.2/gcc/read-rtl.c: In function ‘read_rtx’:
../../gcc-3.3.2/gcc/read-rtl.c:653:8: error: lvalue required as increment operand
Makefile:2316: recipe for target `read-rtl.o' failed
make[1]: *** [read-rtl.o] Error 1

bsdimp
11-22-2013, 12:50 AM
I know this may be a bit stale... But replying for posterity...


I'm trying to build a toolchain with the latest version of cygwin and it fails:



../../gcc-3.3.2/gcc/read-rtl.c:653:8: error: lvalue required as increment operand


This is becuase obstack.h has a construct (*(void **)foo)++ = bar; This is not valid 'C' and newer versions of gcc barf on it.

I've fixed by hacking obstack.h:

[code]
- *((void **)__o->next_free)++ = ((void *)datum); \
+ *((void **)__o->next_free) = ((void *)datum); \
+ __o->next_free += sizeof(void *); \
[\code]

Also, gcc 3 vintage g++ can't be built with modern compilers. I haven't sorted that out yet.

djl
11-23-2013, 06:07 PM
bsdimp - on what OS are you setting this up? I recently got a new iMac, and am torn between building the toolchain on Mavericks (which I'm sure will be a huge headache) or installing CentOS in a virtual machine and putting it there.