Go to Post You wrote a PID control loop for your coach? Whoa. - meatmanek [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 04-11-2012, 00:29
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Alternate GCC Toolchain

Hi all,

Just an update as everyone starts thinking about the 2013 FRC season, the patches that I and several others wrote have now been officially integrated into the GCC mainline.

Now, having undergone the sad ordeal of graduating from high school and FRC last year, I am faced with not being able to test anything beyond compile time. So, I leave it open to everyone else to test out

Between college and working with the GCC devs I haven't had time to update the whole buildsystem yet, but EXPECT TO SEE BINARY PACKAGES SOON

For those of you who can't wait, here's how you can build GCC for vxworks on your very own:

NOTE: Lines starting with # must be run as root, and you need to have gcc, flex, bison, libmpfr-dev, libgmp-dev, libmpc-dev (or whatever the equivalents are for your distro) installed

NOTE2: If someone wants to mirror the snapshot of GCC that would be awesome as github has to dynamically regenerate it every time someone downloads it (though this is still faster than checking out on cvs...). I'd do it but my school doesn't like people tunneling out of their network...

Code:
# mkdir -p /usr/powerpc-wrs-vxworks/wind_base
# mkdir -p /usr/powerpc-wrs-vxworks/include
# echo 'export WIND_BASE=/usr/powerpc-wrs-vxworks/wind_base' >> /etc/profile
$ source /etc/profile
$ wget https://github.com/mirrors/gcc/archive/master.zip
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2
$ wget ftp://ftp.ni.com/pub/devzone/tut/updated_vxworks63gccdist.zip
$ unzip gcc-master.zip
$ tar -jxf binutils-2.22.tar.bz2
$ unzip updated_vxworks63gccdist.zip
# mkdir -p $WIND_BASE/target
# cp -r gccdist/WindRiver/vxworks-6.3/host/. $WIND_BASE/host
# ln -s /usr/powerpc-wrs-vxworks/sys-include $WIND_BASE/target/h
# cp -r gccdist/WindRiver/vxworks-6.3/target/h/. /usr/powerpc-wrs-vxworks/sys-include
# ln -s sys-include/wrn/coreip /usr/powerpc-wrs-vxworks/include
$ mkdir binutils-build
$ cd binutils-build
$ ../binutils-2.22/configure --prefix=/usr --target=powerpc-wrs-vxworks --disable-nls
$ make -j4
# make install
$ cd ..
$ mkdir gcc-build
$ cd gcc-build
$ ../gcc-master/configure --prefix=/usr --target=powerpc-wrs-vxworks --with-gnu-as --with-gnu-ld --with-headers --disable-shared --disable-libssp --disable-multilib --with-float=hard --enable-languages=c,c++ --enable-threads=vxworks --without-gconv --disable-libgomp --disable-nls --disable-libmudflap --with-cpu-PPC603 --disable-symvers
$ make -j4
# make install
AND YOU'RE DONE!

That was a mouthful. This is why I will work to get those binaries out to you all soon . Let me know if I made a typo. I haven't tested this as rigorously as I usually do for my builds, and I haven't rebuilt binutils in a while, but I wanted to get this out to you all early so that I could see if there's any runtime issues people run into.

HOW TO BUILD:

You can manually hack a UCPP makefile, OR, you can use cmake. Links:

https://github.com/rbmj/cmake_vxworks

and, to build a better WPILib (I mean, they had to make the compiler's optimizations better since 3.x ) and ensure there are no symbol/ABI conflicts, go here:

https://github.com/rbmj/wpilib

I submitted the necessary patches to firstforge at the end of last season, but they have a pretty closed development model... Also, I'm not sure how much they are into supporting unofficial toolchains, though technically all of the changes are necessary for standards compliance as old GCC accepts stuff it shouldn't... but I digress.

Lobby FIRST/WRS/NI to use a compiler that *isn't* ten years old!

[BUGS/TODO]:

Also, a very broken build of fortran can be made by using --enable-languages=c,c++,fortran. However, this misconfigures itself horribly, so you'll need to go in and edit the config.h file by hand *bleh*. Go support is also in the works. However, at least for me, these are both lower priorities unless people here say they're really interested in these, as they aren't currently used by FRC. Also know, that the best way to get this done faster if you care is to do it yourself Just share with everyone else too!

The entire C++11 standard library (as it is/will be known by GCC 4.8 - freeze should be this week, so no major changes) *should* work. There might be one minor bug in thread-specific data corner cases, but other than that, please test all of the new features you can think of! And then use them so we don't have spaghetti code! TEST TEST TEST TEST PLEASE!

Last edited by rbmj : 04-11-2012 at 23:23.
  #2   Spotlight this post!  
Unread 04-11-2012, 10:29
ebarker's Avatar
ebarker ebarker is offline
Registered User
AKA: Ed Barker
FRC #1311 (Kell Robotics)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Kennesaw GA
Posts: 1,437
ebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond repute
Re: Alternate GCC Toolchain

Quote:
Originally Posted by rbmj View Post
Lobby FIRST/WRS/NI to use a compiler that *isn't* ten years old!
Why ? Having a C compiler that is ten years old should be solid, reliable, and mature.

Just like all those old mentors that volunteer for FIRST !!
__________________
Ed Barker
  #3   Spotlight this post!  
Unread 04-11-2012, 11:28
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Alternate GCC Toolchain

Quote:
Originally Posted by ebarker View Post
Why ? Having a C compiler that is ten years old should be solid, reliable, and mature.
Why doesn't everyone just use 6 wheel tank drive, which is arguably more solid and reliable?
  #4   Spotlight this post!  
Unread 04-11-2012, 11:52
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,080
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Re: Alternate GCC Toolchain

Quote:
Originally Posted by agartner01 View Post
Why doesn't everyone just use 6 wheel tank drive, which is arguably more solid and reliable?
Same reason not everyone uses C for every task.
__________________




.
  #5   Spotlight this post!  
Unread 04-11-2012, 13:25
CodeYeti's Avatar
CodeYeti CodeYeti is offline
FRC Addict
AKA: Matt Coffin
FRC #0662 (Rocky Mountain Robotics)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Colorado
Posts: 81
CodeYeti is an unknown quantity at this point
Re: Alternate GCC Toolchain

Quote:
Originally Posted by ebarker View Post
Why ? Having a C compiler that is ten years old should be solid, reliable, and mature.

Just like all those old mentors that volunteer for FIRST !!
  1. Support for other languages
  2. Native builds on different host OSs
  #6   Spotlight this post!  
Unread 04-11-2012, 15:41
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Alternate GCC Toolchain

Yeah, I can't even get it to compile. It looks like it fails with:
Code:
/bin/bash: MULTIDIR: command not found
which I googled and found nothing conclusive. Is there a way to fix this?
Would it be possible to just zip the /usr/powerpc-wrs-vxworks folder so I wouldn't have to worry about it?
Attached Files
File Type: txt make.txt (7.6 KB, 25 views)

Last edited by agartner01 : 04-11-2012 at 15:48.
  #7   Spotlight this post!  
Unread 04-11-2012, 22:26
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Alternate GCC Toolchain

Quote:
Originally Posted by ebarker View Post
Why ? Having a C compiler that is ten years old should be solid, reliable, and mature.

Just like all those old mentors that volunteer for FIRST !!
Why do we even bother innovating anyway?

In all seriousness, because it runs natively on linux, supports c++11 and has much better compliance with c++03, has better optimizations, runs faster (AFAIK), and because IT'S SHINY AND NEW!

Also, WRT to the MULTIDIR thing, that's not a fatal error. Double-check that /usr/powerpc-wrs-vxworks/include is a symlink to sys-include/wrn/coreip. Make sure that /usr/powerpc-wrs-vxworks/sys-include contains files that make sense (vxWorks.h, stdio.h, etc.)

I was typing those commands into a post box, not into a terminal, so it might have a typo...
  #8   Spotlight this post!  
Unread 04-11-2012, 22:44
ebarker's Avatar
ebarker ebarker is offline
Registered User
AKA: Ed Barker
FRC #1311 (Kell Robotics)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Kennesaw GA
Posts: 1,437
ebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond repute
Re: Alternate GCC Toolchain

Hey, I'm just asking. I like shiny and new too. I'm all for innovation.

What I'm curious in learning is why so much embedded C still uses the 3.4.4 version, not the 4.xx series of gcc. That said, what are the risks of using 4.x versus 3.4.4 in an embedded system.

I know there are substantial language compliance differences and I'm curious as to how that drills down the particular FRC application we deal with.

I'm all for innovation. I just want to know what the innovation is. That's all.

And thanks, I'm glad to see the project...
__________________
Ed Barker
  #9   Spotlight this post!  
Unread 04-11-2012, 23:07
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Alternate GCC Toolchain

Checked it again. Still not able to compile. Heres what I get:
Code:
/bin/bash: MULTIDIR: command not found
/bin/bash: MULTIDIR: command not found
/home/alex/gcc-build/./gcc/as: 87: exec: /usr/powerpc-wrs-vxworks/bin/as: not found
make[2]: *** [tramp_s.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/alex/gcc-build/./gcc/as: 87: exec: /usr/powerpc-wrs-vxworks/bin/as: not found
make[2]: *** [enable-execute-stack.o] Error 1
/home/alex/gcc-build/./gcc/as: 87: exec: /usr/powerpc-wrs-vxworks/bin/as: not found
make[2]: *** [eabi_s.o] Error 1
/home/alex/gcc-build/./gcc/as: 87: exec: /usr/powerpc-wrs-vxworks/bin/as: not found
make[2]: *** [unwind-dw2.o] Error 1
make[2]: Leaving directory `/home/alex/gcc-build/powerpc-wrs-vxworks/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/alex/gcc-build'
make: *** [all] Error 2
Which makes sense because /usr/powerpc-wrs-vxworks/bin/as dosen't exist... Not sure if it's supposed to?
Also included an overview of the powerpc-wrs-vxworks folder.
Attached Files
File Type: txt powerpc-wrs-vxworks.txt (38.5 KB, 18 views)

Last edited by agartner01 : 04-11-2012 at 23:10.
  #10   Spotlight this post!  
Unread 04-11-2012, 23:14
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Alternate GCC Toolchain

I can't answer for the risks associated with using a new GCC. However, I can say that some of the standard library and language compliance benefits are very interesting and useful, particularly C++11 features. Additionally, should one discover any issues, the developers are much more likely to help you with a modern, developed version.

It is to both VxWorks' and GCC's benefit to keep compatibility current and not let it bitrot.

Again, a major motivating factor is to be able to get a native linux version. IN MY EXPERIENCE, the whole development process is smoother on linux, and not using the giant hulking behemoth that eclipse (and thus workbench) is makes development go much more quickly. CMake also does a better job of dependency tracking than the Makefiles that are generated by workbench or UCPP (no offense of course to the people who have been working on UCPP, which is an awesome project).
  #11   Spotlight this post!  
Unread 04-11-2012, 23:25
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Alternate GCC Toolchain

Quote:
Originally Posted by agartner01 View Post
Checked it again. Still not able to compile. Heres what I get:
Code:
/bin/bash: MULTIDIR: command not found
/bin/bash: MULTIDIR: command not found
/home/alex/gcc-build/./gcc/as: 87: exec: /usr/powerpc-wrs-vxworks/bin/as: not found
make[2]: *** [tramp_s.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/alex/gcc-build/./gcc/as: 87: exec: /usr/powerpc-wrs-vxworks/bin/as: not found
make[2]: *** [enable-execute-stack.o] Error 1
/home/alex/gcc-build/./gcc/as: 87: exec: /usr/powerpc-wrs-vxworks/bin/as: not found
make[2]: *** [eabi_s.o] Error 1
/home/alex/gcc-build/./gcc/as: 87: exec: /usr/powerpc-wrs-vxworks/bin/as: not found
make[2]: *** [unwind-dw2.o] Error 1
make[2]: Leaving directory `/home/alex/gcc-build/powerpc-wrs-vxworks/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/alex/gcc-build'
make: *** [all] Error 2
Which makes sense because /usr/powerpc-wrs-vxworks/bin/as dosen't exist... Not sure if it's supposed to?
Also included an overview of the powerpc-wrs-vxworks folder.
It should exist. Did your build of binutils succeed, and did you make install successfully? That should have created a bunch of stuff in /usr/powerpc-wrs-vxworks/bin.
  #12   Spotlight this post!  
Unread 04-11-2012, 23:53
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Alternate GCC Toolchain

Quote:
Originally Posted by rbmj View Post
It should exist. Did your build of binutils succeed, and did you make install successfully? That should have created a bunch of stuff in /usr/powerpc-wrs-vxworks/bin.
Alright, re-ran the binutils build and now it looks like it builds alright. I went ahead and installed too. I ran cmake on wpilib and get this error:
Code:
  /usr/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/bin/ld:
  cannot find -lstdc++
  #13   Spotlight this post!  
Unread 05-11-2012, 08:08
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Alternate GCC Toolchain

Quote:
Originally Posted by agartner01 View Post
Alright, re-ran the binutils build and now it looks like it builds alright. I went ahead and installed too. I ran cmake on wpilib and get this error:
Code:
  /usr/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/bin/ld:
  cannot find -lstdc++
OK, I made a quick mistake. Re-run configure for GCC with the argument --enable-libstdcxx, then run make and make install again, and you should be good.

I can't seem to edit my original post anymore, so please do this or you will get errors...
  #14   Spotlight this post!  
Unread 05-11-2012, 09:22
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Alternate GCC Toolchain

Ok, now it get this:
Code:
/usr/bin/powerpc-wrs-vxworks-c++ -nostdlib -r -Wl,-X -static
  CMakeFiles/cmTryCompileExec2792526235.dir/testCXXCompiler.cxx.obj -o
  cmTryCompileExec2792526235_PartialImage.out -lsupc++ -lstdc++ -lgcc

  /usr/local/powerpc-wrs-vxworks/munch.sh powerpc-wrs-vxworks-nm
  cmTryCompileExec2792526235_ctdt.c
  cmTryCompileExec2792526235_PartialImage.out

  Error running link command: No such file or directory
Edit:
Quote:
Originally Posted by rbmj View Post
The CMake Toolchain file should work with the standard "gccdist" toolchain. If you download this toolchain <1> then the cmake file should work fine (NOTE: It requires munch.sh and strip_syms.sh from the vxworks-gcc-patches repo to be installed in WIND_BASE - maybe should make these a separate package), just set TOOLCHAIN_IS_GCCDIST to true.
So I did that, now i get:
Code:
  /usr/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/bin/ld:
  cannot open linker script file
  /usr/local/powerpc-wrs-vxworks/wind_base/target/h/tool/gnu/ldscripts/link.OUT:
  No such file or directory

  collect2: error: ld returned 1 exit status

  make[1]: *** [cmTryCompileExec1263306447] Error 1

Last edited by agartner01 : 05-11-2012 at 09:48.
  #15   Spotlight this post!  
Unread 05-11-2012, 11:46
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Alternate GCC Toolchain

That's a known bug. Look in the old thread, make the symlinks described, and you should be good.

I haven't been updating the toolchain file as I've been *very* busy working with the GCC devs to get everything working on VxWorks out-of-the-box. Again, this is still experimental until I get everything updated and get some binary packages out. I wanted to give the adventurous a chance to play around with it in advance though
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:33.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi