![]() |
Re: Alternate GCC Toolchain
I've successfully compiled GCC and friends, and can use frcmake to compile robot code successfully. However, I can't seem to figure out how to compile another project that uses autotools (./configure), it always fails on trying to find pthreads, with the last screenfull saying "checking for pthread_***... no" and ending with 'configure: WARNING: "Don't know how to find pthread library on your system -- thread support disabled"'
I can however compile using frcmake pthread stuff, so I think its just a matter of a missing path/configuration here is my current command: Code:
LDFLAGS=-L/usr/powerpc-wrs-vxworks/lib/ CFLAGS='-I/usr/powerpc-wrs-vxworks/include/:/usr/powerpc-wrs-vxworks/sys-include/ -mcpu=603 -mstrict-align -mlongcall -nostdlib -ansi -Wall -DCPU=PPC603 -DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL' PATH=/usr/powerpc-wrs-vxworks/bin:$PATH ./configure --host=powerpc-wrs-vxworksUPDATE: I figured it out. configure was resetting my LIBS for several things, '-lm' for math, and '-lpthread' for pthreads. Is there a way to have it ignore these libraries since they seem to be built in? |
Re: Alternate GCC Toolchain
frcmake link for those (like me) who end up googling around.
Don't add the -L to LDFLAGS and that -I to CFLAGS : those are the defaults which the compiler will already use. The other CFLAGS _may_ be needed. Specifically the -m* options are probably needed, the -D* options depend on how funky vxworks' headers are, and the others could be omitted based on preference. I don't _think_ '-nostdlib' is needed, though I might be wrong on that. I tend to set PATH globally (in bashrc or otherwise), but setting it there is valid. Actually, instead of setting path, passing --prefix=/usr/powerpc-wrs-vxworks (in your case) probably makes more sense. Essentially, I'd try the following and then tweak it when it doesn't work because someone screwed up their build system. Code:
CFLAGS='-mcpu=603 -mstrict-align -mlongcall -DCPU=PPC603 -DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL' ./configure --host=powerpc-wrs-vxworks --prefix=/usr/powerpc-wrs-vxworksEdit: Digging a bit more, _WRS_KERNEL_, TOOL_FAMILY, and CPU are defined properly without the need for -D*. (CPU is PPC604 unless -mcpu=603 is passed, which is strange given the --with-cpu-PPC603 configure option was used) Potentially bringing it down to: Code:
CFLAGS='-mcpu=603 -mstrict-align -mlongcall -DTOOL=gnu' ./configure --host=powerpc-wrs-vxworks --prefix=/usr/powerpc-wrs-vxworks |
Re: Alternate GCC Toolchain
I must say, this is very cool. Has anyone gotten GDB or any debugging working yet?
|
Re: Alternate GCC Toolchain
Quote:
Here's an explanation of what the cmake-based buildchain does to link your robot code module: 1) links as normal, without any libraries 2) statically links in the standard library 3) runs a script called "munch" 4) links the output of (2) with the output of (3) 5) runs a script called stripsyms Note: The default build toolchain does (1) and (3) and then links them together An explanation for munch: this finds all of the constructors and destructors of global or static objects in the binary and creates a special vxworks data structure that will allow vxworks to run these. Also, with the new toolchain, we link the necessary standard libraries statically. In the default implementation, the standard libraries is linked dynamically, and vxworks already loads a copy of the standard library into memory, so your code sees these symbols and works. However, because of any incompatibilities between the old and new versions at a binary level, we include our own copy. This is where stripsyms comes in Stripsyms is necessary in order to localize (think hide) our copy of the vxworks standard library from the rest of the system. This way, when vxworks loads our code, it doesn't load the symbols from our copy of the standard library into memory, so the rest of the OS can pretend that our copy doesn't exist. This manual linking and processing is the reason why '-nostdlib' is necessary - don't want to prematurely link in something twice. It's not the most elegant way to do things, but it's the way that worked for me. At the end of the 2012 season I spent quite a bit of time fiddling with this, and it took a *long* time before I could finally get everything to cooperate and run successfully. Thus, any third-party code might require some special coaxing before it'll work on a real robot :( Also, I am relying on the community to test this project. It still hasn't been vigorously tested in a production environment using all the features and possible corner cases. Right now I am not a good maintainer as my time is severely limited and I do not have access to a cRIO to run code on :( I'm hoping that with a bit of testing, once GCC 4.8 is released this can be sufficiently mature to offer to teams as a stable alternative to the official toolchains and the UCPP project (a great project, but with different aims) for real robot code (not just to play with). Though, if anyone *is* using this on their robot, I'm eager to hear how it turns out! Also, as a bit of good news, my final patch for GCC got accepted (though for 4.8.1, not 4.8.0 :/). There's still no real support for any other languages (fortran is the closest I think, but when I tried to make it gcc's build system acts strangely). Don't worry though, that patch relates to a corner case in thread specific data, so for 99% of people 4.8.0 should be safe. Quote:
No, I haven't gotten GDB working. There's a couple of different ways to attack the issue, and I'm not sure what's best. |
Re: Alternate GCC Toolchain
Can you link to the patch that is going into 4.8.1?
|
Re: Alternate GCC Toolchain
It's uber trivial (has to do with neglecting to pass an argument to a function, that's it), but here you go: http://article.gmane.org/gmane.comp.gcc.patches/281127/
|
Re: Alternate GCC Toolchain
Alright, I got it to compile, but I think I might have issues. The cmake scripts depend on "/usr/powerpc-wrs-vxworks/lib/libstdc++.a" and "/usr/powerpc-wrs-vxworks/lib/libsupc++.a" existing, but post-install, they are nowhere to be found. Did I miss a step? Or are they added by the debian package that I cannot use?
|
Re: Alternate GCC Toolchain
So, it turns out I (or we) haven't actually been building with libstdc++-v3 enabled, because the flag is "--enable-libstdcxx" not "--enable-libstdc++-v3". As I'm pretty sure it was being built with 4.7.x, my guess is that the flag got changed in 4.8.
In short, this is my current gcc configure (I've also fiddled with static & shared, you could leave those as they were previously set if there are issues in practice): Code:
FLAGS_FOR_TARGET="-isystem $PREFIX/powerpc-wrs-vxworks/sys-include/wrn/coreip" |
Re: Alternate GCC Toolchain
I finally figured out what was wrong with the symlinking! In the second step, we make the directory "/usr/powerpc-wrs-vxworks/include". So, when we try to make a symlink with the same name later:
Code:
ln -s sys-include/wrn/coreip /usr/powerpc-wrs-vxworks/include |
Re: Alternate GCC Toolchain
Does anyone have an example of a CMakeLists.txt file for a robot project? I'm a little lost on what to do, and being able to see one would help greatly.
|
Re: Alternate GCC Toolchain
With my setup, I have:
Code:
cmake_minimum_required(VERSION 2.8) |
Re: Alternate GCC Toolchain
Thanks for the help!
|
Re: Alternate GCC Toolchain
Alright, one final thing. I seem to be missing "/usr/powerpc-wrs-vxworks/share/ldscripts/dkm.ld". Where is this supposed to come from? I didn't see it in any of the git repos and it didn't look like it was generated by any of the CMakeLists files. I'm probably missing something obvious.
|
Re: Alternate GCC Toolchain
It's generated by my wrs-headers-installer install script. You can see it near the bottom of that script. Link: https://github.com/rbmj/wrs-headers-...ebian/postinst
|
Re: Alternate GCC Toolchain
Has anyone been able to build this with Ubuntu 12.04? (x86_64)
I was able to build it fine on both of my Arch Linux machines, but no luck on Ubuntu. Here is one of the errors while compiling gcc-build (with "make -j4 inhibit_libc=true"): Quote:
|
| 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