Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libadalang can't find module liblktlang #656

Closed
simonjwright opened this issue Nov 4, 2024 · 1 comment
Closed

libadalang can't find module liblktlang #656

simonjwright opened this issue Nov 4, 2024 · 1 comment

Comments

@simonjwright
Copy link

I have adasat, langkit and libadalang, all at v25.0.0, sources in parallel directories.
The libadalang build shares the langkit venv.

I build langkit with

    # Don't really want to clone adasat at <uncontrolled> version.
    rm -rf langkit/adasat
    ln -s $ADASAT_SRC langkit/adasat
    
    rm -rf build

    pip install -r requirements-pypi.txt

    pip install .

    # This is for the 25.0.0 branch, like 25.1, as used in ada_language_parser
    python                                      \
        manage.py                               \
        make                                    \
        --no-mypy                               \
        --generate-auto-dll-dirs                \
        --library-types=relocatable             \
        --gargs '-cargs -fPIC'
    
    # no --force in install-langkit-support
    gprinstall --prefix=$PREFIX --uninstall langkit_support || true

    python manage.py                        \
           install-langkit-support          \
           --library-types=relocatable      \
           $PREFIX

and libadalang with

    rm -rf build

    pip install --upgrade pip

    pip install wheel

    pip install -r requirements-pypi.txt

    python manage.py generate

    python manage.py                            \
           build                                \
           --build-mode=prod                    \
           --library-types=relocatable          \
           --disable-java

    python manage.py                            \
           install                              \
           --build-mode=prod                    \
           --force                              \
           --library-types=relocatable          \
           $PREFIX

which fails with

Successfully installed jsonschema-4.23.0 jsonschema-specifications-2024.10.1 referencing-0.35.1 rpds-py-0.20.1
Traceback (most recent call last):
  File "/Volumes/Miscellaneous3/aarch64/14.2.0-3/langkit/venv/lib/python3.9/site-packages/langkit/libmanage.py", line 736, in run_no_exit
    parsed_args.func(parsed_args, unknown_args)
  File "/Volumes/Miscellaneous3/aarch64/14.2.0-3/langkit/venv/lib/python3.9/site-packages/langkit/libmanage.py", line 333, in wrapper
    self.set_context(parsed_args)
  File "/Volumes/Miscellaneous3/aarch64/14.2.0-3/langkit/venv/lib/python3.9/site-packages/langkit/libmanage.py", line 779, in set_context
    self.context = self.create_context(parsed_args)
  File "/Volumes/Miscellaneous3/src/libadalang/manage.py", line 80, in create_context
    ctx = CompileCtx(
  File "/Volumes/Miscellaneous3/aarch64/14.2.0-3/langkit/venv/lib/python3.9/site-packages/langkit/compile_context.py", line 542, in __init__
    from langkit.lkt_lowering import load_lkt
  File "/Volumes/Miscellaneous3/aarch64/14.2.0-3/langkit/venv/lib/python3.9/site-packages/langkit/lkt_lowering.py", line 62, in <module>
    import liblktlang as L
ModuleNotFoundError: No module named 'liblktlang'

I note that, in spite of building them, the langkit build didn't install the python or lkt dynamic libraries; is that the problem? I do see the installed langkit_support.relocatable/liblangkit_support.dylib.

@pmderodat
Copy link
Member

Hello Simon,

Libadalang now indeed requires a full Langkit build (it is written using the Lkt language instead of the obsolete Python DSL). See Langkit’s README for the missing bits:

Install the Libpythonlang and Liblktlang support libraries:

$ (cd contrib/python && ./manage.py install $PREFIX --library-types=static,static-pic,relocatable --disable-all-mains)
$ (cd contrib/lkt && ./manage.py install $PREFIX --library-types=static,static-pic,relocatable --disable-all-mains)
$ pip install contrib/python/build/python
$ pip install contrib/lkt/build/python

I’ll close this for now, but please let us know if you need more help on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants