bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Python Interface


From: enztec
Subject: Re: [Bug-apl] Python Interface
Date: Wed, 19 Jun 2019 06:55:39 -0600

On Wed, 19 Jun 2019 12:47:33 +0200
Dr. Jürgen Sauermann <address@hidden> wrote:

see pyenv below also

>
>
> On 6/19/19 12:12 AM, address@hidden wrote:
>
> maybe a bad link there? no links involved

the script should be python3.6-config and with a link to python3-config (on my 
source install at least)

> my python3-config is linked to python3.6-config mine is:
> eedjsa@server66:~$ which python3-config
> /home/eedjsa/.pyenv/shims/python3-config
> eedjsa@server66:~$ file `which python3-config`
> /home/eedjsa/.pyenv/shims/python3-config: Pascal source, ASCII text
>
> And its definitely NOT a Pascal program. It is in fact a bash script (and 
> also not a link).

karma 1 jurgen 0

> I cannot explain why all this is like it is, but I am not aware of any 
> wrong-doing on my part.
> All this tells me that python3-config is not yet a stable thing and therefore 
> using
> it in Makefile.am is not yet a good idea.
>
>
> or bad permissions/user ownership on the link target?  (python3.6-config)
>
> On Tue, 18 Jun 2019 22:30:03 +0200
> Dr. Jürgen Sauermann <address@hidden> wrote:
>
> I see. But the problem is this:
>
> 1. If I check for the presence of python3-config then it says:
>
> edjsa@server66:~/projects/juergen/apl-1.7$ which python3-config
> /home/eedjsa/.pyenv/shims/python3-config
>
>
> 2. But if I then call it then it fails:
>
> eedjsa@server66:~/projects/juergen/apl-1.7$ python3-config
> pyenv: pythonbash: asf: command not found

why running in pyenv  - should be in bash like you said  above   do you even 
have paths in pyenv?

my error would have been
bash: python3-config: command not found

