Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Custom C++ Toolchain (http://www.chiefdelphi.com/forums/showthread.php?t=105877)

rbmj 27-06-2012 09:31

Re: Custom C++ Toolchain
 
OK, so a few slight changes to the build process.

headers-build.patch is no longer necessary. Instead, best solution (read: least kludgey) is to manually copy gccdist/WindRiver/vxworks-6.3/target/h to /usr/powerpc-wrs-vxworks/sys-include, and then symlink /usr/powerpc-wrs-vxworks/include to sys-include/wrn/coreip. Yes, this is less kludgey.

Actually all of the patches that are there have been deprecated. The latest GCC incorporates some, and there are others that fix things "better". These haven't been incorporated into mainline yet, but the main issue is that I'm going off to school and won't have internet until late august (no working around this either). So I'm hoping that somebody can make sure that the work is not lost and that these make it in. [1] is approved, but not yet committed, and handles all of the patches to the WRS headers inside of GCC through the fixincludes process. It is a patch series, of which every patch depends on the first in the series. [2] is also approved, but not yet committed, and allows one to force a build of libstdc++-v3 with --enable-libstdc++-v3 passed to configure. A fix for the first gcov issue (obvious) is at [3]. A fix for the second gcov issue (approved, not committed) is at [4]. With those things done correctly, a complete build works.

The other issue is that some of the targets appear to be mis-configuring themselves, as they are allowing implicit declaration of functions in the configure process, which results in bad detection of the target platform's available functions. Hopefully somebody can fix this :-D.

I'm looking for someone to take this over, at least until the regular school year starts, at which point I should be able to maintain everything again (at least for a little while).

[1]: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00382.html
[2]: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01525.html
[3]: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01508.html
[4]: http://gcc.gnu.org/ml/gcc-patches/2012-06/msg01548.html

I'm going to try and get one of the GCC maintainers to adopt this, but if the conversation doesn't say committed, then it means I wasn't annoying enough.

NOTE: if you look at a patch message and it says a certain file needs to be regenerated, then you'll need to do that otherwise things won't work. The configure files can be regened with autoconf2.64, and the fixincl.x file can be regened by going into the fixincludes directory of gcc and running ./genfixes.

nightpool 17-08-2012 17:26

Re: Custom C++ Toolchain
 
It would be nice if you put the realpath dependency more prominently in the first post. It doesn't come by default with Ubuntu (the most popular linux distribution, and common among newbies), and the error message when you don't have it is pretty opaque (It'll complain about it a few times, but start downloading anyway, only to fatal later.)

agartner01 27-09-2012 00:33

Re: Custom C++ Toolchain
 
2 Attachment(s)
I get the following error when running the make command.
Code:

couldn't read file "/usr/local/powerpc-wrs-vxworks/host/resource/hutils/tcl/munch.tcl": no such file or directory
(terminal.txt)
The frc_userprogram still appears to build. Is it alright to just ignore this error?

Edit: So I decided to try and deploy the frc_userprogram.out to the robot. I used the wput, reset the robot, and then on the driver station it said no robot code. I checked to make sure the program got on via the web-ftp interface. In addition to that, I also flashed the v43 image... Included is the output from the cmake and make commands.

rbmj 27-09-2012 07:11

Re: Custom C++ Toolchain
 
@agartner01: That's due to a bug in the installation, which will be fixed when I come out with a new release (I'm waiting on some patches upstream right now). Read flameout's post and see if that helps.

rbmj 27-09-2012 12:48

Re: Custom C++ Toolchain
 
Also, If you still have difficulty, please post NetConsole output. That usually helps. But because of some bugs in the cmake files you have to make those symlinks.

agartner01 27-09-2012 13:52

Re: Custom C++ Toolchain
 
Quote:

Originally Posted by rbmj (Post 1187533)
@agartner01: That's due to a bug in the installation, which will be fixed when I come out with a new release (I'm waiting on some patches upstream right now). Read flameout's post and see if that helps.

Alright, I added the symlinks. Everything appears to build alright now. But when I deploy, I still get the no robot code message on the driver station... I'm just building the simple template fyi...

EDIT: Somehow I managed to miss your message. I'll get the netconsole output and post it...

agartner01 27-09-2012 19:08

Re: Custom C++ Toolchain
 
3 Attachment(s)
Here's my netcosole output. There are two files. One without any program. One with the Simple Template deployed (built on linux).

Edit: I added the log from a normal WindRiver program too...

CodeYeti 28-09-2012 14:51

Re: Custom C++ Toolchain
 
I noticed that the last commits to the the repositories on github were quite a while ago despite the last posts in the thread being relatively recent. Are they still up to date?

agartner01 30-09-2012 23:54

Re: Custom C++ Toolchain
 
@rbmj any thoughts?

CodeYeti 17-10-2012 16:16

Re: Custom C++ Toolchain
 
To anybody that's still dealing with this, I've posted some reworking and numerous bugfixes to rbmj's cmake toolchain. Off of the top of my head:
  1. Fixed bug with whitespace in CMAKE_COMMAND path
  2. Moved WPILib to a cmake find module
  3. Added GCC version to the toolchain files configuration
The moving of WPILib to a find module adds a line of code to the CMakeLists.txt file for the actual robot project, but it makes sense. WPILib is not an integral part of VxWorks, and shouldn't be part of the toolchain. Rather, it is an optional library, and should be treated as one.

I'd also like to give a little shoutout to Ross Light's frctool, which I'm using to push the FRC_UserProgram.out file up to the cRIO.

I'm putting in a pull request to rbmj as we speak, but if anybody wants to see my changes now, and any future changes, my fork of cmake_vxworks can be found at https://github.com/mcoffin/cmake_vxworks.

agartner01 20-10-2012 21:17

Re: Custom C++ Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1190750)
To anybody that's still dealing with this, I've posted some reworking and numerous bugfixes to rbmj's cmake toolchain. Off of the top of my head:
  1. Fixed bug with whitespace in CMAKE_COMMAND path
  2. Moved WPILib to a cmake find module
  3. Added GCC version to the toolchain files configuration
The moving of WPILib to a find module adds a line of code to the CMakeLists.txt file for the actual robot project, but it makes sense. WPILib is not an integral part of VxWorks, and shouldn't be part of the toolchain. Rather, it is an optional library, and should be treated as one.

I'd also like to give a little shoutout to Ross Light's frctool, which I'm using to push the FRC_UserProgram.out file up to the cRIO.

I'm putting in a pull request to rbmj as we speak, but if anybody wants to see my changes now, and any future changes, my fork of cmake_vxworks can be found at https://github.com/mcoffin/cmake_vxworks.

Did you build the compiler or install the binaries? I've been trying to get this to work for some time now, without any success. Any thoughts? Anyone?

CodeYeti 22-10-2012 14:41

Re: Custom C++ Toolchain
 
Quote:

Originally Posted by agartner01 (Post 1191118)
Did you build the compiler or install the binaries? I've been trying to get this to work for some time now, without any success. Any thoughts? Anyone?

I built the compiler because I'm planning on adding support for other languages.

CodeYeti 26-10-2012 12:01

Re: Custom C++ Toolchain
 
Anybody that is using my repositories for the toolchain/cmake/wpilib should no longer have to create any symlinks to the munch.sh, strip_syms.sh scripts or the host directory. It was just a bug in where the cmake toolchain file was looking for them. I'll also write a little comprehensive "howto" on installing the toolchain. Please note that I have not yet tried putting this code onto the robot, but if what rbmj did works, this should as well.

I've also added gcc-4.7.2 support to the vxworks-gcc-patches repository. If you want to use gcc-4.7.2, you may even though it is experimental. Just checkout the gcc-4.7.2 branch after cloning in to the repository, then continue as normal.

Begin Simple Install Tutorial
First, we'll need to create a directory to do all of our building in. I use ~/workspace in my home directory, but thats just me. This is NOT, I repeat NOT where the toolchain and things are installed, so it doesn't need to be on the PATH or anything. Run the following commands to get all the projects "cloned" from github.
Code:

mkdir -p ~/workspace
cd ~/workspace
git clone git://github.com/mcoffin/vxworks-gcc-patches.git
git clone git://github.com/mcoffin/cmake_vxworks.git cmake-vxworks
git clone git://github.com/mcoffin/wpilib.git

You will now have the subdirectories "vxworks-gcc-patches", "cmake-vxworks", and "wpilib" under your workspace. The first thing to do is have the vxworks-gcc-patches project download and compile GCC for you.Run the following commands to do this.
Code:

cd vxworks-gcc-patches
sudo make install

If you don't get any errors, the toolchain should have installed to "/usr/local". Next, you'll need to set the WIND_BASE variable just to satisfy gcc.
Code:

export WIND_BASE=/usr/local/powerpc-wrs-vxworks/wind_base
Finally, you'll have to build WPILib, so that you can link it with your robot's code. For some reason, on one of my machines, I have to run cmake twice to get the install directory to be set properly. I would recommend doing just to make sure you don't install WPILib to some weird place.
Code:

cd ~/workspace/wpilib
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
make
sudo make install

Then, you'll have to write a simple CMakeLists.txt file to compile your robot code. Assuming your robot code is stored in a directory called 'src' under the CMakeLists.txt file, the following CMakeLists.txt will work. It would be really easy to modify this for your robot's needs.
Code:

cmake_minimum_required(VERSION 2.8)

project(FRC)
set(CMAKE_MODULE_PATH /path/to/cmake-vxworks/cmake/Modules)

