Chief Delphi

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

rbmj 07-01-2014 10:26

Re: GCC 4.8 Toolchain
 
First off, an announcement. I've re-released GCC 4.8.2, and builds (for debian jessie amd64 - x86 has to wait until I get my build VM back online) are available on the repo. This one *might* also have std::thread working, but I haven't tested that. New windows builds will come out in the next couple of days when I get a chance to port the changes over and rebuild everything. Changes should be integrated into upstream hopefully before 4.9.

I don't have the source for the new WPILib (is there one? I can't find it on firstforge), so I haven't recompiled that yet. If someone can give me a link that should hopefully be pretty quick.

Quote:

Originally Posted by virtuald (Post 1317004)
So I got RobotPy to build successfully using the frcmake in the VM I made, but I've noticed that some of the output files are significantly larger than the binaries I built with Wind River. In particular, all of the SIP-based binaries seem to be much larger than they were previously, double or triple the size. Looking at the objdump output, there seems to be a lot more symbols in the new binaries compared to the old binaries, but it seems to be mostly C++ gibberish and duplicate symbols.

My suspicion is that something isn't getting stripped/munched from the object file properly, but I can't tell. For comparison purposes, I've attached the nivision.pyd binary output files if someone wants to compare them.

Additionally, I've checked in the CMake build files for RobotPy into the gcc48 branch of https://github.com/robotpy/robotpy.git .

The reason the binaries are so much larger is because in order to provide all the new features (incl c++11), we use our own libstdc++ instead of VxWorks' included libstdc++. This, along with some symbol trickery, allows us to have all the new features while not breaking all of the rest of the OS. It does cause some symbol bloat though. This is a tradeoff, and you should be aware of it, but I don't think anybody is running up against disk space constraints on the cRIO (are they?).

virtuald 07-01-2014 10:49

Re: GCC 4.8 Toolchain
 
Quote:

Originally Posted by rbmj (Post 1323049)
I don't have the source for the new WPILib (is there one? I can't find it on firstforge), so I haven't recompiled that yet. If someone can give me a link that should hopefully be pretty quick.

Here you go. not sure why they aren't posting it in the normal place: http://first.wpi.edu/FRC/c/update/Release/


Quote:

The reason the binaries are so much larger is because in order to provide all the new features (incl c++11), we use our own libstdc++ instead of VxWorks' included libstdc++. This, along with some symbol trickery, allows us to have all the new features while not breaking all of the rest of the OS. It does cause some symbol bloat though. This is a tradeoff, and you should be aware of it, but I don't think anybody is running up against disk space constraints on the cRIO (are they?).
Good to know. As far as I know, nobody has ran into the disk constraints yet. The python interpreter builds a dozen or so binaries (each binary module is its own binary), and I think the size is double (ish) what it was previously.

rbmj 07-01-2014 12:02

Re: GCC 4.8 Toolchain
 
Thanks, new WPILib is also up on the repo now! GIthub also has updated source.

rbmj 07-01-2014 18:19

Re: GCC 4.8 Toolchain
 
New Windows beta is up!

http://firstforge.wpi.edu/sf/frs/do/...stallers.beta1

The windows and debian amd64 builds should be all set up now for developing 2014 competition code! All WPILib fixes have been integrated, C++11 including *multithreading* seems to be working, and I have confirmation of working code on a real cRIO, so hack away.

As always, any bug reports or fixes are appreciated!

restouffer 07-01-2014 19:37

Re: GCC 4.8 Toolchain
 
We have run into a problem when using this cross-compile chain. We are able to generate the needed Makefiles using frcmake, and our program compiles, links, and deploys without any errors appearing in terminal. However, when the cRIO boots, the following error is displayed in netconsole and our driver station never shows Robot Code.
Code:

* Loading FRC_UserProgram.out: FRC_UserProgram
Warning: module 0xebb940 (FRC_UserProgram.out) holds reference to undefined symbol _ZN11CommandBase2oiE.
Warning: module 0xebb940 (FRC_UserProgram.out) holds reference to undefined symbol _ZN11CommandBase5motorE.
(unloading partially loaded module FRC_UserProgram.out)
...FRC_UserProgram failed to load.

Complete netconsole output

We made sure that we have the latest cRIO firmware installed on our cRIO-FRC II. Code deployed from WindRiver is recognized and runs. The program we are attempting to deploy is a very simple example program for one motor.

Running make in debug mode generates this log, which doesn't appear to have any errors. Our CMakeLists.txt is very simple, and based on the one from FIRST Forge

We are using the version of this cross-compile chain from Arch Linux's AUR. We worked on getting this working for about a month before the build season started, but now that the clock is ticking we are under pressure to either get this working this week or return to using WindRiver on Windows Vista.

Any ideas or pointers would be greatly appreciated.

virtuald 07-01-2014 19:50

Re: GCC 4.8 Toolchain
 
Quote:

Originally Posted by restouffer (Post 1323422)
We are using the version of this cross-compile chain from Arch Linux's AUR.

The package that you're using was released in December. You may need an updated version of the package if you're using a 2014 firmware.

rbmj 07-01-2014 19:51

Re: GCC 4.8 Toolchain
 
FYI, whenever you get undefined symbol errors, it's a good idea to run those names through powerpc-wrs-vxworks-c++filt to see what symbols are actually undefined in a slightly more human-readable form.

What you have is actually a problem with your code, not the toolchain.

You declare static variables in the CommandBase class, but you do not provide a translation unit for the compiler to place them in.

In english: Whenever you have something like this in a header:

Code:

class foo {
  static int bar;
};

You need to have something like this in _exactly one_ C++ file:
Code:

int foo::bar = 2;
See this for more: http://www.parashift.com/c++-faq/lin...data-mems.html

As an aside, though I'm glad to help out with issues on the arch toolchain, the Windows and Debian versions are much more mature (and the debian version works on mint, ubuntu, etc.) than the Arch toolchain and as I'm not an arch user I don't actually maintain that toolchain, but I don't release the updates for Arch and only have passing familiarity with its current status. Though I don't endorse using any alternate toolchain, even ucpp, unless you're sure you can handle the lack of support at competition, I would say that the debian and windows versions are significantly more competition ready.

restouffer 07-01-2014 20:10

Re: GCC 4.8 Toolchain
 
Thank you so much. We even looked at those variables because of the error message, but no one picked up on our omission.

Also, your caution about Arch is noted. I don't think we'll be using the Arch chain at the actual competition (unless things go very well), but we have a few very old computers that it runs rather well on that we've given out to the programmers for developing and testing.

calcmogul 08-01-2014 06:15

Re: GCC 4.8 Toolchain
 
I have been using the Arch Linux version of the toolchain for over six months and have submitted most of the bug fixes for it (I'm basically the official unofficial maintainer). My team and I have put it through extensive testing and used it at an off-season competition, so I'm confident that it's at least as stable as the Windows distribution, which my team also uses.

I submitted a pull request to the official package maintainer with the C++11 fixes and am working on one for the WPILib update, but he is pretty slow at merging any fixes and updates I submit. Furthermore, he usually forgets to publish them to the AUR. I may suggest taking over as the maintainer, but hopefully it won't take too long.

Nevertheless, I made a diff of the WPILib versions and there were no changes made that impact network communications or anything else vitally important (which is unfortunate considering I've found fatal, albeit obscure, bugs in NetworkTables); WPILib now uses standard typedefs for data types instead of the strange ones it used to define internally, a PIDGet method was added to the AnalogChannel class, and some calls to LiveWindow were changed. The old version also runs on the updated firmware based on what I've tested.

rbmj 08-01-2014 07:47

Re: GCC 4.8 Toolchain
 
Quote:

Originally Posted by mathmogul (Post 1323657)
I have been using the Arch Linux version of the toolchain for over six months and have submitted most of the bug fixes for it (I'm basically the official unofficial maintainer). My team and I have put it through extensive testing and used it at an off-season competition, so I'm confident that it's at least as stable as the Windows distribution, which my team also uses.

I stand corrected. You have been instrumental in stabilizing the windows toolchain as well, so thanks for that also!

Quote:

I submitted a pull request to the official package maintainer with the C++11 fixes and am working on one for the WPILib update, but he is pretty slow at merging any fixes and updates I submit. Furthermore, he usually forgets to publish them to the AUR. I may suggest taking over as the maintainer, but hopefully it won't take too long.

Nevertheless, I made a diff of the WPILib versions and there were no changes made that impact network communications or anything else vitally important (which is unfortunate considering I've found fatal, albeit obscure, bugs in NetworkTables); WPILib now uses standard typedefs for data types instead of the strange ones it used to define internally, a PIDGet method was added to the AnalogChannel class, and some calls to LiveWindow were changed. The old version also runs on the updated firmware based on what I've tested.
I've long been slightly annoyed at the lack of openness in the development in WPILib, and I'm on record on that in several places here. Right now it is very much an example of the cathedral model of open source development. But I'll leave that for other threads.

rbmj 13-01-2014 11:13

Re: GCC 4.8 Toolchain
 
Just an update:

The debian repo is now updated with i386 builds.

AMD64 and i386 both have tests indicating that std::thread and friends are working, so go do awesome multithreaded stuff!

rbmj 13-01-2014 11:39

Re: GCC 4.8 Toolchain
 
I have also created a wiki page for walking through any issues people have when migrating code from previous years (or this year from WindRiver) over to this toolchain. Please let me know if you need to make any changes other than those described in the document to get your code to work. Thanks!

The page can be found here: http://firstforge.wpi.edu/sf/wiki/do...n/wiki/Porting

rbmj 17-01-2014 08:13

Re: GCC 4.8 Toolchain
 
All,

One more announcement: I've generated the doxygen documentation for WPILib, available here. This is intended as a convenience (so we don't *all* need to generate documentation).

There's a lot in WPILib that's undocumented though - so as teams come across undocumented areas, please document them (if you have the necessary knowledge), and make a pull request. I'll regenerate the documentation, and everyone can immediately benefit.

I've also decided that I'm willing to throw out binary compatibility with stock WPILib, since that makes no sense as we always statically link. So, I'm willing to incorporate new features as long as they won't break any existing code at the source level. Any new additions also need to be worth the cost (extra code) - I'm not a fan of feature creep.

virtuald 08-02-2014 00:46

Re: GCC 4.8 Toolchain
 
I haven't tried debugging a binary built with this toolchain yet, but it looks like I'm going to play that game tomorrow. Some questions:
  • I suspect I'll need to tell cmake to build in debug mode, correct? Are some symbols still there in release mode?
  • Can/should I still use wind river to connect to the cRio and debug the program that way? Or is the only way to do it is using gdb? Or doesn't it matter
  • If I use wind river to debug, and build the program in debug mode, will it be able to do source level debugging, or are the symbols incompatible?

Thanks in advance!

calcmogul 08-02-2014 01:35

Re: GCC 4.8 Toolchain
 
Quote:

Originally Posted by virtuald (Post 1339512)
  • I suspect I'll need to tell cmake to build in debug mode, correct? Are some symbols still there in release mode?

When I do release builds, I have to append -s to the build flags manually in order for 10MB of symbols to be stripped from the executable. I only see a 2MB difference between debug and release builds otherwise. Based on that, I assume the necessary symbols are still included in release builds.

Quote:

Originally Posted by virtuald (Post 1339512)
  • Can/should I still use wind river to connect to the cRio and debug the program that way? Or is the only way to do it is using gdb? Or doesn't it matter

My intuition tells me it doesn't matter whether one uses Wind River or GDB for debugging since the executable's symbols are being munched the same way with either build environment; one would expect identical behavior. I know that GDB was used in conjunction with wireshark a while ago to reverse-engineer the WDB protocol; therefore, powerpc-wrs-vxworks-gdb has worked properly before. My last (failed) attempt at using it was over 6 months ago, but the remote target crash I experienced may have either been fixed since then or been entirely my fault.

Quote:

Originally Posted by virtuald (Post 1339512)
  • If I use wind river to debug, and build the program in debug mode, will it be able to do source level debugging, or are the symbols incompatible?

I have some guesses on this, but I can't with good confidence share them since I don't know how Wind River does its source level debugging. byteit101 (Patrick) may know more about it.


All times are GMT -5. The time now is 22:43.

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