NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Building software for NI Linux RT

@jtagg, great job completing the list - I must have done those things but forgot to write them down!

@Yosoydodo - great find ... I don't think I ever would have been able to figure that out.

This thread has a wealth of information in it.  I have compiled it down and added it to the FAQ.

0 Kudos
Message 11 of 29
(3,147 Views)

We've come a bit further in the end goal of installing SciPy on the 9068 and using it in scripts. There are still a couple of hurdles, but it seems to be close. Any other ideas are welcome.

These are the required packages:

numpy 1.7.2

scipy 0.13.3

BLAS and LAPACK

In the attached document is a little summary of where it's at. Essentially, all these building blocks are installed, but scipy cannot properly load within python.

In python:

>> import numpy

>> import scipy

-à OK

>> import scipy.linalg

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/usr/local/lib/python2.7/site-packages/scipy/linalg/__init__.py", line 157, in <module>

    from .misc import *

  File "/usr/local/lib/python2.7/site-packages/scipy/linalg/misc.py", line 5, in <module>

    from . import blas

  File "/usr/local/lib/python2.7/site-packages/scipy/linalg/blas.py", line 131, in <module>

    from scipy.linalg import _fblas

ImportError: /usr/local/lib/python2.7/site-packages/scipy/linalg/_fblas.so: undefined symbol: slamch_

It looks like there is a problem linking to BLAS properly. I know that LabVIEW has BLAS VIs. Is there any BLAS expertise within that could help here?

0 Kudos
Message 12 of 29
(3,147 Views)

@jtagg, it appears to me that lapack was not built with all of the support needed to use BLAS.  Did you build LAPACK on the 9068, or did you install a pre-built package from opkg (or another package manager)?

A google search revieled that several people were seeing this particular error when a shared library was not compiled correctly (or completely).  Could you post the command you used to compile LAPACK?

Edit: I didn't see the word doc - everything in there.  I don't think you want the LAPACK output to be a .a library, but a .so so Python can pull it in.  I'm thinking that is a good starting point.

-TD

0 Kudos
Message 13 of 29
(3,147 Views)

Thanks tduffy,

I'll let yosoydodo comment on more of the detail of the commands.

0 Kudos
Message 14 of 29
(3,147 Views)

I detail you the main operations a did  trying to install scipy on my compacRio. All operations have been performed directly on the CompcRio

I download the following versions in tgz format and unziped them in my home directory which is /home/admin:

     - numpy-1.7.2.tar.gz,

     - scipy-0.13.3.tar.gz

     - lapack-3.5.0.tgz

     - last version of BLAS available on http://www.netlib.org/blas/

Before compiling I removed g77 on my compacRio to avoid any conflict with gfortran.

To compile BLAS:

I simple make should make the job but I saw some people doing everything manually in the BLAS folder

     $ gfortran –O3 -std=legacy -fno-second-underscore –fPIC -c *.f         

     $ ar r libfblas.a *.o      

     $ ranlib libfblas.a

     $ rm –rf *.o

     $ export BLAS=/home/admin/BLAS/libfblas.a

To compile LAPACK in the LAPACK folder

     $ cp INSTALL/make.inc.gfortran make.inc

then in the make.inc file I changed the options:

     OPTS = -O2 -fPIC

     NOOPT = -O0 -fPIC

I continue with:¨

     $ make lapacklib

     $ make clean

     $ export LAPACK=/home/admin/LAPACK/liblapack.a


To compile numpy in the numpy folder:

     $ python setup.py build  --fcompiler=gnu95

    $ python setup.py install

To compile scipy I had first to remove the build of the subpackage "sparse" otherwise I get a segment fault during the compilation. Just go to the /scipy/scipy/setup.py file and comment the line config.add_subpackage("sparse") with a # in front. Then in the scipy folder

      $ python setup.py config_fc  --fcompiler=gnu95 build

     $ python setup.py config_fc --fcompiler=gnu95 install

As mentionned @jtagg, Python 2.7 runs perfectly and is able to import numpy and scipy. Once I try to import some functions using the BLAS or LAPACK library like the linear algebra module (import scipy.linalg) I get  ImportError: /usr/local/lib/python2.7/site-packages/scipy/linalg/_fblas.so: undefined symbol: slamch_

Python has an internal way to test the installation of numpy and scipy with the

>> numpy.test("full")

>> scipy.test("full")

You just need to install nose. This application is easy to install (python setup.py If I remember well)

The numpy test is just reporting an error concerning a zlib module which doesn t seem to be vital for me but the scipy test fails again with this undefined symbol issue.

Concerning the shared and static libraries, you see that I have to export two variables in the shell that are used during the scipy compilation. In the /usr/local/lib/python2.7/site-packages/scipy/lib/blas folder you find 2 .so libraries called cblas.so and fblas.so. They seem to be the shared version of the static version generated during the manual compilation.

I also wanted to install BLAS and LAPACK through the ATLAS bundle, but I need to turn off the cpu throttling. We have the posibilities to install the cpufreq-set utility with the standard opkg but the application doesn t have any effect. Has someone already try something in this direction?


0 Kudos
Message 15 of 29
(3,147 Views)

Yosoydodo,

The Zynq MPU core in the 9068 does not support dynamic CPU frequencies, it is set and does not change. If it did, that would be detrimental to the overall determinism of the system, making it far from "Real Time". What makes you say that there is dynamic changing of the CPU frequency?

0 Kudos
Message 16 of 29
(3,147 Views)

Hi BradM,

Nothing makes me think that there is a changing in the CPU dynamic. I just want to follow the installation procedure of the ATLAS bundle http://math-atlas.sourceforge.net/ which asks to turn off the CPU throttling http://math-atlas.sourceforge.net/atlas_install/node5.html. I was just wondering why the

cpufreq-info command doesn t give the actual frequency of the CPU (it works on my desktop PC). Anyway, the ./configure of ATLAS gives only a warning concerning this issue, but unfortunetely the installation failed after some time of compilation.

0 Kudos
Message 17 of 29
(3,147 Views)

the cpufreq_info command likely queries the /sys/ filesystem for current CPU frequency. Since these SoC's don't have cpufreq support (currently, even if there was it doesn't make sense to turn them on for most RT applications), there's nothing to query.

How did the compilation fail?

0 Kudos
Message 18 of 29
(3,147 Views)

I just did it once again now. I get a very long message but errors starts with:

gcc version 4.5.3 20110311 (prerelease) (GCC)

/usr/bin/gcc -V 2>&1  >> bin/INSTALL_LOG/ERROR.LOG

gcc: '-V' option must have argument

make[4]: [error_report] Error 1 (ignored)

/usr/bin/gcc --version 2>&1  >> bin/INSTALL_LOG/ERROR.LOG

tar cf error_ARMv732FPV3D16MACNEON.tar Make.inc bin/INSTALL_LOG/*

bzip2 error_ARMv732FPV3D16MACNEON.tar

bzip2: Output file error_ARMv732FPV3D16MACNEON.tar.bz2 already exists.

make[4]: *** [error_report] Error 1

make[4]: Leaving directory `/home/admin/ATLAS/BLDdir'

make[3]: *** [error_report] Error 2

make[3]: Leaving directory `/home/admin/ATLAS/BLDdir'

make[2]: *** [error_report] Error 2

make[2]: Leaving directory `/home/admin/ATLAS/BLDdir/bin'

cat: can't open '../../CONFIG/error.txt': No such file or directory

cat: can't open '../../CONFIG/error.txt': No such file or directory

make[1]: *** [build] Error 255

make[1]: Leaving directory `/home/admin/ATLAS/BLDdir'

make: *** [build] Error 2

0 Kudos
Message 19 of 29
(3,147 Views)

This is an example of a poorly-written makefile (collection, not sure if it's just one file or multiple). Does the package come with a "configure" script or something of the ilk? If so, did you run it?

0 Kudos
Message 20 of 29
(3,147 Views)