Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Alternate GCC Toolchain (http://www.chiefdelphi.com/forums/showthread.php?t=109385)

rbmj 04-11-2012 00:29

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 :D

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 :D

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 :D) 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!

ebarker 04-11-2012 10:29

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1192704)
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 !!

agartner01 04-11-2012 11:28

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by ebarker (Post 1192724)
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?

Andrew Schreiber 04-11-2012 11:52

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by agartner01 (Post 1192727)
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. :rolleyes:

CodeYeti 04-11-2012 13:25

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by ebarker (Post 1192724)
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

agartner01 04-11-2012 15:41

Re: Alternate GCC Toolchain
 
1 Attachment(s)
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?

rbmj 04-11-2012 22:26

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by ebarker (Post 1192724)
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...

ebarker 04-11-2012 22:44

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...

agartner01 04-11-2012 23:07

Re: Alternate GCC Toolchain
 
1 Attachment(s)
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.

rbmj 04-11-2012 23:14

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).

rbmj 04-11-2012 23:25

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by agartner01 (Post 1192844)
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.

agartner01 04-11-2012 23:53

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1192848)
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++


rbmj 05-11-2012 08:08

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by agartner01 (Post 1192853)
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...

agartner01 05-11-2012 09:22

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 (Post 1161874)
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


rbmj 05-11-2012 11:46

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 :)

agartner01 05-11-2012 12:14

Re: Alternate GCC Toolchain
 
Alright! After a few more symlinks, cmake and make ran without incident. Build of wpilib succeeded. I'll test it on our robot tomorrow and see if it works. Thanks for all the hard work!

agartner01 05-11-2012 21:48

Re: Alternate GCC Toolchain
 
Robot code build completes but gives this error:
Code:

alex@alex-U46SV:~/robot$ make
[100%] Built target FRC_UserProgram
alex@alex-U46SV:~/robot$ make clean
alex@alex-U46SV:~/robot$ make
[100%] Building CXX object CMakeFiles/FRC_UserProgram.dir/src/MyRobot.cpp.obj
Linking CXX executable bin/FRC_UserProgram.out
powerpc-wrs-vxworks-nm: '/usr/local/lib/gcc/powerpc-wrs-vxworks/4.7.2/libgcc.a': No such file
[100%] Built target FRC_UserProgram

When I deploy, I get nothing but "relocation value does not fit in 24 bits"

rbmj 05-11-2012 23:02

Re: Alternate GCC Toolchain
 
That's probably due to the toolchain expecting a different version in GCC. Try and symlink /usr/local/lib/gcc/powerpc-wrs-vxworks/4.7.2 to 4.8.0 to get rid of the version conflict for now. Hopefully this fixes your "24 byte" issue. If that doesn't work, I'd double check to make sure that the link script is functioning properly.

Sorry it's been untested, but I literally posted this as soon as I got word that the patches had made it in. I was excited...

Also, past compile time I can't help you unless someone happened to send me a cRIO :( There's several other good people on the forums who can help though. And google.

I also deployed code with a hacked gcc 4.7.1 last year and it worked flawlessly, so it *is* possible to get this working...

CodeYeti 06-11-2012 14:02

Re: Alternate GCC Toolchain
 
I'll be testing this on the cRIO as soon as possible. Also, now that rbmj has pulled in my changes to the cmake toolchain, the symlinks should no longer be necessary. At least with the hacked version of 4.7.2, I was able to compile with no symlinks or anything. I didn't get the libgcc error either.

CodeYeti 06-11-2012 14:08

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by agartner01 (Post 1192982)
Robot code build completes but gives this error:
Code:

alex@alex-U46SV:~/robot$ make
[100%] Built target FRC_UserProgram
alex@alex-U46SV:~/robot$ make clean
alex@alex-U46SV:~/robot$ make
[100%] Building CXX object CMakeFiles/FRC_UserProgram.dir/src/MyRobot.cpp.obj
Linking CXX executable bin/FRC_UserProgram.out
powerpc-wrs-vxworks-nm: '/usr/local/lib/gcc/powerpc-wrs-vxworks/4.7.2/libgcc.a': No such file
[100%] Built target FRC_UserProgram

When I deploy, I get nothing but "relocation value does not fit in 24 bits"

Ok after looking over your post again, I found the issue. You've installed gcc with the prefix `/usr`, whereas the toolchain file for cmake is expecting you to have installed to /usr/local. Personally, I would reinstall gcc to /usr/local because that's where you're supposed to put things that you've installed from source, but you could also fix the problem by making the following edits to the `vxworks_toolchain.cmake` file.

Code:

-set(TOOLCHAIN_PREFIX "/usr/local/powerpc-wrs-vxworks")
+set(TOOLCHAIN_PREFIX "/usr/powerpc-wrs-vxworks")

Code:

-set(VXWORKS_LIBGCC "/usr/local/lib/gcc/powerpc-wrs-vxworks/${GCC_VERSION}/libgcc.a")
+set(VXWORKS_LIBGCC "${TOOLCHAIN_PREFIX}/../${GCC_VERSION}/libgcc.a")

At least from what I've read of your problem, that should do the trick.

agartner01 12-11-2012 22:56

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1193076)
Ok after looking over your post again, I found the issue. You've installed gcc with the prefix `/usr`, whereas the toolchain file for cmake is expecting you to have installed to /usr/local. Personally, I would reinstall gcc to /usr/local because that's where you're supposed to put things that you've installed from source, but you could also fix the problem by making the following edits to the `vxworks_toolchain.cmake` file.

Code:

-set(TOOLCHAIN_PREFIX "/usr/local/powerpc-wrs-vxworks")
+set(TOOLCHAIN_PREFIX "/usr/powerpc-wrs-vxworks")

Code:

-set(VXWORKS_LIBGCC "/usr/local/lib/gcc/powerpc-wrs-vxworks/${GCC_VERSION}/libgcc.a")
+set(VXWORKS_LIBGCC "${TOOLCHAIN_PREFIX}/../${GCC_VERSION}/libgcc.a")

At least from what I've read of your problem, that should do the trick.

Alright, I tried rebuilding it with '--prefix=/usr/local' however, I encountered errors during the build process.
Code:

In file included from /usr/powerpc-wrs-vxworks/wind_base/target/h/vxWorksCommon.h:200:0,
                from /usr/powerpc-wrs-vxworks/wind_base/target/h/vxWorks.h:84,
                from /usr/powerpc-wrs-vxworks/wind_base/target/h/private/handleLibP.h:21,
                from /usr/powerpc-wrs-vxworks/wind_base/target/h/stdio.h:62,
                from ../../../gcc-master/libgcc/../gcc/tsystem.h:88,
                from ../../../gcc-master/libgcc/libgcov.c:29:
/usr/powerpc-wrs-vxworks/wind_base/target/h/types/vxTypesOld.h:160:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 typedef int  (*FUNCPTR) ();    /* ptr to function returning int */
 ^
/usr/powerpc-wrs-vxworks/wind_base/target/h/types/vxTypesOld.h:169:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 typedef void  (*VOIDFUNCPTR) (); /* ptr to function returning void */
 ^
/usr/powerpc-wrs-vxworks/wind_base/target/h/types/vxTypesOld.h:178:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 typedef double  (*DBLFUNCPTR) ();  /* ptr to function returning double*/
 ^
/usr/powerpc-wrs-vxworks/wind_base/target/h/types/vxTypesOld.h:187:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 typedef float  (*FLTFUNCPTR) ();  /* ptr to function returning float */
 ^
../../../gcc-master/libgcc/libgcov.c: In function '__gcov_execl':
../../../gcc-master/libgcc/libgcov.c:1208:3: warning: implicit declaration of function 'execv' [-Wimplicit-function-declaration]
  return execv (path, args);
  ^
make[2]: Leaving directory `/home/alex/gcc-items/gcc-build/powerpc-wrs-vxworks/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/alex/gcc-items/gcc-build'
make: *** [all] Error 2

Also, now when I install to /usr I have to copy the powerpc* files from /usr/bin to /usr/bin/local. After that, I get this:
Code:

/usr/powerpc-wrs-vxworks/sys-include/types/vxTypesBase.h:53:20: fatal error: stddef.h: No such file or directory
 #include <stddef.h>

It looks like I'd have to include this dir with cmake, but I have no idea how to do so...
Code:

/usr/lib/gcc/powerpc-wrs-vxworks/4.8.0/include
Also, the one edit you wanted me to make to the toolchain file didn't make sense:
Quote:

Originally Posted by CodeYeti (Post 1193076)
Code:

-set(VXWORKS_LIBGCC "/usr/local/lib/gcc/powerpc-wrs-vxworks/${GCC_VERSION}/libgcc.a")
+set(VXWORKS_LIBGCC "${TOOLCHAIN_PREFIX}/../${GCC_VERSION}/libgcc.a")


I found it at:
Code:

set(VXWORKS_LIBGCC "${TOOLCHAIN_PREFIX}/../lib/gcc/powerpc-wrs-vxworks/${GCC_VERSION}/libgcc.a")
I'd really like to get this working, but it seems like I can't catch a break. Could someone remote desktop (or something like that) in and help me out? It's probably something stupid I'm overlooking...

AustinSchuh 13-11-2012 00:45

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by ebarker (Post 1192839)
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.

My understanding is that this is because the version of vxworks that we are using is ancient, and WindRiver has essentially dropped support for it. It does what NI needs for Labview, so there is no reason for NI to upgrade.

971 has been running a modern version of GCC for a while now, and has seen no issues that can be traced back to the compiler. We have been using 4.5.2 for a while, but are in the process of upgrading.

ebarker 13-11-2012 08:43

Re: Alternate GCC Toolchain
 
I've seen a lot of 3.4.4 work done with non FIRST, non-NI, non-vxworks, environments, hence the question about how a lot of people still use it.

That is why I was asking.

rbmj 13-11-2012 11:41

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1193076)
Ok after looking over your post again, I found the issue. You've installed gcc with the prefix `/usr`, whereas the toolchain file for cmake is expecting you to have installed to /usr/local. Personally, I would reinstall gcc to /usr/local because that's where you're supposed to put things that you've installed from source, but you could also fix the problem by making the following edits to the `vxworks_toolchain.cmake` file.

Sorry, I started doing that in order to shut up lintian when I was making the debian packages for the old binary release. I'll be synchronize things when I get around to making an actual release.

CodeYeti 08-01-2013 17:42

Re: Alternate GCC Toolchain
 
Hey there it's me again! I just noticed something that may be odd, but keep in mind that the concept of "stripping" syms is new to me outside of this problem. I'm going to try some simple testing of code on our new hardware tonight, and I wanted to make sure that my binary was compiling for the correct architecture and whatnot. A `file bin/FRC_UserProgram.out' yielded the following output.
Code:

bin/FRC_UserProgram.out: ELF 32-bit MSB relocatable, PowerPC or cisco 4500, version 1 (SYSV), not stripped
I noticed that it says it's "not stripped". Does that mean that maybe when I try this on hardware I will get conflicts with the kernel? Is my stripping still not working?

Thanks in advance for the help.

rbmj 08-01-2013 19:47

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1210908)
Hey there it's me again! I just noticed something that may be odd, but keep in mind that the concept of "stripping" syms is new to me outside of this problem. I'm going to try some simple testing of code on our new hardware tonight, and I wanted to make sure that my binary was compiling for the correct architecture and whatnot. A `file bin/FRC_UserProgram.out' yielded the following output.
Code:

bin/FRC_UserProgram.out: ELF 32-bit MSB relocatable, PowerPC or cisco 4500, version 1 (SYSV), not stripped
I noticed that it says it's "not stripped". Does that mean that maybe when I try this on hardware I will get conflicts with the kernel? Is my stripping still not working?

Thanks in advance for the help.

Though stripping the symbols was my original idea, I decided to instead localize the symbols. That way the symbols would still be internally visible in case we ever get a debugger to actually *work*, but they would not conflict with the external symbols for the kernel's libgcc/stdc++/supc++. So the file is correct, it is not stripped. If you look at the stripsyms script what it does is loads the symbols from these libraries into a file and then has objdump look for instances of those symbols in the executable and localize them. I figured this was as close as optimal to an ideal solution.

ALSO, w/r/t why 3.4?

Basically newer versions of GCC have issues on windows where it is very difficult to get any sort of cross compiler set up. I think MinGW doesn't support any cross compiler >3.4.5. So by moving to linux (it might also be an interesting experiment to try this toolchain in cygwin) you also gain the ability to tap the last 10 years of innovation from the GNU project :D

rbmj 10-01-2013 16:17

Re: Alternate GCC Toolchain
 
I have some beta-quality binaries up and running! These aren't the crappy binaries from the last toolchain but real, full debian toolchain binary packages. As always, all of the source is on my GitHub page. Sorry, but these are based off of debian (testing, specifically), and I don't have time to package every distro out there. They should work on *buntu and mint though (somebody confirm?). Feel free to try installing via alien on rpm or tgz based systems, but your mileage may vary.

Also, if any debian developers happen to read this, these packages make lintian want to barf. However they work and I've removed any really serious violations. :)

Though GitHub doesn' t offer downloads anymore, I was able to upload the files to dropbox (google drive didn't like the large files). Link:

https://www.dropbox.com/sh/0odxo8r92reos4z/1wIQYNwpaW

Note (if you are unfamiliar with these things) that unless you are going to try and compile from source you don't need the .dsc files. Those go with the original source code (which you can find if you look for it, a lot of it is on my github page, but NOT gcc or binutils - grab the right version of binutils from GNU and the current development branch of gcc).


As a request, is anyone willing to mirror the debs and/or provide a repo so that people can add it to the /etc/apt/sources.list? That would be awesome :)

Setup:

install the wrs-headers-installer package, then the powerpc-wrs-vxworks- packages (binutils, gcc, buildscripts, in that order), then the wpilib package. After that, you have a working toolchain! You'll also want cmake if you don't have that already.

Again, I don't have a repo, so dependency handling is a pain in the rear.

New workflow:

Add a CMakeLists.txt file to your code. This suffices as a minimal example:
Code:

cmake_minimum_required(VERSION 2.8)
include(FRCDeploy)

project(robot_code)
find_package(WPILib)

file(GLOB_RECURSE SOURCE_CODE *.cpp)

include_directories(${WPILib_INCLUDE_DIRS})
add_executable(robot_module ${SOURCE_CODE})
target_link_libraries(robot_module ${WPILib_LIBRARY})
add_make_deploy(robot_module 10.xx.yy.2)

Then, go to your build directory (I will assume they are called sourcedir and builddir and are in the same directory) and do the following:

Code:

$ mkdir ../builddir
$ cd ../builddir
$ frcmake ../sourcedir

NOTE THAT ITS FRCMAKE, *NOT* CMAKE.

frcmake is a wrapper for cmake that adds on some command line arguments to make your life easier...

Then, all you need is:
Code:

$ make
$ make deploy

Cross your fingers, and it should work!

Now, a disclaimer: I have not tested code built using this compiler. Since beginning this project I have gone off to college and now no longer have access to shiny cRIOs :(. PLEASE PLEASE PLEASE somebody test things out! I know that when I left school the toolchain worked with few issues. I've been able to fix many issues and can confirm that this builds REAL ROBOT CODE with WPILib successfully. However I can no longer say with certainty if such code will run correctly. IF it doesn't work, please tell me! However, know that I cannot help you without NETCONSOLE OUTPUT. Even then, sometimes it's cryptic and I hope that there are brave souls (CodeYeti, are you out there? :D) that can work with you and squash any bugs. I'm hoping that this is early enough in the build season that people still have time to play with things :)

Note: As a minor bug if you want to use the 'make deploy' functionality you need to have wput installed on your system, which isn't a dependency of the package. This is because I plan to remove the dependency in the future, I'm lazy, and I've already invoked debuild a few too many times for my own sanity this week :/

rbmj 10-01-2013 19:04

Re: Alternate GCC Toolchain
 
1 Attachment(s)
Forgot - these packages are signed with my public key. It's attached.

danopia 10-01-2013 21:55

Re: Alternate GCC Toolchain
 
I have a high-bandwidth web server that can host any arbitrary files, if you tell me how to set up a repo I can do that for you. (I assume that mirroring just the binaries alone is not enough?)

rbmj 11-01-2013 11:30

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by danopia (Post 1212703)
I have a high-bandwidth web server that can host any arbitrary files, if you tell me how to set up a repo I can do that for you. (I assume that mirroring just the binaries alone is not enough?)

Unfortunately it is quite a bit more involved. It requires installing some specialized programs on the computer in question to generate the description files :(

Mirroring the files would be awesome though :)

I would host the repo myself except I'm no longer at home to keep my parents from shutting down my server (something about a waste of electricity...). So, although my system has all the software, I can't access it.

Perhaps it might be possible to set up a repo in a virtual machine and then once that is working rsync all of the files up to the server (as the files are served over http, so you don't actually need to add any services). I don't know if anyone has done that before or gotten it to work.

I also just checked the md5sums to verify the upload worked (it did). Hopefully these should install correctly.

agartner01 11-01-2013 22:17

Re: Alternate GCC Toolchain
 
I've installed these packages, and I get errors during compile. I've tried it on two computer with Ubuntu 12.10 and am in the process of trying it on a clean VM. On the first computer, I don't get a "Could NOT find WPILib (missing: WPILib_INCLUDE_DIR)," but I do on the second. Both ultimately fail with, "fatal error: iostream.h: No such file or directory."

Code:

alex@gartner-pc:~/robotics-workspace/Simple/build$ frcmake ../src
-- Could NOT find WPILib (missing:  WPILib_INCLUDE_DIR)
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_TOOLCHAIN_FILE


-- Build files have been written to: /home/alex/robotics-workspace/Simple/Untitled Folder
alex@gartner-pc:~/robotics-workspace/Simple/build$ make
[100%] Building CXX object CMakeFiles/robot_module.dir/MyRobot.cpp.obj
In file included from /home/alex/robotics-workspace/Simple/src/MyRobot.cpp:1:0:
/usr/powerpc-wrs-vxworks/include/WPILib/WPILib.h:11:22: fatal error: iostream.h: No such file or directory
 #include <iostream.h>
                      ^
compilation terminated.
make[2]: *** [CMakeFiles/robot_module.dir/MyRobot.cpp.obj] Error 1
make[1]: *** [CMakeFiles/robot_module.dir/all] Error 2
make: *** [all] Error 2
alex@gartner-pc:~/robotics-workspace/Simple/build$


rbmj 11-01-2013 23:29

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by agartner01 (Post 1213377)
I've installed these packages, and I get errors during compile. I've tried it on two computer with Ubuntu 12.10 and am in the process of trying it on a clean VM. On the first computer, I don't get a "Could NOT find WPILib (missing: WPILib_INCLUDE_DIR)," but I do on the second.

Can you tell me what you find in WPILibConfig.cmake and WPILibConfigVersion.cmake in /usr/powerpc-wrs-vxworks/share/WPILib/cmake, and check that any variables set in there are correct?

Quote:

Both ultimately fail with, "fatal error: iostream.h: No such file or directory."

Code:

alex@gartner-pc:~/robotics-workspace/Simple/build$ frcmake ../src
-- Could NOT find WPILib (missing:  WPILib_INCLUDE_DIR)
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_TOOLCHAIN_FILE


-- Build files have been written to: /home/alex/robotics-workspace/Simple/Untitled Folder
alex@gartner-pc:~/robotics-workspace/Simple/build$ make
[100%] Building CXX object CMakeFiles/robot_module.dir/MyRobot.cpp.obj
In file included from /home/alex/robotics-workspace/Simple/src/MyRobot.cpp:1:0:
/usr/powerpc-wrs-vxworks/include/WPILib/WPILib.h:11:22: fatal error: iostream.h: No such file or directory
 #include <iostream.h>
                      ^
compilation terminated.
make[2]: *** [CMakeFiles/robot_module.dir/MyRobot.cpp.obj] Error 1
make[1]: *** [CMakeFiles/robot_module.dir/all] Error 2
make: *** [all] Error 2
alex@gartner-pc:~/robotics-workspace/Simple/build$


Well, that's an error in WPILib. <iostream.h> is non-standard and hasn't existed for some time - the compiler is right to throw an error there. Thanks for catching that - I've never included <WPILib.h> in my own code (and incidentally, neither does WPILib, as otherwise I would have caught the error earlier). For now just manually change it to <iostream>. The patch is in my github repo. I'm opening another bug on WPILib for all sorts of code that won't compile with a modern compiler - hopefully they listen this time...

Due to it being a pain to regenerate all the binaries no re-upload yet. Those who want the latest and greatest can as always grab it off github. Compiling WPILib is as simple as frcmake, make, make install.

agartner01 11-01-2013 23:52

Re: Alternate GCC Toolchain
 
4 Attachment(s)
Quote:

Originally Posted by rbmj (Post 1213438)
Can you tell me what you find in WPILibConfig.cmake and WPILibConfigVersion.cmake in /usr/powerpc-wrs-vxworks/share/WPILib/cmake, and check that any variables set in there are correct?

I believe the variables are set correctly, I've attached the files.

I've also made the change from <iostream> and things appear to compile alright. I've attached my current build output since there is still the WPILib error. I'll be testing it on the crio either tomorrow or Sunday.

Edit: I've tested your packages in a clean Ubuntu 12.10 VM, and I've encountered a different error. See VMerror.txt for details.

CodeYeti 12-01-2013 15:11

Re: Alternate GCC Toolchain
 
Well I've managed to get everything compiling alright, and now that we have our hardware, I've been trying to test things on hardware. Right now the kernel module is failing to load. The netconsole output is as follows:
Code:

Warning: module 0xe780b8 (FRC_UserProgram.out) holds reference to undefined symbol _ZN14IterativeRobot16TeleopContinuoutEv
<more errors similar to the one above>
...FRC_UserProgram failed to load.

Any help is appreciated. Thanks!

CodeYeti 12-01-2013 15:30

Re: Alternate GCC Toolchain
 
Ok I've gotten that fixed. For some reason, my build of WPILib had been corrupted and I just had to make clean and make gain. Now I've got a similar error that hasn't been so easy to fix:
Code:

Warning: module 0xe 78118 (FRC_UserProgram.out) holds reference to undefined symbol _start.
(unloading partially loaded module FRC_UserProgram.out)
...FRC_UserProgram failed to load.

Thanks in advance for the help and sorry for the double post.

agartner01 12-01-2013 15:55

Re: Alternate GCC Toolchain
 
1 Attachment(s)
Quote:

Originally Posted by CodeYeti (Post 1213736)
Ok I've gotten that fixed. For some reason, my build of WPILib had been corrupted and I just had to make clean and make gain. Now I've got a similar error that hasn't been so easy to fix:
Code:

Warning: module 0xe 78118 (FRC_UserProgram.out) holds reference to undefined symbol _start.
(unloading partially loaded module FRC_UserProgram.out)
...FRC_UserProgram failed to load.

Thanks in advance for the help and sorry for the double post.

I'd just like to add that I get the same error. Net console output is attached.

CodeYeti 12-01-2013 16:09

Re: Alternate GCC Toolchain
 
Alright well I edited the strip_syms.sh script to dump its syms to my home directory. It's not stripping off _start so thats not the issue. Just thought I'd share as I'm debugging.

EDIT: It's probably worth noting that I'm working on OSX.

EDIT2: If you make any progress, no matter how small, please don't hesitate to share.

rbmj 12-01-2013 20:39

Re: Alternate GCC Toolchain
 
Thank you both for testing. I knew something would happen like this with no testbed. It's probably a compiler flag issue. I'm going to look at it in objdump and see where the reference is...

CodeYeti 12-01-2013 20:59

Re: Alternate GCC Toolchain
 
Thanks again for all your work on this, and updating for the new wpilib in a timely manner. You've seriously been great.

Anyways, I noticed you've added a WPILibConfig.cmake file to the wpilib project. Why did you decide to move away from the find module. AFAIK, the find module is the "accepted/correct" way to go about it.

rbmj 12-01-2013 21:14

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1213953)
Thanks again for all your work on this, and updating for the new wpilib in a timely manner. You've seriously been great.

Anyways, I noticed you've added a WPILibConfig.cmake file to the wpilib project. Why did you decide to move away from the find module. AFAIK, the find module is the "accepted/correct" way to go about it.

Two reasons:

1. laziness
2. it's a lot easier to do version checking with Config files, and some programmers might want to codify a dependency on a particular release of WPILib in the build system.

CodeYeti 12-01-2013 21:40

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1213966)
Two reasons:

1. laziness
2. it's a lot easier to do version checking with Config files, and some programmers might want to codify a dependency on a particular release of WPILib in the build system.

Ahh version checking sure would be nice.

Still, if anybody still wants the old WPILib find module (I'll still be doing things that way I think). I'll keep it updated for rbmj's toolchain packages.

http://github.com/mcoffin/cmake-wpilib

agartner01 12-01-2013 21:52

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1213935)
Thank you both for testing. I knew something would happen like this with no testbed. It's probably a compiler flag issue. I'm going to look at it in objdump and see where the reference is...

If you wanted to remote desktop in and look at the crio yourself (that might accelerate the debugging process), just say the word and I'll set it up.

rbmj 13-01-2013 00:36

Re: Alternate GCC Toolchain
 
OK, so I looked at a disassembly of my own code. I can already tell that the final link (the one that creates <TARGET>) is introducing the problem. Now, AFAIK this shouldn't happen due to -nostdlib, which implies -nostartfiles, as I *think* that's what introduces _start to the symbol table.

I looked at a disassembly of the code and ran a search for _start. It isn't called anywhere, so I don't see why it needs to reference _start. VxWorks also doesn't care about _start as it has it's own entry points.

I believe that something like the following would work as a temporary workaround:
Code:

extern "C" {
void _start() {
  //output an error message?
}
}

As I believe it should never be called, I doubt this would be an issue. Then, for completeness' sake one should add "-L _start" to the objcopy command in powerpc-wrs-vxworks-munch. That way you don't pollute the kernel namespace with unnecessary symbols.

I also don't recalling this problem happening with old GCC. Therefore, I'm going to try a year old version of GCC and see if it still has this issue. If not, than it's a regression in the compiler. If I know this is the case, I can run a git bisect and determine exactly where this happened. I'm 90% sure it'll work with last march's gcc (as I seem to remember it working), so that's about 9 months. According to git there have been ~8800 commits in the past 9 months, and log2(8800) is about 13. So, thanks to the wonders of binary search, I can figure out what broke it. Then, that's just a bug report. I should be able to script it (I think [ `nm <TARGET> | grep _start | wc -l` -eq 1 ] will work as a testcase on the compilation).

I don't have that long though... GCC is in the last stage of development before release. This should count as a pretty serious regression though if it is what I think it is.

Sorry, thinking on forum. It helps me work it out...

Is that the ONLY unresolved symbol error you get?

EDIT: Nvm just checked the netconsole output. Thanks again for that. To be quite honest, this is better than I expected, considering how often these things can break.

CodeYeti 13-01-2013 00:45

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1214130)
OK, so I looked at a disassembly of my own code. I can already tell that the final link (the one that creates <TARGET>) is introducing the problem. Now, AFAIK this shouldn't happen due to -nostdlib, which implies -nostartfiles, as I *think* that's what introduces _start to the symbol table.

I looked at a disassembly of the code and ran a search for _start. It isn't called anywhere, so I don't see why it needs to reference _start. VxWorks also doesn't care about _start as it has it's own entry points.

I believe that something like the following would work as a temporary workaround:
Code:

extern "C" {
void _start() {
  //output an error message?
}
}

As I believe it should never be called, I doubt this would be an issue. Then, for completeness' sake one should add "-L _start" to the objcopy command in powerpc-wrs-vxworks-munch. That way you don't pollute the kernel namespace with unnecessary symbols.

I also don't recalling this problem happening with old GCC. Therefore, I'm going to try a year old version of GCC and see if it still has this issue. If not, than it's a regression in the compiler. If I know this is the case, I can run a git bisect and determine exactly where this happened. I'm 90% sure it'll work with last march's gcc (as I seem to remember it working), so that's about 9 months. According to git there have been ~8800 commits in the past 9 months, and log2(8800) is about 13. So, thanks to the wonders of binary search, I can figure out what broke it. Then, that's just a bug report. I should be able to script it (I think [ `nm <TARGET> | grep _start | wc -l` -eq 1 ] will work as a testcase on the compilation).

I don't have that long though... GCC is in the last stage of development before release. This should count as a pretty serious regression though if it is what I think it is.

Sorry, thinking on forum. It helps me work it out...

Is that the ONLY unresolved symbol error you get?

EDIT: Nvm just checked the netconsole output. Thanks again for that. To be quite honest, this is better than I expected, considering how often these things can break.

I'll see if I can get out to the build space tomorrow and give that a test. Could be more errors we don't know about. If not, I'll definitely have something to tell you on Monday. Thanks for the work. Should I even bother try adding the -nostartfiles flag explicitly instead of implicitly?

agartner01 13-01-2013 00:48

Re: Alternate GCC Toolchain
 
I'll try the fix on Sunday. If you want to give me a .out from the old compiler to test, feel free to post it (or upload it somewhere) and I'll test it out.

CodeYeti 13-01-2013 01:04

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by agartner01 (Post 1214144)
I'll try the fix on Sunday. If you want to give me a .out from the old compiler to test, feel free to post it (or upload it somewhere) and I'll test it out.

I can't really sleep so I'm starting to do the binary searching. Do you have a cRIO with you now or no?

agartner01 13-01-2013 01:06

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1214157)
I can't really sleep so I'm starting to do the binary searching. Do you have a cRIO with you now or no?

No it's at my school... Was thinking about taking the test bed home but that didn't happen...

Edit: I'm not sure if this's relevant, I just though of something else. Previous attempts also yielded the "_start" symbol error. However, they also gave a "relocation value does not fit within 24 bits" error, while this attempt did not.

CodeYeti 13-01-2013 01:16

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by agartner01 (Post 1214159)
No it's at my school... Was thinking about taking the test bed home but that didn't happen...

Edit: I'm not sure if this's relevant, I just though of something else. Previous attempts also yielded the "_start" symbol error. However, they also gave a "relocation value does not fit within 24 bits" error, while this attempt did not.

Well its good to know that something got fixed. I asked my mentors to take a cRIO with me, but they weren't too keen on the idea either. How old of an attempt are we talking about here?

agartner01 13-01-2013 01:21

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1214165)
Well its good to know that something got fixed. I asked my mentors to take a cRIO with me, but they weren't too keen on the idea either. How old of an attempt are we talking about here?

Both results from the old post and this post gave me these errors. I'm assuming it was an error on my part...

rbmj 13-01-2013 10:02

Re: Alternate GCC Toolchain
 
I can actually do the binary search without a cRIO, as (once I know what to look for) I can have a script determine if it holds a reference to _start.

I'm working on getting a setup to compile a patched old compiler now.

Edit: Compiling last march's gcc with the patches. Let's see if this one works.

rbmj 13-01-2013 11:29

Re: Alternate GCC Toolchain
 
OK, I can confirm that it's a flag issue, not a compiler issue. Now just to determine which one...

agartner01 13-01-2013 12:31

Re: Alternate GCC Toolchain
 
1 Attachment(s)
Alright, I've tested the fix of the "_start" symbol error, and it appears that everything is now working. Yay! I've also included netconsole output as proof.

Edit: I'd still like to resolve the errors I encountered during the VM installation, detailed in this post.

rbmj 13-01-2013 14:12

Re: Alternate GCC Toolchain
 
OK, so after some testing it looks like it's a problem with the link script. I'll investigate further.

Also, the new packages do not require you to set WIND_BASE as they install a script to set it in /etc/profile.d. As long as your /etc/profile will source everything in /etc/profile.d (which is the default in modern debian and I think thus modern ubuntu), don't bother setting that. The issue is that the toolchain file looks in the environment for WIND_BASE and goes off of that, which for this toolchain MUST be /usr/powerpc-wrs-vxworks/wind_base.

CodeYeti 13-01-2013 14:12

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1214293)
OK, I can confirm that it's a flag issue, not a compiler issue. Now just to determine which one...

Could it be a problem with the compiler configuration as well? IIRC from a while back, libmudflap had a reference to _start. Was a --disable flag maybe forgotten when configuring the compiler?

Just an idea. I don't have access to a cRIO just this second so I can't test much other than just looking at objdumps.

rbmj 13-01-2013 15:00

Re: Alternate GCC Toolchain
 
I must have originally forgotten to use the link script when I checked things, as the script has ENTRY(_start) in it. Either that, or an update to ld where originally it would ignore this directive if it couldn't find the symbol but now adds it in as an unresolved symbol. I don't know which.

I'm modifying the wrs-headers-installer script to make a new ld script. Unfortunately the update is going to require you to re-download gccdist and everything as I don't have time to do the upgrade "correctly". Therefore, I won't change the version, and I'll give you a script that will perform the update.

rbmj 13-01-2013 15:12

Re: Alternate GCC Toolchain
 
OK, so at the original download link I've updated the buildscripts and wrs-headers-installer packages. Since they're still considered beta I'm not upgrading the versions, but if you install with dpkg it will still overwrite.

If you have the old wrs-headers-installer package, you do not need to update that package, but you do need to update the buildscripts package. You also need to run this:

Code:

# mkdir -p /usr/powerpc-wrs-vxworks/share/ldscripts
# sed '/ENTRY(_start)/d' < /usr/powerpc-wrs-vxworks/wind_base/target/h/tool/gnu/ldscripts/link.OUT > /usr/powerpc-wrs-vxworks/share/ldscripts/dkm.ld

Note that that needs to be run as root - I would use su (or sudo su), not sudo as sudo sometimes has issues with io redirection (in my experience).

Once you've run those commands, verify that /usr/powerpc-wrs-vxworks/share/ldscripts/dkm.ld exists and has content in it.

If you do this, that should fix the unresolved symbol error for _start.

rbmj 13-01-2013 15:41

Re: Alternate GCC Toolchain
 
FWIW, I've submitted the patch to the WPILib tracker. I'm not sure if it'll come to anything, but w/e.

Open source does not mean open development...

Thanks all for your help in debugging this! Hopefully this will fix things. A preliminary build of my team's code from last year works, and I can't find any of the usual suspect errors that I can catch by looking at the binaries with binutils.

agartner01 13-01-2013 18:39

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1214421)
OK, so at the original download link I've updated the buildscripts and wrs-headers-installer packages. Since they're still considered beta I'm not upgrading the versions, but if you install with dpkg it will still overwrite.

If you have the old wrs-headers-installer package, you do not need to update that package, but you do need to update the buildscripts package. You also need to run this:

Code:

# mkdir -p /usr/powerpc-wrs-vxworks/share/ldscripts
# sed '/ENTRY(_start)/d' < /usr/powerpc-wrs-vxworks/wind_base/target/h/tool/gnu/ldscripts/link.OUT > /usr/powerpc-wrs-vxworks/share/ldscripts/dkm.ld

Note that that needs to be run as root - I would use su (or sudo su), not sudo as sudo sometimes has issues with io redirection (in my experience).

Once you've run those commands, verify that /usr/powerpc-wrs-vxworks/share/ldscripts/dkm.ld exists and has content in it.

If you do this, that should fix the unresolved symbol error for _start.

It doesn't, as far as I can see... Updated both the buildscripts and wrs headers, removed the fix from my code, and then got a "_start symbol" error. I then attempted to run the code you posted, but that didn't solve it either...

Edit: I'm sorry, I started a new project and things worked just fine...

rbmj 13-01-2013 22:34

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by agartner01 (Post 1214516)
I started a new project and things worked just fine...

:D Awesome!

CodeYeti 13-01-2013 22:54

Re: Alternate GCC Toolchain
 
Things are working well here as well, though it seems that I'm unable to use any of the C++11 memory management features. It fails at compile time, saying that std::unique_ptr doesn't refer to a type. Aren't these supposed to work? If not, why? (Just curious).

rbmj 14-01-2013 06:21

Re: Alternate GCC Toolchain
 
Unfortunately I can't find a way to get C++11 to work either. I remembered it working a while ago however this does not appear to be the case.

I'll send a message to gcc-help asking about this.

Redefine __cplusplus to 201103L at the top of your source file and watch the barf spew from the compiler...

rbmj 15-01-2013 08:44

Re: Alternate GCC Toolchain
 
OK, I've determined the cause of the c++11 failures - turns out it was my own stupidity.

I have classes so I don't have time to regen the packages until this weekend, but the quick fix is to go into /usr/powerpc-wrs-vxworks/share/cmake/toolchain.cmake, look for the line containing -ansi, and remove -ansi from that line. Then, when you call cmake, use:

Code:

$ frcmake $SRCDIR -DCMAKE_CXX_FLAGS='-std=c++11 -fpermissive'
I don't want to make this default yet as there's still a few issues in WPILib with C++11 compatibility and I don't want to mess up people who are happy with c++98

CodeYeti 15-01-2013 14:49

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1215674)
OK, I've determined the cause of the c++11 failures - turns out it was my own stupidity.

I have classes so I don't have time to regen the packages until this weekend, but the quick fix is to go into /usr/powerpc-wrs-vxworks/share/cmake/toolchain.cmake, look for the line containing -ansi, and remove -ansi from that line. Then, when you call cmake, use:

Code:

$ frcmake $SRCDIR -DCMAKE_CXX_FLAGS='-std=c++11 -fpermissive'
I don't want to make this default yet as there's still a few issues in WPILib with C++11 compatibility and I don't want to mess up people who are happy with c++98

Would you mind giving a few details on whats up with WPILib and C++11 so I can either work the problems out or avoid situations in which they would be a problem?

rbmj 15-01-2013 15:37

Re: Alternate GCC Toolchain
 
The biggest thing is that GCC seems to conform to the standard more strictly in c++11 mode than in c++98 mode. In C++98 mode it is technically wrong to declare and initialize a static constant of non-integral type in a header file, however gcc accepts it. However, with c++11 and the constexpr keyword there is an easy workaround so gcc wants you to use constexpr instead of const. This causes compile errors, though these can be downgraded to warnings with the -fpermissive flag. However, I feel uncomfortable adding this flag in as I believe that code should conform to the standard and be warning-free. Although in some cases these are merely stylistic concerns, I think that in many cases these can highlight a bug or undefined behavior. This is why I enable -Wall in the toolchain file.

I'm working on cleaning up the WPILib headers so that they won't fire off warnings. This way they don't fill up the build log for the end user. Library headers that fire warnings are at best annoying and at worst can overwhelm valuable output from the compiler.

CodeYeti 16-01-2013 00:06

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1215900)
The biggest thing is that GCC seems to conform to the standard more strictly in c++11 mode than in c++98 mode. In C++98 mode it is technically wrong to declare and initialize a static constant of non-integral type in a header file, however gcc accepts it. However, with c++11 and the constexpr keyword there is an easy workaround so gcc wants you to use constexpr instead of const. This causes compile errors, though these can be downgraded to warnings with the -fpermissive flag. However, I feel uncomfortable adding this flag in as I believe that code should conform to the standard and be warning-free. Although in some cases these are merely stylistic concerns, I think that in many cases these can highlight a bug or undefined behavior. This is why I enable -Wall in the toolchain file.

I'm working on cleaning up the WPILib headers so that they won't fire off warnings. This way they don't fill up the build log for the end user. Library headers that fire warnings are at best annoying and at worst can overwhelm valuable output from the compiler.

Cool. I'll probably join in on working with WPILib. Who knows, we might find a bug! The java version actually had a sine and cosine flipped two years ago.

rbmj 16-01-2013 06:04

Re: Alternate GCC Toolchain
 
Beat you to it:

http://firstforge.wpi.edu/sf/go/artf...=1358334177246

:D

CodeYeti 16-01-2013 17:45

Re: Alternate GCC Toolchain
 
Hi there! I've been reluctant to install via the packages due to my infinitely small understanding of aptitude packages. I've installed the new build scripts though since there are updates to the toolchain file in there. I just installed with the following commands after checking out the powerpc-wrs-vxworks-buildscripts repo.
Code:

cmake .
make && sudo make install

The new ld script that the toolchain file now references for non-gccdist toolchains doesn't appear to be in my compiler installation. Is there somewhere where I should be getting it, or is installed by a package?

Also: should I just switch to the packages, even if I'm planning on actively developing if I find a bug/missing feature?

rbmj 16-01-2013 18:13

Re: Alternate GCC Toolchain
 
The link script is generated by the wrs-headers-installer package. I was not sure which package it would be more suitable in, and I ended up picking the wrs-headers-installer package, since that handles all the other proprietary information.

CodeYeti 16-01-2013 18:19

Re: Alternate GCC Toolchain
 
Thanks. I need to do some reading on how aptitude packages work from a non-user perspective. Since I have a meeting tonight, and kinda want to toy with C++11 and wpilib, would you mind just giving me a quick instruction on how to build the packages? (I can install them and all that jazz, but I haven't really developed with aptitude before).

Thanks again for the patience and your awesome contributions to FIRST.

BEGIN EDIT

Just tried building GCC on my debian machine from source. I've gotten a pretty odd error. Might a recent commit have broken something?

Code:

../../../gcc-master/libgcc/libgcov.c: In function 'create_file_directory':
../../../gcc-master/libgcc/libgcov.c:143:13: error: too many arguments to function 'mkdir'
            && mkdir (filename, 0755) == -1
            ^
In file included from ../../../gcc-master/libgcc/libgcov.c:82:0:
/usr/local/powerpc-wrs-vxworks/wind_base/target/h/sys/stat.h:169:24: note: declared here
 extern    STATUS      mkdir (const char *_dirName);
                        ^
make[2]: *** [_gcov.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/home/mcoffin/gcc-build/powerpc-wrs-vxworks/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/mcoffin/gcc-build'
make: *** [all] Error 2


CodeYeti 16-01-2013 19:21

Re: Alternate GCC Toolchain
 
Sorry for the double post, but my edit button went away. Anyways, I've started fixing up wpilib to fit GCC's idea of the C++11 standard. It's in a branch called cxx11 in my fork of your wpilib repository.

http://github.com/mcoffin/wpilib

rbmj 16-01-2013 20:39

Re: Alternate GCC Toolchain
 
Once you have debhelper and devscripts et al installed, it's not too bad. You won't be able to sign the packages, but everything else will work. Buildscripts is easy - just run ./debmake and it should work automatically. Beware, however, that that script will make the latest commit in the git repo, so you need to commit any changes before they will go into the package.

For the other packages, the basic workflow is this:
1. create or download/rename a pkgname_version.orig.tar.gz file. It should extract to pkgname-version.
2. extract this archive, and go into the the created source directory
3. If the source doesn't have a debian subdirectory, copy the debian subdirectory into the source from my git repo
4. run debuild -us -uc. This will create but not sign the packages. If you want to sign the packages yourself you'll need to make a key and make a new changelog entry with the dch command, making sure that the name, nickname (you might have to add this in manually), and email match EXACTLY your key's info.

note that in order to not conflict with the packages that debian will build, many of the packages are named powerpc-wrs-vxworks-name. That's what you use for package name. Additionally, these directories don't have version numbers, so you either have to rename the directory or make a new copy of the repo.

As an exception, you need to add -e WIND_BASE when you call debuild for gcc.

I highly suggest that you do your homework though. The debian buildsystem is very powerful, but it's not exactly simple, and there are a LOT of gotchas.

As far as your gcc error goes, looks like something's up with fixincludes (again). Double check to make sure that fixincludes is running, and if that doesn't work, look inside your gcc build directory (not top level, but the gcc build directory itself), find include-fixed, and look in there for sys/stat.h. Once you have determined that that file exists, look for a variadic macro for mkdir.

If that file does not exist, tell me which files do in the include-fixed directory.

EDIT: I'm looking at the way that you fixed WPILib. Good job on fixing all those constexpr issues, however we need to maintain compatibility with c++98. You probably need to test #if __cplusplus < 201103L and have a macro that selects the correct const-incantation for different versions of c++. My perspective is that we should strive for integration with upstream as much as possible (even if development is rather closed off) as I do not have or want to put in the time and energy necessary to maintain a full fork. This is why I worked so hard to get the patches merged in to GCC itself - so all those hacks were no longer necessary, and we weren't going after a moving target. And, to return to the point, there's no way that they'll accept any changes that break compatibility with c++98.

IF the community wants a more openly developed version of WPILib, OK. We can put in the work to make that happen if it's a goal (primarily meaning make it easy to integrate with ucpp and standard WindRiver. If we can react to bug reports on CD faster than upstream, then that might be a feature justifying a fork. However, as much as the long time between bugfixes and the secret development of WPILib irks me, I don't see a large enough demand to justify a fork.

CodeYeti 16-01-2013 23:52

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1216862)
Once you have debhelper and devscripts et al installed, it's not too bad. You won't be able to sign the packages, but everything else will work. Buildscripts is easy - just run ./debmake and it should work automatically. Beware, however, that that script will make the latest commit in the git repo, so you need to commit any changes before they will go into the package.

For the other packages, the basic workflow is this:
1. create or download/rename a pkgname_version.orig.tar.gz file. It should extract to pkgname-version.
2. extract this archive, and go into the the created source directory
3. If the source doesn't have a debian subdirectory, copy the debian subdirectory into the source from my git repo
4. run [il]debuild -us -uc[/il]. This will create but not sign the packages. If you want to sign the packages yourself you'll need to make a key and make a new changelog entry with the dch command, making sure that the name, nickname (you might have to add this in manually), and email match EXACTLY your key's info.

note that in order to not conflict with the packages that debian will build, many of the packages are named powerpc-wrs-vxworks-name. That's what you use for package name. Additionally, these directories don't have version numbers, so you either have to rename the directory or make a new copy of the repo.

As an exception, you need to add [il]-e WIND_BASE[/il] when you call debuild for gcc.

I highly suggest that you do your homework though. The debian buildsystem is very powerful, but it's not exactly simple, and there are a LOT of gotchas.

As far as your gcc error goes, looks like something's up with fixincludes (again). Double check to make sure that fixincludes is running, and if that doesn't work, look inside your gcc build directory (not top level, but the gcc build directory itself), find include-fixed, and look in there for sys/stat.h. Once you have determined that that file exists, look for a variadic macro for mkdir.

If that file does not exist, tell me which files do in the include-fixed directory.

EDIT: I'm looking at the way that you fixed WPILib. Good job on fixing all those constexpr issues, however we need to maintain compatibility with c++98. You probably need to test #if __cplusplus < 201103L and have a macro that selects the correct const-incantation for different versions of c++. My perspective is that we should strive for integration with upstream as much as possible (even if development is rather closed off) as I do not have or want to put in the time and energy necessary to maintain a full fork. This is why I worked so hard to get the patches merged in to GCC itself - so all those hacks were no longer necessary, and we weren't going after a moving target. And, to return to the point, there's no way that they'll accept any changes that break compatibility with c++98.

IF the community wants a more openly developed version of WPILib, OK. We can put in the work to make that happen if it's a goal (primarily meaning make it easy to integrate with ucpp and standard WindRiver. If we can react to bug reports on CD faster than upstream, then that might be a feature justifying a fork. However, as much as the long time between bugfixes and the secret development of WPILib irks me, I don't see a large enough demand to justify a fork.

Sounds good. I'll have to get working on the compatibility issue. I've fixed all the errors, and some of the warnings for WPILib with C++11. I can confirm that at least the memory management features of C++11 work on hardware as of tonight!

The C++11 only version of WPILib is here: https://github.com/mcoffin/wpilib/tree/cxx11.

As for making sure we're backwards compatible, from what I've read, WPILib as it is shouldn't compile under C++98 either, it's just a fluke that GCC is playing loose with the standards there. Therefore, I think that when making a fix, it would be best to avoid the initialization of static constant members that are floats/doubles from within the class declaration all together. I think that the next best solution would just be to put them in the constructor? That would work on both standards, whereas the constexpr fix defining them as expressions would only work for C++11.

EDIT: The contents of include-fixed are as follows. I'm going to re-start from scratch just in case I missed a flag somewhere that caused fixincludes to mess up, but here are the contents in case I get the error again:
Code:

limits.h
README
syslimits.h

EDIT 2: To anybody that's thinking of dealing with WPILib, I suggest adding the following flag in CMAKE_CXX_FLAGS to filter out all the deprecated string literal warnings. There's no way that anybody is going to go through the whole library and convert it to using std::string unless that have absolutely no life.
Code:

-Wno-write-strings
EDIT 3: Build error was just a fluke. I have no idea what happened. Deleted my build directory, reconfigured and it worked. That was pretty stupid on my part. Sorry for the hassle on that one.

EDIT 4: The virtual destructor warnings are legit. These are abstract classes with pure abstract methods, and the classes have derived classes. This means that if a derived class were to have an explicit destructor, it wouldn't be getting called. I'll be sure to fix those warnings in the next round of fixes.

EDIT 5: The master branch on my git repository should fix many of the compiler warnings for wpilib on C++98 as well. I haven't tested compatibility with old versions of GCC yet though. I did leave some unnecessary typedef's in there because I think that they, at some point, were necessary, so WindRiver's version of GCC might still want them and I don't want to break compatibility with it. The C++11 branch has these changes pulled in as well.

rbmj 17-01-2013 07:38

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1217005)
Sounds good. I'll have to get working on the compatibility issue. I've fixed all the errors, and some of the warnings for WPILib with C++11. I can confirm that at least the memory management features of C++11 work on hardware as of tonight!

The C++11 only version of WPILib is here: https://github.com/mcoffin/wpilib/tree/cxx11.

As for making sure we're backwards compatible, from what I've read, WPILib as it is shouldn't compile under C++98 either, it's just a fluke that GCC is playing loose with the standards there. Therefore, I think that when making a fix, it would be best to avoid the initialization of static constant members that are floats/doubles from within the class declaration all together. I think that the next best solution would just be to put them in the constructor? That would work on both standards, whereas the constexpr fix defining them as expressions would only work for C++11.

Ha yes, as it stands a *lot* of code shouldn't compile under C++98 either. However GCC 3.x is *very* lax with compliance. GCC 4 really stepped up on its strictness, which is great except it also causes cases like these. I think in c++98 mode there's a little more leniency built in just for backwards compatibility.

Well, if it's a static const you can:
Code:

//foo.h
class foo {
  static const float bar;
};
//foo.cpp
#include "foo.h"
const float foo::bar = 1.0;

AFAIK that will work.

Quote:


EDIT: The contents of include-fixed are as follows. I'm going to re-start from scratch just in case I missed a flag somewhere that caused fixincludes to mess up, but here are the contents in case I get the error again:
Code:

limits.h
README
syslimits.h


If you get this, that indicates that fixincludes was screwed up. If you look now you should see a *lot* more files. These are replacement headers that deal with the various errors in the actual headers
Quote:

EDIT 2: To anybody that's thinking of dealing with WPILib, I suggest adding the following flag in CMAKE_CXX_FLAGS to filter out all the deprecated string literal warnings. There's no way that anybody is going to go through the whole library and convert it to using std::string unless that have absolutely no life.
Code:

-Wno-write-strings

Agreed. This is an issue with vxWorks itself. Not much we can do here. If we wanted to we could add a rule to fixincludes, but I don't think a warning that we know to be spurious and can disable is worth the extra effort involved in getting accepted upstream or the complications of building patched source.
Quote:

EDIT 3: Build error was just a fluke. I have no idea what happened. Deleted my build directory, reconfigured and it worked. That was pretty stupid on my part. Sorry for the hassle on that one.
No problem. Sometimes GCC builds fail for random unknown reasons...
Quote:

EDIT 4: The virtual destructor warnings are legit. These are abstract classes with pure abstract methods, and the classes have derived classes. This means that if a derived class were to have an explicit destructor, it wouldn't be getting called. I'll be sure to fix those warnings in the next round of fixes.
And this is why we use compiler warnings! :D
Quote:

EDIT 5: The master branch on my git repository should fix many of the compiler warnings for wpilib on C++98 as well. I haven't tested compatibility with old versions of GCC yet though. I did leave some unnecessary typedef's in there because I think that they, at some point, were necessary, so WindRiver's version of GCC might still want them and I don't want to break compatibility with it. The C++11 branch has these changes pulled in as well.
Awesome!

CodeYeti 17-01-2013 14:21

Re: Alternate GCC Toolchain
 
So I'm getting better, but I'm still really stupid with debian packages. I've gotten the binutils installed, so I think I get the process for building these source packages. I downloaded a binutils tarball with wget and then added the debian directory from the git repository to the extracted folder (after renaming the original tarball to fit debian's naming scheme).

Now, I think I should probably install the wrs-headers-installer next, correct? How would I build that package? It's complaining that it can't find an upstream tarball (because I didn't download one). What am I supposed to do with that one? I tried ./debianize, but bash couldn't find dh_make.

Sorry for my noobyness in this area, I really just need to sit down and learn about aptitude a little more when I get the time.

EDIT: Looks like I've found the time, I'm just going through all the wiki pages and everything and doing a few examples with it. Just ignore the post, I'm sure I'll get it after just doing some learning. It's going to be more of a pain in the $@#$@#$@# in the long run to avoid spending the time learning it.

rbmj 17-01-2013 15:30

Re: Alternate GCC Toolchain
 
I'll upload the other files, which should help with building everything. These include .orig.tar.gz and .debian.tar.gz files IIRC.

The .orig files can be made with the following process with a git archive:

Code:

# in git archive for package $PKG
mkdir ../$PKG-$VERSION
git archive master | tar -x -C ../$PKG-$VERSION
cd ..
tar -cf $PKG_$VERSION.orig.tar $PKG-$VERSION
gzip $PKG_$VERSION.orig.tar
cd $PKG-$VERSION
debuild

Making these packages can be a pain in the rear. The debian/rules makefiles for gcc and wpilib are not code snippets I'm particularly proud of... but they work.

Also, if you make a mistake and the build dies, debian wants to completely rebuild the whole package from a distclean. So don't mess up when you're compiling GCC... you wouldn't believe how much time I wasted only to learn that I forgot to pass -e WIND_BASE to debuild...

CodeYeti 17-01-2013 16:53

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1217350)
I'll upload the other files, which should help with building everything. These include .orig.tar.gz and .debian.tar.gz files IIRC.

The .orig files can be made with the following process with a git archive:

Code:

# in git archive for package $PKG
mkdir ../$PKG-$VERSION
git archive master | tar -x -C ../$PKG-$VERSION
cd ..
tar -cf $PKG_$VERSION.orig.tar $PKG-$VERSION
gzip $PKG_$VERSION.orig.tar
cd $PKG-$VERSION
debuild

Making these packages can be a pain in the rear. The debian/rules makefiles for gcc and wpilib are not code snippets I'm particularly proud of... but they work.

Also, if you make a mistake and the build dies, debian wants to completely rebuild the whole package from a distclean. So don't mess up when you're compiling GCC... you wouldn't believe how much time I wasted only to learn that I forgot to pass -e WIND_BASE to debuild...

I did the same thing, luckily, the first thing I did was check the config.log!

Regardless, ironically, I've got this stuff running on my mac via a manual install much better than I do on debian with the packages, but I'd love to help with development, and I want to stay current so I'm trying to switch over. Right now, theres something broken where its not finding the C++ includes (i.e. #include <string> won't work, etc) and I have no idea why. If anybody has run in to this, I'd appreciate a tip. Debugging as you're reading.

Also, just as a thought, since your debian package for wpilib has a builddep for cmake, and AFAIK, just invokes it, why don't you just use CPack? Seems like that would be a little bit cleaner solution, but that's just me.

EDIT: Still having that issue with the packages. I'm going to try the packages you built and see if that makes a difference. Just to make sure, I've been installing them in this order:
Code:

binutils
wrs-headers
gcc
buildscripts

Any help is appreciated.

rbmj 17-01-2013 17:41

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1217419)
I did the same thing, luckily, the first thing I did was check the config.log!

Regardless, ironically, I've got this stuff running on my mac via a manual install much better than I do on debian with the packages, but I'd love to help with development, and I want to stay current so I'm trying to switch over. Right now, theres something broken where its not finding the C++ includes (i.e. #include <string> won't work, etc) and I have no idea why. If anybody has run in to this, I'd appreciate a tip. Debugging as you're reading.

Never seen that one... thanks for all your work testing/fixing/debugging!

Quote:

Also, just as a thought, since your debian package for wpilib has a builddep for cmake, and AFAIK, just invokes it, why don't you just use CPack? Seems like that would be a little bit cleaner solution, but that's just me.
Because CPack, though easy, doesn't handle dependencies, metadata, and maintainer scripts as nicely as the native toolchain does.

CodeYeti 17-01-2013 17:47

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by rbmj (Post 1217459)
Because CPack, though easy, doesn't handle dependencies, metadata, and maintainer scripts as nicely as the native toolchain does.

Alright. I didn't know it didn't have the capability to handle dependencies.

Also, I'm still having that same issue with not finding the C++ includes. <see above>

EDIT:If I'm asking a ton of questions, it's because this is more of a learning experience than a hardcore project for me :D.

EDIT 2: I installed the versions of the packages from your dropbox, and I'm still getting the c++ headers problem. The headers are in the exact same place as they are on my mac, where the whole system works (manual installs, no packages or anything).

rbmj 17-01-2013 17:56

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1217463)
Alright. I didn't know it didn't have the capability to handle dependencies.

Also, I'm still having that same issue with not finding the C++ includes. <see above>

Stupid question: do the directories specified by `powerpc-wrs-vxworks-gcc -print-prog-name=cc1plus` -v exist and have contents that make sense?

I don't know why that's not working...

Quote:

EDIT:If I'm asking a ton of questions, it's because this is more of a learning experience than a hardcore project for me :D.
That's great :). Though I don't see why things can't be hardcore projects and learning experiences at the same time! ;)

CodeYeti 17-01-2013 18:02

Re: Alternate GCC Toolchain
 
Well there's the problem. It appears to be looking for the includes in /usr/local instead of /usr. Here's the output from your line of bash.
Code:

ignoring nonexistent directory "/usr/local/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/include/c++/4.8.0"
ignoring nonexistent directory "/usr/local/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/include/c++/4.8.0/powerpc-wrs-vxworks"
ignoring nonexistent directory "/usr/local/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/include/c++/4.8.0/backward"
ignoring nonexistent directory "/usr/local/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/sys-include"
ignoring nonexistent directory "/usr/local/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/powerpc-wrs-vxworks/4.8.0/include
 /usr/local/lib/gcc/powerpc-wrs-vxworks/4.8.0/include-fixed
End of search list.

This might be due to if finding things in /usr/local/lib that it shouldn't because of remnants of old installed-from-source toolchains. I'll try to get rid of breadcrumbs and report back.

EDIT: I think there's a bug in the wrs-headers-installer package. It doesn't actually remove a bunch of stuff, and I get a warning about the directory not being removed because its not empty. Here's the output.
Code:

mcoffin@mlc-debian-i7990x:~/Downloads$ sudo dpkg -P powerpc-wrs-vxworks-binutils powerpc-wrs-vxworks-gcc powerpc-wrs-vxworks-buildscripts wrs-headers-installer
(Reading database ... 120972 files and directories currently installed.)
Removing powerpc-wrs-vxworks-gcc ...
Purging configuration files for powerpc-wrs-vxworks-gcc ...
Removing powerpc-wrs-vxworks-buildscripts ...
dpkg: warning: while removing powerpc-wrs-vxworks-buildscripts, directory '/usr/powerpc-wrs-vxworks/share' not empty so not removed
Removing wrs-headers-installer ...
Purging configuration files for wrs-headers-installer ...
Removing powerpc-wrs-vxworks-binutils ...
dpkg: warning: while removing powerpc-wrs-vxworks-binutils, directory '/usr/powerpc-wrs-vxworks' not empty so not removed
Processing triggers for man-db ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place


CodeYeti 17-01-2013 18:16

Re: Alternate GCC Toolchain
 
Well, after becoming pretty sure that I've removed all the breadcrumbs from having the compiler installed under /usr/local, I tried the process again, now it can't find any of the headers due to looking for them in /usr/local. Heres the new include search paths.
Code:

ignoring nonexistent directory "/usr/local/lib/../powerpc-wrs-vxworks/include/c++/4.8.0"
ignoring nonexistent directory "/usr/local/lib/../powerpc-wrs-vxworks/include/c++/4.8.0/powerpc-wrs-vxworks"
ignoring nonexistent directory "/usr/local/lib/../powerpc-wrs-vxworks/include/c++/4.8.0/backward"
ignoring nonexistent directory "/usr/local/lib/gcc/powerpc-wrs-vxworks/4.8.0/include"
ignoring nonexistent directory "/usr/local/lib/gcc/powerpc-wrs-vxworks/4.8.0/include-fixed"
ignoring nonexistent directory "/usr/local/lib/../powerpc-wrs-vxworks/sys-include"
ignoring nonexistent directory "/usr/local/lib/../powerpc-wrs-vxworks/include"

EDIT: Fixed this. I had old binaries in /usr/local/bin that were causing GCC to think that it was installed there.

EDIT 2: Only problem I'm having at the moment is cpack putting wpilib in the wrong spot. I'm trying to use cpack just to learn how to before reverting back to the regular packages. cpack seems to ignore CMAKE_INSTALL_PREFIX.

crynix 21-01-2013 07:36

Re: Alternate GCC Toolchain
 
Thank you for your work. I'll be mirroring the files at http://www.eshsrobotics.com/mirror/frctoolchain.zip

crynix 21-01-2013 22:21

Re: Alternate GCC Toolchain
 
Thank you for your work. I'll definitely be contributing to this project.

I'm mirroring your binaries on our team website http://eshsrobotics.com/mirror/frctoolchain.zip

I'll eventually set up a PPA.

CodeYeti 02-02-2013 15:47

Re: Alternate GCC Toolchain
 
Hi everybody. Just as an update, I've been dorking around with using lambda functions to define delegate math inline. For an example of the usage of a lambda function on a FIRST robot, take a quick look at the Loader::Loader(Joystick *) constructor in this file:
https://github.com/rmr662/temp-test-.../RMRLoader.cpp

Please note that this will only work with C++11.

CodeYeti 15-02-2013 01:07

Re: Alternate GCC Toolchain
 
Has anybody gotten the gcc-4.8 source package from experimental to build for powerpc-wrs-vxworks? It should work with a custom tarball but I want to know if anybody's done it before I delve into it and write a tutorial for no reason.

I thought I would get going on it since I just recently built my toolchain for arm-linux-gnueabihf.

I've managed to get at least the binutils to build for powerpc-wrs-vxworks with just the source package straight out of wheezy. I'll do some more testing when I get home, but as far as I can tell, the only major difference is going to be that internalization is enabled.

If anybody would like to help me out, I'll attach the binary package so you can give it a shot. Keep in mind that its not signed or anything as I'm not quite sure how that works yet.

If this does work with the rest of the toolchain, then we could update the dependencies for the other packages and deprecate the use of the custom package unless there's something that I'm missing.

http://temp-share.com/show/FHKdR60U6

codes02 16-02-2013 03:24

Re: Alternate GCC Toolchain
 
I've updated my build script to build a toolchain using a gcc snapshot and no patches to anything.

https://bitbucket.org/jmesmon/vxworks-gcc-patches

Keep in mind that this does delete quite a few directories, make sure you've read the script before using it.

Some caveats on this build and gcc in general:
  • I had to disable building of gcov via "inhibit_libc=true", the fixincludes don't work around it's use of open() or mkdir().
  • Setting WIND_BASE is still necessary (this is rather silly)
  • I haven't run this on a real robot. The only thing I've test built is here
  • I have set it to build libstdc++-v3, but I have no idea if that will work with vxworks.
  • I don't do any extraneous copying or symlinking. Issues with "coreip" are expected. Fixing these need changes to "-isystem" within gcc (coincidentally the same thing that hilariously wants WIND_BASE)

William Kunkel 16-02-2013 13:44

Re: Alternate GCC Toolchain
 
Hi everybody! I've been trying to get this built on my Gentoo box, but I've run into issues, and googling hasn't turned up anything. It compiles a few things, then I run into this:

Quote:

/bin/sh: MULTIDIR: command not found
/bin/sh: MULTIDIR: command not found
/bin/sh: MULTIDIR: command not found
In file included from /home/maraschinopanda/alt-gcc/gcc-build/gcc/include-fixed/unistd.h:13:0,
from ../../../gcc-master/libgcc/../gcc/tsystem.h:102,
from ../../../gcc-master/libgcc/libgcc2.c:27:
/home/maraschinopanda/alt-gcc/gcc-build/gcc/include-fixed/ioLib.h:148:21: fatal error: net/uio.h: No such file or directory
#include <net/uio.h>
^
compilation terminated.
Then the error cascades and make exits error code 2. Unfortunately, I don't know enough about GCC to diagnose the issue. Any pointers?

codes02 16-02-2013 14:41

Re: Alternate GCC Toolchain
 
Please Identify
  • the version of gcc used
  • the configure command used
  • the make command used

William Kunkel 16-02-2013 14:59

Re: Alternate GCC Toolchain
 
The output of gcc --version is:
Quote:

gcc (Gentoo 4.5.4 p1.0, pie-0.4.7) 4.5.4
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The configure command was:
Quote:

../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
And the make command was just
Quote:

make -j4
Thanks for the help!

codes02 16-02-2013 15:22

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by MaraschinoPanda (Post 1234413)
The output of gcc --version is:

Please indicate the version of the gcc source code you are building (not the version of gcc you are using to build it).

You may need to pass the location of the headers to gcc's configure command in "--with-headers" (unless you've copied them in place previously).

This isn't your current issue, but for "make" to work you'll need to do "make -j4 inhibit_libc=true" (--without-gcov doesn't appear to work, adding "inhibit_libc=true" actually prevents gcov from being built).

William Kunkel 16-02-2013 15:53

Re: Alternate GCC Toolchain
 
I'm sorry, I don't full understand what you're telling me to do. I'm not very familiar with the gcc build process. I've just been following the instructions rbmj posted at the beginning of this thread (although they had several issues which I had to correct). Are there other things I ought to be doing?

codes02 16-02-2013 16:12

Re: Alternate GCC Toolchain
 
What are the contents of gcc-master/gcc/DATESTAMP and gcc-master/gcc/BASE-VER?
  • the contents of these files gives us a good idea about what version of gcc you are trying to compile
  • the "gcc-master" portion is taken from the command outputs you have previously posted

Edit: Also, to really help, we need to know the complete steps you've taken in trying to build it (you mention you changed some things in rbmj's instructions).

Edit2: also, I'm only asking you for the version info so I can tell you to use a newer version. If you're not trying to build a recent _snapshot_ of gcc-4.8, failure is likely.

Edit3: FYI, I've used 4.8-20130210 successfully in the build script I posted http://www.chiefdelphi.com/forums/sh...1&postcount=86

Edit4: Looking back at rbmj's original instructions, he uses an archive of the current vcs version (via the git mirror on github), so it should be the latest version. This just means you probably missed something with the headers. I've found that doing the copy & symlink dance is completely unneeded, and omit it in my build script.

William Kunkel 16-02-2013 19:37

Re: Alternate GCC Toolchain
 
Sorry it took so long to respond. The sequence of commands I ran (cleaned up a bit without ls's and such) was the following. I added comments to every line I modified.

Code:

mkdir gcc-install-tmp
cd gcc-install-tmp

sudo mkdir -p /usr/powerpc-wrs-vxworks/wind_base
sudo mkdir -p /usr/powerpc-wrs-vxworks/include

sudo 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

# The file downloaded from github is called "master.zip",
# I'm not sure why he had gcc-master.zip
unzip master.zip

tar -jxvf binutils-2.22.tar.bz2
unzip updated_vxworks63gccdist.zip

mkdir -p $WIND_BASE/target

sudo cp -R gccdist/WindRiver/vxworks-6.3/host/. $WIND_BASE/host

# I switched these next two lines, because otherwise I'm trying to create
# a link to a file that isn't there yet
sudo cp -R gccdist/WindRiver/vxworks-6.3/target/h/. /usr/powerpc-wrs-vxworks/sys-include
sudo ln -s /usr/powerpc-wrs-vxworks/sys-include $WIND_BASE/target/h

sudo 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
sudo 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

# And this is where it fails
make -j4

The contents of gcc-master/gcc/DATESTAMP is:
Quote:

20130215
And the contents of gcc-master/gcc/BASE-VER is:
Quote:

4.8.0

codes02 16-02-2013 20:44

Re: Alternate GCC Toolchain
 
Your GCC is plenty recent (as I belatedly realized).

It's probably something to do with the copying and symlinking sillyness. I haven't set my own install up like that, rather, I let gcc's configure copy $WIND_BASE/target/h to $PREFIX/sys-include.

You could try that
Code:

export WIND_BASE=$(realpath -m gccdist/WindRiver/vxworks-6.3)
# configure gcc with an argument to --with-headers
--with-headers="$WIND_BASE/target/h"

Keep in mind that I've not tested anything that is built with the resulting toolchain (as I don't have a cRIO).

Edit: Make sure that you clear out /usr/powerpc-wrs-vxworks (your PREFIX) completely before trying again. Left over directory setups and files can cause issues.

William Kunkel 17-02-2013 12:59

Re: Alternate GCC Toolchain
 
Alright, I tried your suggestion. It got farther this time but now it's failing with this error:
Quote:

In file included from /home/maraschinopanda/alt-gcc/gcc-build/gcc/include-fixed/syslimits.h:7:0,
from /home/maraschinopanda/alt-gcc/gcc-build/gcc/include-fixed/limits.h:34,
from ../../../gcc-master/libgcc/libgcc2.c:1731:
/home/maraschinopanda/alt-gcc/gcc-build/gcc/include-fixed/limits.h:168:61: error: no include path in which to search for limits.h
#include_next <limits.h> /* recurse down to the real one */
^

codes02 17-02-2013 19:06

Re: Alternate GCC Toolchain
 
  • Did you completely remove PREFIX before reattempting the build?
  • Did you completely remove the build directory before rebuilding?
  • What was your complete configure line for gcc?

Edit: I tried building the current -9999/head/"master" of gcc via my buildscript and had no issues, I suspect that in your case one of the following is the problem:
  • --with-headers isn't right, potentially due to WIND_BASE not being set properly
  • some files/symlinks where left in PREFIX and are messing things up

William Kunkel 17-02-2013 23:11

Re: Alternate GCC Toolchain
 
I completely removed the PREFIX and build directories. I just pulled from the compressed files I downloaded again, to be safe. The configure line I had was:
Code:

../gcc-master/configure \
  --prefix=/usr \
  --target=powerpc-wrs-vxworks \
  --with-gnu-as \
  --with-gnu-ld \
  --with-headers="$WIND_BASE/target/h" \
  --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

And I had set $WIND_BASE to
Code:

$(realpath -m gccdist/WindRiver/vxworks-6.3)
per your post.

I also changed my make command from
Code:

make -j4
to
[CODE
]make -j4 inhibit_libc=true
[/code]
per your earlier suggestion.

The only useful information I have found about this was that it can sometimes be caused by missing glibc, but I do have the most recent version Gentoo considers stable.

Thanks for all the help so far!

codes02 17-02-2013 23:51

Re: Alternate GCC Toolchain
 
Just to be sure, you're letting the $(realpath ... ) bit expand when it is assigned to WIND_BASE, right? Meaning that you aren't using single quotes around it, and `echo $WIND_BASE` gives something like '/home/maraschinopanda/alt-gcc/gccdist/WindRiver/vxworks-6.3'?

Can you check that `ls $WIND_BASE` works from the directory you're calling gcc's configure from?

Also, I recommend not using /usr as your prefix (especially not when testing), as it is actually used by other programs and removing it will break your system. I prefer using ~/x-tools/wrs (I have some shell setup scripts that add all of ~/x-tools/*/bin to my path). Any unused path is fine (an one in your homedir has the benefit of not needing to install with root privileges).

Edit: Note that the glibc you have installed on your system is _not_ going to cause your issue, the compiler for vxworks that you are building does _not_ use glibc at all.

William Kunkel 18-02-2013 02:49

Re: Alternate GCC Toolchain
 
I didn't think glibc was the problem, but I thought it was worth mentioning. I didn't remove /usr itself, of course, but I did remove all of the changes the build made. However, I can see why it might be better to use another prefix. I did make certain that $WIND_BASE was doing what I expected. I could try recompiling with a temporary prefix.

rbmj 18-02-2013 19:01

Re: Alternate GCC Toolchain
 
Quote:

Originally Posted by MaraschinoPanda (Post 1234369)
Hi everybody! I've been trying to get this built on my Gentoo box, but I've run into issues, and googling hasn't turned up anything. It compiles a few things, then I run into this:



Then the error cascades and make exits error code 2. Unfortunately, I don't know enough about GCC to diagnose the issue. Any pointers?

That's an issue with include directories.

GCC wants <header dir>/wrn/coreip in the search path. The way this is solved is by putting the headers in /usr/powerpc-wrs-vxworks/sys-include and then symlinking /usr/powerpc-wrs-vxworks/include to sys-include/wrn/coreip

If you don't set WIND_BASE you'll get the "cannot compute suffix of object files" error (most likely) at configure time.


All times are GMT -5. The time now is 20:08.

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