Libadalang python bindings from Alire

@Fabien.C do you know if it’s possible to use the python bindings with the version of libadalang in Alire? It seems that Alire only builds a static library that cannot be used by Python.

Also: Would it be possible to publish a package on pypi?

Hi!

I recently had a similar issue but managed to get the lal_playground working.

The solution is not optimal, but here’s what worked for me (I did this on macOS, but should be similar on Linux, just change .dylib to .so):

$ alr get libadalang

# change to libadalang crate directory
$ alr build --release -- -XLIBRARY_TYPE=relocatable

After the compilation of all the dependencies and the package itself finished, I manually copied the built shared libraries to inside my library path.

# change to $HOME/.local/share/alire/builds
# assumes no other crates present, otherwise filter
$ find . -name '*.dylib' -execdir cp {} /usr/local/lib \;

# change to libadalang crate directory
$ cp lib/relocatable/prod/libadalang.dylib /usr/local/lib

For the Python side of things, I used a virtualenv:

$ python -mvenv $HOME/env_lal
$ source $HOME/env_lal/bin/activate

# change to langkit_support crate directory
$ pip install -r requirements-github.txt
$ pip install -r requirements-pypi.txt
$ pip install ipython
$ pip install .

# change to libadalang crate directory
$ pip install ./python

Finally, to run the playground script:

$ source $HOME/env_lal/bin/activate

# change to libadalang crate directory
$ ./scripts/lal_playground <FILE>

Hope this helps :slight_smile:

Thanks, totally forgot about alr get!