Compiling and running Python code

Thread Tools Search this Thread
Top Forums Programming Compiling and running Python code
# 1  
Old 06-22-2011
Compiling and running Python code

Hey there,
First post here in the Unix forums, but I have used them a lot for research over the last year. Anyways, to why I'm here now:
I'm working on a project and I'll be using the AIS Parser SDK by Brian C. Lane (can't post the link, but google that and the first 8 links will be relevant) and I'll preferably do it in python. Why python? Mostly because it'll be easier than doing it in C. Problem is, I have no idea how to even get the included python code working. The included readme mentions using a buildit script compile the modules, but I can't seem to get the examples to work. Smilie
If you haven't figured out by now, I'm a python newbie. But as I stated above, doing this project in python would be easier than doing it in C (especially since regardless of which I choose, that's the language I'd be learning for the first time).
The one example I'm trying to get to work is in the sdk, located in the python/linux/examples/last_ais folder. Any help would be appreciated.
# 2  
Old 06-22-2011
What version of python do you use?
# 3  
Old 06-22-2011
Originally Posted by yazu
What version of python do you use?
Python 2.7.1+
# 4  
Old 06-22-2011
For deb-based linux, you need as root
apt-get install python-dev swig

(Maybe another common build packages like "build-essential" for Ubuntu).
Then run ./buildit from python/linux directory. If everything is ok you should copy 2 files and to the specific example directory and run an example.

Sorry for my English.
This User Gave Thanks to yazu For This Post:
# 5  
Old 06-22-2011
Thanks for the reply yazu. When I did as you suggested this happened:
gcc: ../../c/src/: linker input file unused because linking not done
aisparser_wrap.o: In function `SwigPyObject_str':
aisparser_wrap.c:(.text+0x1455): undefined reference to `__stack_chk_fail_local'
aisparser_wrap.o: In function `SwigPyPacked_print':
aisparser_wrap.c:(.text+0x1b0f): undefined reference to `__stack_chk_fail_local'
aisparser_wrap.o: In function `SwigPyPacked_repr':
aisparser_wrap.c:(.text+0x1bd4): undefined reference to `__stack_chk_fail_local'
aisparser_wrap.o: In function `SwigPyPacked_str':
aisparser_wrap.c:(.text+0x1c8f): undefined reference to `__stack_chk_fail_local'
aisparser_wrap.o: In function `SWIG_Python_ArgFail':
aisparser_wrap.c:(.text+0x2e42): undefined reference to `__stack_chk_fail_local'
aisparser_wrap.o:aisparser_wrap.c:(.text+0x44eb): more undefined references to `__stack_chk_fail_local' follow
ld: hidden symbol `__stack_chk_fail_local' isn't defined
ld: final link failed: Bad value

With a quick google search I found that I could add -fno-stack-protector as an option to the gcc command to avoid this stack smashing protection and it all worked and the examples worked as well. If there's a more elegant way around that error though, please let me know. Otherwise thanks for your help. Smilie
Also, your English seems fine.

[edit] Fixed some English of my own.

Last edited by pmd006; 06-22-2011 at 10:51 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

CRONTAB - one python script is not running

Hi! I'm using a RaspberryPi with standard Raspbian. Currently I'm working on some sort of weather station. For now I have three python scripts - one which is updating txt files for website - ( it will not be necessary in few next days so I'll delete it) , second one for updating... (4 Replies)
Discussion started by: bartocham
4 Replies

2. Shell Programming and Scripting

Compiling source code issue

Need assistance in compile a source code with PERL flags Compile source code CDFconvert-2.2.3 which requires Fortran 90,Perl interpreter , Perl/TK module , NetCDF library , Gempak I have all the above required libraries . Issue is when compiling the source code it looks for local... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

3. Programming

Running python script in cygwin

I have python installed here on windows: C:\Python27 and can run a script from the command line but would rather use cygwin. $ cd "C:\Users\cmccabe\Desktop\annovar" cmccabe@DTV-L2231M5J /cygdrive/c/Users/cmccabe/Desktop/annovar $ python Traceback (most recent call last):... (3 Replies)
Discussion started by: cmccabe
3 Replies

4. AIX

Strange problem running python program from within ant

Hello, I'm currently trying to port an ant based build to AIX 6.1. The build queries the underlying version control system (Mercurial) for some data, which works fine on other platforms (Linux, Solaris). However, on AIX the hg command fails to load python's md5 module when used in the build,... (1 Reply)
Discussion started by: dhs
1 Replies

5. Programming

Problems compiling code

I am trying to compile some code and getting lot of errors g++ -traditional -Wno-non-template-friend -Wno-deprecated -O3 -DNDEBUG -DREAL=float -DGetREAL=Getfloat -IbaseLib -Itommy -Iothers ./source/main/ -o raytrac ./source/main/ error: gendef.h: No such file or... (1 Reply)
Discussion started by: kristinu
1 Replies

6. Programming

Running programs from a Python script

Any idea how I can run a program from a phyton script? For example, in csh I will do $tpath/tsimplex base=$fbase data=$fdata restore=$frestore \ nxp=$nx nzp=$nz param=$param intp=$intp nlay=$nlay \ varp=$varp sigma0=$sigma maxiter=$maxiter tol=$tol \ ... (2 Replies)
Discussion started by: kristinu
2 Replies

7. Windows & DOS: Issues & Discussions

Problem compiling C++ Code in Cygwin

Hello everyone. I just recently installed Cygwin and I am running it under Windows 7. My problem is that I cannot seem to compile any C++ code with g++. I've tried to compile C Code using gcc and that works just fine. But Whenever I try to compile some C++ code, g++ throws a whole bunch of... (6 Replies)
Discussion started by: Anlex
6 Replies

8. UNIX for Dummies Questions & Answers

Compiling Code

Hi i am new to programming im having a bit of a problem i have installed kubuntu on my computer and i have wrote some code but when i go to compile it i get this error in the terminal ross@ubuntu:~/cp1$ g++ -ansi -pedantic array.cpp -o array ross@ubuntu:~/cp1$ array The program 'array' is... (3 Replies)
Discussion started by: RossMc
3 Replies

9. Programming

Error message of compiling a C code

Hi, Recently I have a C Code and i compile on my pc with gcc -D _t_1 -o a.out test.c It works fine for me on my pc. However, upon transferring the same code on Sun Solaris server, it breaks with the below message:- Undefined first referenced symbol ... (3 Replies)
Discussion started by: ahjiefreak
3 Replies

10. Solaris

Compiling and Running C Program on Solaris

Hello Guys, I am using Solaris Developer Express Edition 9/07, I am a beginner. Please tell me how to compile and execute a C program. Please give me your answers clearly, for the compilers cc,c89,c99. please....... reply to me. I not getting the answer anywhere.. Advance... (2 Replies)
Discussion started by: selva_ss
2 Replies
Login or Register to Ask a Question