I want to use function OPAC from this source code: http://opalopacity.llnl.gov/codes/xztrin21.f
i don't uderstand the code very well, I just want to use it as Python module. I run the following:
f2py -c xztrin21.f -m opal_opacity
but I always get this error:
/tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.c:1819:71: error: expected ‘;’, ‘,’ or ‘)’ before ‘!’ token
/tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.c: In function ‘f2py_init_cst’:
/tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.c:1828:35: error: ‘f2py_setup_cst’ undeclared (first use in this function)
/tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.c:1828:35: note: each undeclared identifier is reported only once for each function it appears in
/tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.c:1819:71: error: expected ‘;’, ‘,’ or ‘)’ before ‘!’ token
/tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.c: In function ‘f2py_init_cst’:
/tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.c:1828:35: error: ‘f2py_setup_cst’ undeclared (first use in this function)
/tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.c:1828:35: note: each undeclared identifier is reported only once for each function it appears in
error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/tmp/tmpWe2VM7/src.linux-x86_64-2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c /tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.c -o /tmp/tmpWe2VM7/tmp/tmpWe2VM7/src.linux-x86_64-2.7/opal_opacitymodule.o" failed with exit status 1
I don't think there's really anything wrong with the code. I believe others got it working alright, so I guess I must have a wrong Fortran complier or something. I'm not sure what to do about it though.
Any help apprecitated
edit: if I try to compile the code with gfortran I get following:
xztrin21.f:1025.72:
IF (H.EQ.0.) PAUSE 'Bad XA input.'
1
Warning: Deleted feature: PAUSE statement at (1)
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
So I solved the problem by creating a signature file first. I ran command
and than
and it works fine now. I used this tutorial: http://docs.scipy.org/doc/numpy/user/c-info.python-as-glue.html