NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Building software for NI Linux RT

Hi,

I'm looking for information on building linux software for the cRIO-9068. When looking for software, the first place I look is opkg. However, if the package is not available there it will need to be installed manually.

Let me take a concrete example (the case for which I'm looking for a solution):

opkg installs python 2.6

what if I want to install python 2.7?

In most cases, a linux tar.gz package needs to be decompressed, and then you simply run:

./configure

make

make install

Does opkg contain the required packages to install a complete C/C++ build environment? I've added gcc gcc-symlinks g++ g++-symlinks but will always run into errors trying to build. The error encountered is:

gcc: error trying to exec 'cc1': execvp: No such file or directory

for which I haven't found a fix yet.

What is the recommended way of doing this on NI Linux RT?

Do I have to go to a cross-compiling solution? Or is cross-compiling only faster and possibly more efficient?

The ultimate goal is to use Python with SciPy, preferably in their newer versions. Any ideas are welcome.

Regards,

jtagg

Message 1 of 29
(27,093 Views)

jtagg,

cc1 is, oddly, in the "cpp" package:

BradM@linuxgetsreal ~/temp/ontargettools/cpp $ ar p cpp_4.5-r37.1+svnr170880.9_armv7a.ipk data.tar.gz | tar tzvf - | grep cc1

-rwxr-xr-x root/root   9507160 2011-08-01 05:32 ./usr/libexec/gcc/arm-angstrom-linux-gnueabi/4.5.3/cc1

Install cpp from the repositories that we point to with the 2013 release and you should have what you need. Additionally, you may want to consider pointing the repositories at a more recent feed and see if they have the version of python already available for install, you may need to play the part of package manager (telling opkg to ignore dependecies and manually ensure that all dependencies are indeed installed, e.g. many tools will ask that glibc be at least 2.12, but this is not usually required)

Message 2 of 29
(10,573 Views)

Here are my notes from when I installed the gcc enviornment on the cRIO-9068 when I got it:

edit /etc/opkg/angstrom-base-feed.conf to look like:

    > vi /etc/opkg/angstrom-base-feed.conf

# To enable opkg repo feeds, uncomment the following lines.

src/gz angstrom-base http://us.feeds.angstrom-distribution.org/feeds/next/ipk/eglibc/armv7a/base/

save the file, and exit. (shift : wq <enter>)

remove the lock on libc6

    > opkg flag ok libc6

 

update libc6

    > opkg upgrade libc6

 

install gcc packages

    > opkg install gcc

    > opkg install gcc-symlinks

Install the needed files from the cpp package

          > opkg install cpp

          > opkg install cpp-symlinks

 

Install the standard C library

 

  > cd

          > opkg install libc6-dev -t .

note: you must cd to your home directory and then use the -t option to specificy the directory you are in.  This is because the default temp directory is not large enough to download the package to.

note: This may take some time as there are a number of dependancies that also need to be downloaded.

You can also use NI's Eclipse IDE enviornment to cross compile.  Here is a nice thread that was created back in July:

    https://decibel.ni.com/content/thread/17524?tstart=0

I have done both compiling on the cRIO and in Eclipse.  I much prefer the cRIO.

Hope that helps.

-TD

Message 3 of 29
(10,573 Views)

Hi jtagg,

Since the cRIO-9068 is technically an embedded system, I would not recommend doing any major builds on the device itself.  The reason being: you are severely limited by the amount of memory and storage space on the device and it will take a very long time to compile code.  When I compiled Python 2.7 for the cRIO-9068 I used a GNU/Linux PC that had a cross-compiler on it.  I matched the versions of available required packages for Python from the cRIO-9068 angstrom feed and then performed the compile.  Afterwards, I was able to copy everything over to the device and it worked just fine.  I did not update libc6 as it did not seem like there were any issues with the current version other than when I tried to install packages.  I just used the --nodeps flag with opkg and was very careful to ensure the rest of the dependencies were there.

The Python build on my PC took about 10 minutes, whereas compiling a couple of smaller C programs on the cRIO-9068 itself took me just as long.

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
0 Kudos
Message 4 of 29
(10,573 Views)

I would definitely go with tduffy's or BluesKnight's recommendation (with a slight preference for BK's), I was simply noting which package to install to get the missing binary.

0 Kudos
Message 5 of 29
(10,573 Views)

Hi BK and others,

Thanks for the answers.

Do we have any good tutorials on cross-compiling, or is there one that is particulary appropriate for Eclipse and the cRIO-9068?

0 Kudos
Message 6 of 29
(10,573 Views)

Hi jtagg,

We only have a couple of resources that show how to set up and work with the Eclipse IDE at the moment.  Since we do not offer technical support for modifying the system and it is still a new release, documentation on specific tasks exists but general cross-compilation documentation does not.  You can take a look at the Getting Started guide to learn and understand how the Eclipse IDE needs to be set up for cross-compilation and you can also look for external help on the more intricate matters.  Most of the documentation I have found on cross-compilation is external and specific to tasks I am trying to accomplish.  If you need some good cross-compilation information about Python, this external site on Cross-Compiling Python for Embedded Linux gave me a very good understanding and set of pre-made patches to work with. 

With cross-compilation, you just have to ensure you have the correct compiler toolchain.  If you install the C/C++ Development Tools for NI Linux Real-Time, Eclipse Edition, you should have a toolchain that will allow you to compile most things successfully for the cRIO-9068.  Additionally, if you are working on a GNU/Linux PC, you an look at Code Sourcery Lite 2010.09-50 from Mentor Graphics.  It seems to do a fine job making sure we can compile using the same library versions as those on the cRIO-9068.  Let me know if you have any further questions.

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
0 Kudos
Message 7 of 29
(10,573 Views)

Hi everybody,

I am a new user of the compactRio 9068 and I have some troubles to compile Python 2.7. I followed the first recipe of  tduffy and  the download process and installation of libc6 went fine. But once I try the classic ./configure in the Python2.7 folder I get :

<<configure: error: C compiler cannot create executables >>. Is there some additional operations to perform other than those detailed by tduffy.

Like jtagg my target would be to include the scipy library in a python 2.7  environment in the CompactRio. The main repository (http://feeds.angstrom-distribution.org/feeds/next/ipk/eglibc/armv7a/base/) provides only the numpy library that usually comes together with scipy. Someone knows an other repository which contains scipy or Python 2.7?

Thank you in advance...

0 Kudos
Message 8 of 29
(10,573 Views)

I finally managed to compile Python2.7 on the compactRio.

I had to make a symbolic link for  ligcc_s.so.1 to libgcc_s.so by runing the command in the /lib folder

>>ln -s libgcc_s.so.1 libgcc_s.so

and the standard commands : ./configure, ./make, ./make install, work without any obvious error. 

0 Kudos
Message 9 of 29
(10,573 Views)

I ran it again from a fresh system and checked which packages need to be present. This may be of use to others. Here is a recap without explanations. Bold has been added by me.

[activate repositories and update]

opkg flag ok libc6

opkg upgrade libc6

opkg install gcc gcc-symlinks

opkg install cpp cpp-symlinks

cd

opkg install libc6-dev -t .        (you'll want to remove the opkg-* folder afterwards as it may not work automatically)

opkg install binutils binutils-symlinks

opkg install make

ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so

cd ..../Python-2.7.6

./configure

make

make install

If you get some infinite loops or error messages related to timestamps, make sure the time is properly set on the device.

I hope this can help future users who wish to perform an install of Python 2.7 on the cRIO directly.

0 Kudos
Message 10 of 29
(10,573 Views)