Bonsoir, hope that you're all doing well.
I am trying to evaluate langkit, aiming to simplify
the development of an LSP and a set of linters/formaters for a DSL. I struggled
getting it to build, here is a lengthy summary of what I encountered and where I stopped.
The documentation recommends GNAT Community 2021.
As I was surprised that this was the latest release of GNAT, I found the blogs
mentioning alire being the recommended way to get gnat, so I gave it a try that way, on macOS.
I did a manual setup of alire for langkit and added a dependency to
langkit_support, trying to avoid having to build it.
I would have a hard time bringing the entire Ada toolchain to our devenvs,
and aimed to build as little as possible, hopefully requesting a small set to
be released (in pip using a bdist ? <3) if the eval was successful.
In the created alire.toml :
[[depends-on]]
langkit_support = "^24.0.0"
I realized that default compilation with manage.py was still trying to compile
langkit_support, I found the --no-langkit-support option to bypass it.
Suggestion : Separating langkit_support out of the dependency list might be justified given
that it's expected to be built.
Moving forward I was stumbling upon an error caused by xmlada_shared.gpr not
found from the xmlada lib. I was using the one brought in by langkit_support.
xmlada_unicode.gprxmlada_unicode.gpr:24:06: imported project file "../xmlada_shared.gpr" not found
xmlada_unicode.gpr:24:06: imported by "/Users/bourgeoisclement/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/b0131ab91b91aa28704f2c86cc19d71588851835808f51b4132600c1599b3c69/unicode/xmlada_unicode.gpr"
xmlada_unicode.gpr:24:06: imported by "/Users/bourgeoisclement/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/b0131ab91b91aa28704f2c86cc19d71588851835808f51b4132600c1599b3c69/distrib/xmlada.gpr"
xmlada_unicode.gpr:24:06: imported by "/Users/bourgeoisclement/.local/share/alire/builds/libgpr_24.0.0_d9c96bda/9098d495aeffac6e11d3d93c6b8c5c10b8181054d2fc132f3bf2a0f70303aa83/gpr/gpr.gpr"
xmlada_unicode.gpr:24:06: imported by "/Users/bourgeoisclement/.local/share/alire/builds/gnatcoll_24.0.0_11c512d1/47cf7d7e8a2b7b3c0e9536d64ef2252d7e51940df5bfe09d9251db5741773a95/gnatcoll.gpr"
xmlada_unicode.gpr:24:06: imported by "/Users/bourgeoisclement/repos/langkit/contrib/lkt/build/liblktlang.gpr"
xmlada_unicode.gpr:29:25: unknown package or project "Xmlada_Shared"
xmlada_unicode.gpr:29:25: wrong expression kind for attribute "library_kind"
That most likely is a problem to report to xmlada, and the way xmlada_24.0.0 is
packaged for alire.
I fixed it by running ./configure in the xmlada GPR_PROJECT_PATH location to generate the
Xmlada_Shared.gpr file. Not langkit fault I know :)
Next I ran into this :
python manage.py make --no-langkit-support
Generating source for libpythonlang...
Generating source for liblktlang...
Generation complete!
Building the generated source code
Building for config (BuildMode.prod, LibraryType.static)
gpr.gpr:26:04: value "static" is illegal for typed string "bld"
I figured out that this was caused by a conflict in the supported GPR_BUILD
values in gpr.gpr, I forced that to be "production" in the gpr file, not sure which
part of the coupling should be the source of truth, but I wanted to move
forward.
After the above, the prettier_ada dependency reported being missing, that was not mentionned in the
intro, so worth updating, I assume that it's pretty recent.
I cloned the repository, setup an alire project there as well with vss and got that solved.
Finally I blocked on :
[Ada] libpythonlang_support-adalog-main_support.ads
/Users/bourgeoisclement/repos/langkit/contrib/python/build/src/libpythonlang_support-adalog-solver.adb:1595:36: error: "Free" is not a visible entity of "Libpythonlang_AdaSAT"
compilation of libpythonlang_support-adalog-main_support.ads failed
gprbuild: *** compilation phase failed
Build failed: error while running gprbuild -p -j4
-P/Users/bourgeoisclement/repos/langkit/contrib/python/build/libpythonlang.gpr
-XBUILD_MODE=prod -XLIBRARY_TYPE=static -XGPR_BUILD=static -XXMLADA_BUILD=static
-XLIBPYTHONLANG_WARNINGS=true -gnatef:
I assume that it was foolish to expect langkit_support to work on master, so I
went to 24.0 but it failed similarly.
Got this error on the release branch that did not stop the build from progressing
but still sharing it for visiblity :
Generating source for liblktlang...
/Users/bourgeoisclement/repos/langkit/contrib/lkt/language/parser.py:1248:1: Then expression should have a default value provided, in cases where the type of the provided function's return type (here Int) does not have a default null value.
Errors, exiting
Generation complete!
Retried without trying to use the langkit_support from alire, building it directly, but got a similar
error :
[Ada] langkit_support-adalog-solver.adb
langkit_support-adalog-solver.adb:1595:22: error: "Free" is not a visible entity of "AdaSAT"
compilation of langkit_support-adalog-solver.adb failed
Should I use an older gnat ? I was using 13.2.0.
Final note, manage.py seems to run twice, always retrying after a failure, not a big deal but that was surprising.
Let me know some of my notes are unclear or if you need more context.
Bonsoir, hope that you're all doing well.
I am trying to evaluate langkit, aiming to simplify
the development of an LSP and a set of linters/formaters for a DSL. I struggled
getting it to build, here is a lengthy summary of what I encountered and where I stopped.
The documentation recommends GNAT Community 2021.
As I was surprised that this was the latest release of GNAT, I found the blogs
mentioning alire being the recommended way to get gnat, so I gave it a try that way, on macOS.
I did a manual setup of alire for langkit and added a dependency to
langkit_support, trying to avoid having to build it.I would have a hard time bringing the entire Ada toolchain to our devenvs,
and aimed to build as little as possible, hopefully requesting a small set to
be released (in pip using a bdist ? <3) if the eval was successful.
In the created
alire.toml:I realized that default compilation with manage.py was still trying to compile
langkit_support, I found the--no-langkit-supportoption to bypass it.Suggestion : Separating
langkit_supportout of thedependencylist might be justified giventhat it's expected to be built.
Moving forward I was stumbling upon an error caused by
xmlada_shared.gprnotfound from the xmlada lib. I was using the one brought in by
langkit_support.That most likely is a problem to report to xmlada, and the way xmlada_24.0.0 is
packaged for alire.
I fixed it by running ./configure in the xmlada
GPR_PROJECT_PATHlocation to generate theXmlada_Shared.gprfile. Not langkit fault I know :)Next I ran into this :
I figured out that this was caused by a conflict in the supported
GPR_BUILDvalues in
gpr.gpr, I forced that to be "production" in the gpr file, not sure whichpart of the coupling should be the source of truth, but I wanted to move
forward.
After the above, the
prettier_adadependency reported being missing, that was not mentionned in theintro, so worth updating, I assume that it's pretty recent.
I cloned the repository, setup an alire project there as well with vss and got that solved.
Finally I blocked on :
I assume that it was foolish to expect
langkit_supportto work on master, so Iwent to 24.0 but it failed similarly.
Got this error on the release branch that did not stop the build from progressing
but still sharing it for visiblity :
Retried without trying to use the
langkit_supportfrom alire, building it directly, but got a similarerror :
Should I use an older gnat ? I was using 13.2.0.
Final note,
manage.pyseems to run twice, always retrying after a failure, not a big deal but that was surprising.Let me know some of my notes are unclear or if you need more context.