>
> The `python3-config' command exists in these Python versions:
>   3.6.4
>
> Such behaviour makes it impossible to use it in a Makefle.am or to
> troubleshoot build errors caused by this behaviour. I believe that
> hard-wiring the path in Makefile.am is a more reliable approach.
>
> Best Regards,
> Jürgen
>
>
> eedjsa@server66:~/projects/juergen/apl-1.7$
>
> On 6/18/19 9:37 AM, Christian Robert wrote:
> It means that starting with python 3.6.4 (Python 3.6.4, Release Date: Dec. 
> 19, 2017)
> the program "python3-config" will be available forever to be used as helper 
> for configuration.
>
> it provides various clues as where are the includes and what is the extention 
> to be use in /usr/lib64/python3.n/lib-dynload/
>
> $ python3-config --includes
> -I/usr/include/python3.7m -I/usr/include/python3.7m
>
> $ python3-config --extension-suffix
> .cpython-37m-x86_64-linux-gnu.so
>
> so:
>
> cd /usr/lib64/python3.7/lib-dynload/
> ln -fs /usr/local/lib/apl/lib_gnu_apl.so gnu_apl$(python3-config 
> --extension-suffix)
>
> ls -ld gnu_apl*
> lrwxrwxrwx. 1 root root 33 Jun 18 03:28 
> gnu_apl.cpython-37m-x86_64-linux-gnu.so -> /usr/local/lib/apl/lib_gnu_apl.so*
>
>
> python 3.4 was released on 17-Oct-2012
> and is about 7 years old.
>
> Xtian.
>
>
> On 2019-06-17 16:49, Dr. Jürgen Sauermann wrote:
> Hi,
>
> thanks, good to know. My personal feeling is that Python configuration is an
> unportable mess. If I run *python3-config*, then I get:
>
> *pyenv: python3-config: command not found**
> **
> **The `python3-config' command exists in these Python versions:**
> **  3.6.4**
> *
> No idea what this means or why this is so.
> For that reason I prefer explicit settings rather than tools that "help" me
> getting things right.
>
> Best Regards,
> Jürgen
>
>
> On 6/17/19 9:27 PM, Christian Robert wrote:
> I made it work but only with some works
>
> Makefile.am from:
>
> lib_gnu_apl_la_CXXFLAGS += -I/usr/include/python3.4m
>
> to:
>
> lib_gnu_apl_la_CXXFLAGS += `python3-config --includes`
>
>
> then run: "autoreconf"
>           ./configure --with-python
>           make -j4
>           sudo make install
>
> then had to run as root:
>
> cd /usr/lib64/python3.7/lib-dynload/
> ln -f /usr/local/lib/apl/lib_gnu_apl.so 
> gnu_apl.cpython-37m-x86_64-linux-gnu.so
>
> *Note* the different target name. I made a hard link rather than a copy (cp), 
> matter of tastes.
>
>
>
> then it works!
>
> [xtian@FC-30:/usr/lib/python3.7] $ python3
> Python 3.7.3 (default, May 11 2019, 00:38:04)
> [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> import gnu_apl
> gnu_apl.exec("4 4⍴1+2")
> ### PYTHON RESULT CALLBACK ###
> 3 3 3 3
> 3 3 3 3
> 3 3 3 3
> 3 3 3 3
> (1, ([4, 4], [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]))
> gnu_apl.command(")WSID")
> 'IS CLEAR WS\n'
>
>
> Xtian.
>
> On 2019-06-17 05:40, Dr. Jürgen Sauermann wrote:
> Hi,
>
> I haven't tried Python 2.7 but it may work. I followed the instructions in
>
> *https://docs.python.org/3.3/c-api*
>
> I personally find *Python 2.7 *somewhat odd, so I never considered it.
>
> According to *./configure  --help:*
> *...**
> **  --with-python           enable to build python extension lib_gnu_apl.so**
> **...*
>
> so *--with-python* is the correct approach. Regarding the python version, you 
> can
> either:
>
> change *line 184* in *src/Makefile.am*:
>
> *lib_gnu_apl_la_CXXFLAGS += -I/usr/include/python3.4m*
>
> to reflect your Python version and then *autoreconf* and *./configure 
> --with-python* again,
> or something like:
>
> *CXX_FLAGS="-I/usr/include/python3.4m" ./configure**--with-python*
>
> Best Regards,
> Jürgen
>
>
>
> On 6/17/19 6:22 AM, Christian Robert wrote:
> If I configure with: --with-libpython_apl
> it says: configure: WARNING: unrecognized options: --with-libpython_apl
>
> If I configure with: --with-python
> it fail in #include <Python.h>   (no such file or directory)
> probably because of hard coded "-I/usr/include/python3.4m" which does not 
> exist on my system.
>
>
> this is because it try to compile with python3.4m  but on my system (fedora30)
> the installed pythons are:
>
> [xtian@FC-30:/home/xtian/gnuapl] $ python -V
> Python 2.7.16
>
> and
>
> [xtian@FC-30:/home/xtian/gnuapl] $ python3 -V
> Python 3.7.3
>
> You can probably invoke python3-config as in:
>
> [xtian@FC-30:/home/xtian/gnuapl] $ python3-config --help
> Usage: /usr/bin/python3.7m-x86_64-config 
> --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir
>
> [xtian@FC-30:/home/xtian/gnuapl] $ python3-config --includes
> -I/usr/include/python3.7m -I/usr/include/python3.7m
>
> [xtian@FC-30:/home/xtian/gnuapl] $ python3-config --libs
> -lpython3.7m -lcrypt -lpthread -ldl  -lutil -lm
>
>
> to figure-out where are the includes dirs and may be other dirs.
>
> I suppose this interface is NOT intended for python2 at all, and it's fine 
> with me.
>
> Xtian.
>
>
> On 2019-06-16 15:42, Dr. Jürgen Sauermann wrote:
> Hi,
>
> in following a suggestion by Kumar Ramanathan, I have created a Python 
> interface for GNU APL.
> With that interface you can execute APL code, create APL defined functions, 
> etc.  from Python.
> Similar to *libapl* for C/C++ or to the Erlang interface.
>
> See *README-10-python* for details.
>
> *SVN 1167*.
>
> Jürgen
>
>
>
>
>
>
>
>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]