Mahol Dot Org

Icon

Weblog For All Your Need

Cross Compiling Python 2.6.2 For ARM Cross Compiling Python for Embedded Linux

Tried to Cross Compile Python 2.6.2 For my ARM board, got success to successfully port python on ARM board, On ARM board Embedded Linux is already ported and running fine.

http://www.python.org/images/python-logo.gif ==>>  http://www.arm.com/images/site/arm_logo.gif

Here are simple steps to Cross compile python for ARM target board.

1) setup ARM tool chain with X11
2) export PKG_CONFIG_PATH

install dependencies
====================

Dependencies taken from DEBIAN
——————————
1) libdb
copy

2) libsqlite3
copy and change prefix in sqlite3.pc

3) ncursesw
copy

Dependencies installed from source
———————————–
1) bzip2
edit Makefile

CC=arm-linux-gcc
AR=arm-linux-ar
RANLIB=arm-linux-ranlib
PREFIX=your_toolchain_prefix_path

make
make install

2) gdbm
./configure –host=arm-linux –target=arm-linux –prefix=/xxx/yyy –enable-shared
make
make install
3) tcl-8.4.19
cd to unix folder

export ac_cv_func_strtod=yes
export tcl_cv_strtod_buggy=1

CC=arm-linux-gcc ./configure –host=arm-linux –prefix=/xxx/yyy

make
make install DESTDIR=/xxx/yyy

Note: dont install in prefix otherwise tk is not compiling.

4) tk-8.4.19

./configure –host=arm-linux CC=arm-linux-gcc
–prefix=/xxx/yyy –with-tcl=<path to unix folder in source of tcl>

make

make install

Note: you may have to move X11R6 from toolchain to /usr because its looking  in /usr for the X11 libs. if you do so remember to take backup of your /usr/X11R6 and then restore when you are done cross compiling python. Later find out why Makefiles are looking for X11R6 in /usr and change the path in those Makefiles..

5) readline-6.1
./configure
make
make install

6) openssl-0.9.8
There is no need to type configure, a Makefile is already existing. We just need to edit it and change it with way:

INSTALLTOP=/opt/external_packages/openssl/0.9.8g/compiled/xxx-yyy-linux-gnu
OPENSSLDIR=/opt/external_packages/openssl/0.9.8g/compiled/xxx-yyy-linux-gnu

CC= xxx-yyy-linux-gnu-gcc
AR=xxx-yyy-linux-gnu-ar $(ARFLAGS) r
RANLIB= xxx-yyy-linux-gnu-ranlib
To compile and install the OpenSSL project, type successively make and make install. You should find the directories and files listed above under /opt/external_packages/openssl/0.9.8g/compiled/xxx-yyy-linux-gnu/.

change pkg-config files

Patching Python-2.6.2 before crosscompile
—————————————–
1) ./configure
2) make python Parser/pgen
3) mv python hostpython
4) mv Parser/pgen Parser/hostpgen
5) make distclean

6) apply the patch Python-2.6.2-xcompile.patch
patch -p1 < Python-2.6.2-xcompile.patch

7) In Modules/Setup.config and setup.py according to
Setup.config and setup.py (TODO: make patches for setup.py and Setup.config).
8) edit Modules/getaddrinfo.c and change “u_” to “unsigned ”

Compiling Python-2.6.2
———————-
CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar RANLIB=arm-linux-ranlib ./configure –host=arm-linux –build=i686-pc-linux-gnu –prefix=/xxx/yyy
make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED=”arm-linux-gcc -shared” CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes
make  install HOSTPYTHON=./hostpython BLDSHARED=”arm-linux-gcc -shared” CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes prefix=~/Python-3.1.2

Dependencies – Setup.config and setup.py are configuration files are required to be modify for ARM board.

Downloads required for Cross Compiling Python for Embedded Linux

  1. Setup.config
  2. setup.py

Note -Rename python_setup_file to setup.py
Links -  Download Python

python corss compile patch used.

number of view: 53

Possibly Related Posts:


Ifort -extend-source Option Errors & Fortran Fixed Formatting Use nofree

Problem Definition
Working on FORTRAN source code migrations from Solaris operating system to windows XP.  Fortran being most portable code so most of the time we do not see any problems while porting fortran code, but there is always problem with columns length exceeds to default value and while compilations we forgot to take care of option extend-source.

Intel® Fortran compiler(ifort) – Option -extend-source

       -extend-source [size]
	      Specifies the column number to use to end the  statement	field
	      in  fixed-form source files. [size] can be 72, 80, or 132.  The
	      default behavior is -noextend-source, which implies column  72.
	      If  you  do  not	specify	 size,	it  is the same as specifying
	      -extend-source 132.

source ifort help or man ifort

Solution
The Makefile has a compiler flag called /extend_source:132, which basically extends the number of columns the Fortran compiler looks at. The default value is 72. /extend_source extends the number of columns that the compiler looks at to 132.

Fortran generally uses something called as Fixed Formatting - which takes 72 valid columns, ignores the rest and also considers tabs and spaces as comments inside a statement field.
/nofree tells the compiler that fixed formatting needs to be used. Most of the time code follows fixed formatting.

TO remove all compiler errors which pertain to syntax errors at Format statement just add some variable in your makefile, like
COLEXTEND=/extend_source:132

And when facing problem while compiling any fortran module in Windows just compile with COLEXTEND= /nofree.

example of make command, assuming windows makefile name as win.make

on command prompt type : nmake /f win.make COLEXTEND=/nofree

Good luck and do comment your experiences as well.

Related problem regarding

-extend-source option

number of view: 36

Possibly Related Posts:


How To Capture X Protocol Traffic Using Wireshark On Windows XP?

This is an experiment about use wireshark to capture X protocol traffic

Google and the wireshark manual/wiki give no hints (ie. How do you capture DISPLAY=:0.0 traffic ?). Setting wireshark to capture “local” (127.0.0.1) or “any” devices captured nothing. The remote X11
server
doesn’t support XRandR so it’s no help.

If you set DISPLAY=localhost:0 then the client will use TCP on the
loopback interface and wireshark can capture that. Of course your X
server can’t be running with “-nolisten tcp”, which is default in many
installations. thanks to Xcb thread discussion

Challenges
I want to capture localhost traffic on Windows Xp machine with Wireshark, and it fails.
Did google on it about Is there a way to get wireshark to capture packets sent from/to localhost on Windows?
Got this info from WIKI Loopback capture setup
Which says I need to install Loopback adapter and steps here for Microsoft: How to install the Microsoft Loopback adapter in Windows XP

This method did not help much expect able to capture only ARP packets,

Capturing local traffic on Windows XP Route method
> route add 155.132.130.129 mask 255.255.255.255 155.132.130.1 metric 1
where 155.132.130.129 is your local IP, and 155.132.130.1 that of your default gateway. You must have “Advanced TCP/IP Settings > Automatic metric” disabled! What it does is basically force each packet intended for localhost to go out to the default gateway first, from which it will come back again. Of course this means you see each packet twice.

===Not directly, but if you are on a network with a gateway, you can use the
command-line ROUTE command to redirect the packets through the gateway, which will bounce the packets back at your machine so Ethereal/Wireshark can capture them.  You can use comview tool. It can fullfil your wish. Wireshark does not use IM driver but it uses protocol driver.

Still digging on How To Capture X Protocol Traffic Using Wireshark On Windows XP?

number of view: 13

Possibly Related Posts:


How To Capture X Protocol Traffic Using Wireshark On Windows XP

This is an experiment about use wireshark to capture X protocol traffic

Google and the wireshark manual/wiki give no hints (ie. How do you capture DISPLAY=:0.0 traffic ?). Setting wireshark to capture “local” (127.0.0.1) or “any” devices captured nothing. The remote X11
server
doesn’t support XRandR so it’s no help.