find_package(WPILib REQUIRED)
include_directories(${WPILib_INCLUDE_DIR})

include_directories(src)
file(GLOB_RECURSE SOURCES "src/*.cpp")

add_executable(FRC_UserProgram ${SOURCES})
set_target_properties(FRC_UserProgram PROPERTIES
        SUFFIX .out
        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_link_libraries(${WPILib_LIBRARY})

Finally, change directory to your your robot's CMakeLists.txt file, run cmake the same way we did for WPILib, then
Code:

make
If you don't get any errors, then your program should be compiled to bin/FRC_UserProgram.out. This can then be pushed to the robot with Ross Light's frctool or just an FTP client.

PaulDavis1968 12-12-2012 03:12

Re: Custom C++ Toolchain
 
Quote:

Originally Posted by CodeYeti (Post 1191717)
Anybody that is using my repositories for the toolchain/cmake/wpilib should no longer have to create any symlinks to the munch.sh, strip_syms.sh scripts or the host directory. It was just a bug in where the cmake toolchain file was looking for them. I'll also write a little comprehensive "howto" on installing the toolchain. Please note that I have not yet tried putting this code onto the robot, but if what rbmj did works, this should as well.

I've also added gcc-4.7.2 support to the vxworks-gcc-patches repository. If you want to use gcc-4.7.2, you may even though it is experimental. Just checkout the gcc-4.7.2 branch after cloning in to the repository, then continue as normal.

Begin Simple Install Tutorial
First, we'll need to create a directory to do all of our building in. I use ~/workspace in my home directory, but thats just me. This is NOT, I repeat NOT where the toolchain and things are installed, so it doesn't need to be on the PATH or anything. Run the following commands to get all the projects "cloned" from github.
Code:

mkdir -p ~/workspace
cd ~/workspace
git clone git://github.com/mcoffin/vxworks-gcc-patches.git
git clone git://github.com/mcoffin/cmake_vxworks.git cmake-vxworks
git clone git://github.com/mcoffin/wpilib.git

You will now have the subdirectories "vxworks-gcc-patches", "cmake-vxworks", and "wpilib" under your workspace. The first thing to do is have the vxworks-gcc-patches project download and compile GCC for you.Run the following commands to do this.
Code:

cd vxworks-gcc-patches
sudo make install

If you don't get any errors, the toolchain should have installed to "/usr/local". Next, you'll need to set the WIND_BASE variable just to satisfy gcc.
Code:

export WIND_BASE=/usr/local/powerpc-wrs-vxworks/wind_base
Finally, you'll have to build WPILib, so that you can link it with your robot's code. For some reason, on one of my machines, I have to run cmake twice to get the install directory to be set properly. I would recommend doing just to make sure you don't install WPILib to some weird place.
Code:

cd ~/workspace/wpilib
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
cmake . -DCMAKE_TOOLCHAIN_FILE=/path/to/workspace/cmake-vxworks/vxworks_toolchain.cmake
make
sudo make install

Then, you'll have to write a simple CMakeLists.txt file to compile your robot code. Assuming your robot code is stored in a directory called 'src' under the CMakeLists.txt file, the following CMakeLists.txt will work. It would be really easy to modify this for your robot's needs.
Code:

cmake_minimum_required(VERSION 2.8)

project(FRC)
set(CMAKE_MODULE_PATH /path/to/cmake-vxworks/cmake/Modules)

find_package(WPILib REQUIRED)
include_directories(${WPILib_INCLUDE_DIR})

include_directories(src)
file(GLOB_RECURSE SOURCES "src/*.cpp")

add_executable(FRC_UserProgram ${SOURCES})
set_target_properties(FRC_UserProgram PROPERTIES
        SUFFIX .out
        RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

target_link_libraries(${WPILib_LIBRARY})

Finally, change directory to your your robot's CMakeLists.txt file, run cmake the same way we did for WPILib, then
Code:

make
If you don't get any errors, then your program should be compiled to bin/FRC_UserProgram.out. This can then be pushed to the robot with Ross Light's frctool or just an FTP client.


Is this different than this? : http://www.chiefdelphi.com/forums/sh...=109385&page=2

Thanks

PaulDavis1968 22-12-2012 20:53

Re: Custom C++ Toolchain
 
Just for a heads up. This all worked great. I did scratch my head on some installs I needed for a fresh Ubuntu install. Most are things that are listed in the other post. This one had me scratching my head when I built the WPILIB.

There is a program in a batch file that took me a minute to find that I needed. Once I read the error message and went through the batch script it became obvious.

export WIND_BASE=$(realpath "$WIND_BASE")

realpath had to be apt-get installed.

Then there is replacing /path/to

/home/paul but that is because I am stupid. :D

Thanks for the hard work.


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

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