![]() |
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_baseThat 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! |
Re: Alternate GCC Toolchain
Quote:
Just like all those old mentors that volunteer for FIRST !! |
Re: Alternate GCC Toolchain
Quote:
|
Re: Alternate GCC Toolchain
Quote:
|
Re: Alternate GCC Toolchain
Quote:
|
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 foundWould it be possible to just zip the /usr/powerpc-wrs-vxworks folder so I wouldn't have to worry about it? |
Re: Alternate GCC Toolchain
Quote:
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... |
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... |
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 foundAlso included an overview of the powerpc-wrs-vxworks folder. |
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). |
Re: Alternate GCC Toolchain
Quote:
|
Re: Alternate GCC Toolchain
Quote:
Code:
/usr/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/bin/ld: |
Re: Alternate GCC Toolchain
Quote:
I can't seem to edit my original post anymore, so please do this or you will get errors... |
Re: Alternate GCC Toolchain
Ok, now it get this:
Code:
/usr/bin/powerpc-wrs-vxworks-c++ -nostdlib -r -Wl,-X -staticQuote:
Code:
/usr/lib/gcc/powerpc-wrs-vxworks/4.8.0/../../../../powerpc-wrs-vxworks/bin/ld: |
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 :) |
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!
|
Re: Alternate GCC Toolchain
Robot code build completes but gives this error:
Code:
alex@alex-U46SV:~/robot$ make |
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... |
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.
|
Re: Alternate GCC Toolchain
Quote:
Code:
-set(TOOLCHAIN_PREFIX "/usr/local/powerpc-wrs-vxworks")Code:
-set(VXWORKS_LIBGCC "/usr/local/lib/gcc/powerpc-wrs-vxworks/${GCC_VERSION}/libgcc.a") |
Re: Alternate GCC Toolchain
Quote:
Code:
In file included from /usr/powerpc-wrs-vxworks/wind_base/target/h/vxWorksCommon.h:200:0,Code:
/usr/powerpc-wrs-vxworks/sys-include/types/vxTypesBase.h:53:20: fatal error: stddef.h: No such file or directoryCode:
/usr/lib/gcc/powerpc-wrs-vxworks/4.8.0/includeQuote:
Code:
set(VXWORKS_LIBGCC "${TOOLCHAIN_PREFIX}/../lib/gcc/powerpc-wrs-vxworks/${GCC_VERSION}/libgcc.a") |
Re: Alternate GCC Toolchain
Quote:
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. |
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. |
Re: Alternate GCC Toolchain
Quote:
|
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 strippedThanks in advance for the help. |
Re: Alternate GCC Toolchain
Quote:
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 |
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)Code:
$ mkdir ../builddirfrcmake is a wrapper for cmake that adds on some command line arguments to make your life easier... Then, all you need is: Code:
$ makeNow, 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 :/ |
Re: Alternate GCC Toolchain
1 Attachment(s)
Forgot - these packages are signed with my public key. It's attached.
|
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?)
|
Re: Alternate GCC Toolchain
Quote:
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. |
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 |
Re: Alternate GCC Toolchain
Quote:
Quote:
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. |
Re: Alternate GCC Toolchain
4 Attachment(s)
Quote:
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. |
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 |
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. |
Re: Alternate GCC Toolchain
1 Attachment(s)
Quote:
|
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. |
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...
|
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. |
Re: Alternate GCC Toolchain
Quote:
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. |
Re: Alternate GCC Toolchain
Quote:
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 |
Re: Alternate GCC Toolchain
Quote:
|
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" {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. |
Re: Alternate GCC Toolchain
Quote:
|
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.
|
Re: Alternate GCC Toolchain
Quote:
|
Re: Alternate GCC Toolchain
Quote:
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. |
Re: Alternate GCC Toolchain
Quote:
|
Re: Alternate GCC Toolchain
Quote:
|
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. |
Re: Alternate GCC Toolchain
OK, I can confirm that it's a flag issue, not a compiler issue. Now just to determine which one...
|
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. |
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. |
Re: Alternate GCC Toolchain
Quote:
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. |
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. |
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/ldscriptsOnce 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. |
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. |
Re: Alternate GCC Toolchain
Quote:
Edit: I'm sorry, I started a new project and things worked just fine... |
Re: Alternate GCC Toolchain
Quote:
|
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).
|
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... |
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' |
Re: Alternate GCC Toolchain
Quote:
|
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. |
Re: Alternate GCC Toolchain
Quote:
|
Re: Alternate GCC Toolchain
|
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 .Also: should I just switch to the packages, even if I'm planning on actively developing if I find a bug/missing feature? |
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.
|
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': |
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 |
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. |
Re: Alternate GCC Toolchain
Quote:
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.hCode:
-Wno-write-stringsEDIT 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. |
Re: Alternate GCC Toolchain
Quote:
Well, if it's a static const you can: Code:
//foo.hQuote:
Quote:
Quote:
Quote:
Quote:
|
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. |
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 $PKGAlso, 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... |
Re: Alternate GCC Toolchain
Quote:
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 |
Re: Alternate GCC Toolchain
Quote:
Quote:
|
Re: Alternate GCC Toolchain
Quote:
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). |
Re: Alternate GCC Toolchain
Quote:
I don't know why that's not working... Quote:
|
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"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 |
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"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. |
Re: Alternate GCC Toolchain
Thank you for your work. I'll be mirroring the files at http://www.eshsrobotics.com/mirror/frctoolchain.zip
|
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. |
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. |
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 |
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:
|
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:
|
Re: Alternate GCC Toolchain
Please Identify
|
Re: Alternate GCC Toolchain
The output of gcc --version is:
Quote:
Quote:
Quote:
|
Re: Alternate GCC Toolchain
Quote:
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). |
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?
|
Re: Alternate GCC Toolchain
What are the contents of gcc-master/gcc/DATESTAMP and gcc-master/gcc/BASE-VER?
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. |
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-tmpQuote:
Quote:
|
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)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. |
Re: Alternate GCC Toolchain
Alright, I tried your suggestion. It got farther this time but now it's failing with this error:
Quote:
|
Re: Alternate GCC Toolchain
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:
|
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 \Code:
$(realpath -m gccdist/WindRiver/vxworks-6.3)I also changed my make command from Code:
make -j4[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! |
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. |
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.
|
Re: Alternate GCC Toolchain
Quote:
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