If you set DISPLAY=localhost:0 then the client will use TCP on the
loopback interface and wireshark can capture that. Of course your X
server can’t be running with “-nolisten tcp”, which is default in many
installations. thanks to Xcb thread discussion

Challenges
I want to capture localhost traffic on Windows Xp machine with Wireshark, and it fails.
Did google on it about Is there a way to get wireshark to capture packets sent from/to localhost on Windows?
Got this info from WIKI Loopback capture setup
Which says I need to install Loopback adapter and steps here for Microsoft: How to install the Microsoft Loopback adapter in Windows XP

This method did not help much expect able to capture only ARP packets,

Capturing local traffic on Windows XP Route method
> route add 155.132.130.129 mask 255.255.255.255 155.132.130.1 metric 1
where 155.132.130.129 is your local IP, and 155.132.130.1 that of your default gateway. You must have “Advanced TCP/IP Settings > Automatic metric” disabled! What it does is basically force each packet intended for localhost to go out to the default gateway first, from which it will come back again. Of course this means you see each packet twice.

===Not directly, but if you are on a network with a gateway, you can use the
command-line ROUTE command to redirect the packets through the gateway, which will bounce the packets back at your machine so Ethereal/Wireshark can capture them.  You can use comview tool. It can fullfil your wish. Wireshark does not use IM driver but it uses protocol driver.

Still digging on How To Capture X Protocol Traffic Using Wireshark On Windows XP?

number of view: 7

Possibly Related Posts:


GPAT 2010 Result | GPAT Result | 10th Marks | GMAT 2010 Result at www.gpat.in

Graduate Pharmacy Aptitude Test is an all India Examination to be conducted by The Maharaja Sayajirao University of Baroda, Vadodara on behalf of All India Council for Technical Education, New Delhi.

The M.S.University of Baroda, Vadodara is the sole authority for conducting GPAT-2010 examination through out the country and declaring the result for the year 2010.

gmat 2010 result, gpat 2010 results, gpat, gpat results, gpat 2010 result, gpat, gpat 2010, 10th marks, ssc results 2010 andhra pradesh marks, 10th cbse results.

GPAT 2010 results at http://www.gpat.in/index.php?gpat=GPAT_Results

The Co-ordinator, GPAT 2010

The M.S.University of Baroda,
Shri. G.H. Patel Pharmacy Building
Opp: University Main Office
Donors’ Plaza, Fatehganj,
Vadodara – 390 002
Ph (O) (0265) 2750821,
FAX : (0265) 2418927

number of view: 4

Possibly Related Posts:


Cricket Script To Get Score From Cricinfo

###############
score.awk file
###############
#!/bin/sh
#
# Desktop Ticker
#
# dependencies —
# 1) links (‘lynx’ can also be used with slight modification in the script)
# 2) kdialog (comes with kde. script can be modified to use ‘xosd’, which will make it workable on any machine running X)
# 3) score.awk (awk file responsible parsing. contents of the file is pasted below the script)
#
#
# Instructions to use —
# 2) In ‘url’ variable only thing which is to be changed is the number before ‘.html’. The match number of currently running match can be obtained from

http://www.cricinfo.com

url=”http://content-ind.cricinfo.com/wc2007/engine/match/247464.html?view=scorecard;wrappertype=mainframe

while [ 1 ]
do
links -enable-javascript 0 -dump $url > dump
info=`cat dump | awk -f score.awk | tail -3`
kdialog –passivepopup “$info” 30
#echo “$info” > dump
#osd_cat -f -adobe-times-medium-r-normal-*-20-*-*-*-p-*-iso8859-1 -s 1 -o 30 -d 30 -i 0 dump
done
###############
score.awk file
###############
/innings/ {if($2 == “innings”) print $1, $2}
/not out/ {if($1 == “captain”) print $2, $3, “\t”, $6, $7, $8, $9, $10;
else if($1 == “wicket-keeper”) print $2, $3, “\t”, $6, $7, $8, $9, $10;
else print $1, $2, “\t”, $5, $6, $7, $8, $9;}
/Total/ {print $0}

number of view: 8

Possibly Related Posts: