alire
alire copied to clipboard
Building alr with alr, shared vs static library issue
Checked out alire at tag v1.1.2 on my M1 machine, and used the downloaded x86_64 alr to build (alr build):
...
[mkdir] object directory for project URI
[mkdir] exec directory for project URI
clic.gpr:5:09: shared library project "clic" cannot import static library project "simple_logging"
clic.gpr:5:09: shared library project "clic" cannot import project "ansi" that is not a shared library project
gprbuild: "alr.gpr" processing failed
error: Command ["gprbuild", "-gnatwU", "-j0", "-p", "-P", "alr.gpr"] exited with code 4
error: Compilation failed.
I tried to build alr using x86_64 alr as well, and it works on master, if native toolchain is selected
If I choose gnat_arm_elf toolchain, I get this:
gprconfig: can't find a native toolchain for language 'ada'
gprconfig: can't find a native toolchain for language 'ada'
aaa.gpr:1:09: warning: there are no sources of language "C" in this project
ajunitgen.gpr:3:09: warning: there are no sources of language "C" in this project
xml_ez_out.gpr:1:09: warning: there are no sources of language "C" in this project
ansi.gpr:1:09: warning: there are no sources of language "C" in this project
clic.gpr:6:09: warning: there are no sources of language "C" in this project
simple_logging.gpr:1:09: warning: there are no sources of language "C" in this project
minirest.gpr:5:09: warning: there are no sources of language "C" in this project
optional.gpr:1:09: warning: there are no sources of language "C" in this project
semantic_versioning.gpr:1:09: warning: there are no sources of language "C" in this project
spdx.gpr:1:09: warning: there are no sources of language "C" in this project
stopwatch.gpr:1:09: warning: there are no sources of language "C" in this project
toml_slicer.gpr:3:09: warning: there are no sources of language "C" in this project
uri.gpr:1:09: warning: there are no sources of language "C" in this project
si_units.gpr:1:17: no compiler for language "Ada", cannot compile "si_units-metric.adb"
gprbuild: *** compilation phase failed
@simonjwright I've seen your problem some time building with GNATstudio. It was fixable by setting clic build to static or static-pic, I can't exactly remember.
@yrashk that's funny because if gprbuild can find the gnat_native compiler it should have no trouble either with a gnat_arm_elf. Since that's a different issue though, I suggest you open a new one if you want to pursue it.
I get the same result on x86_64. If I set CLIC_LIBRARY_TYPE=static the build succeeds.
An interesting result: having just got the successful build above,
$ LIBRARY_TYPE=static bin/alr build
error: Trying to set an alredy defined environment variable:
error: LIBRARY_TYPE is already defined as 'static' but new value is 'static-pic'
@yrashk The gnat_arm_elf toolchain is for MCU (bare-board) targets, and needs to have a runtime specified. alire is never going to run on bare-board targets.
Got it. I was hoping it was suitable for M1, haha! So far, it looks like only x86_64 is feasible as a target on M1.
@yrashk See https://github.com/simonjwright/distributing-gcc/releases/tag/aarch64-apple-darwin21-2 Be warned, I made a mistake with aunit, you’ll get warnings about mismatched macOS versions (12.3 vs 12.0) - ignore
@simonjwright amazing, this worked for my project! Thank you
Though still can't rebuild master alr using it:
ⓘ Building alr/alr.gpr...
Compile
[Ada] alr-main.adb
[Ada] gnatcoll-io-remote-windows.adb
[Ada] gnatcoll-io-remote-unix.adb
[Ada] gnatcoll-ravenscar-timed_out_sporadic_server.adb
[Ada] gnatcoll-memory.adb
[Ada] gnatcoll-format_columns_vertical.ads
[Ada] gnatcoll-ravenscar-sporadic_server_with_callback.adb
[Ada] gnatcoll-utils.adb
[Ada] gnatcoll-pools.adb
[Ada] gnatcoll-scripts-shell.adb
gnatcoll-utils.adb:618:34: warning: pragma Unreferenced given for "Result" [enabled by default]
gnatcoll-io-remote-windows.adb:496:36: warning: pragma Unreferenced given for "Status" [enabled by default]
gnatcoll-io-remote-unix.adb:409:36: warning: pragma Unreferenced given for "Status" [enabled by default]
gnatcoll-io-remote-unix.adb:434:36: warning: pragma Unreferenced given for "Status" [enabled by default]
gnatcoll-scripts-shell.adb:38:06: warning: unnecessary with of ancestor [-gnatwr]
compilation of gnatcoll-scripts-shell.adb failed
compilation of gnatcoll-utils.adb failed
compilation of gnatcoll-io-remote-unix.adb failed
compilation of gnatcoll-io-remote-windows.adb failed
gprbuild: *** compilation phase failed
@yrashk See issue #960 - these warnings (there are others) are because of a change to the semantics of pragma Unreferenced - it used to mean just "never read, even though assigned" as well as "never referenced", but now it means just "never referenced".
This builds OK:
gprbuild -j0 -Palr_env -XOS=macOS -gnatwn
Building from master with commit 63820d3, gnat-native=11.2.4, gprbuild=21.0.2, is successful.
However, there’s some weirdness with CLIC_LIBRARY_TYPE=static vs LIBRARY_TYPE=static-pic:
detail: Env: Alire sets 'True' to 'ALIRE'
debug: Skipping identical key value: ALIRE=True
debug: Setenv ALIRE=True
debug: Setenv BUILD=DEBUG
debug: Setenv CLIC_LIBRARY_TYPE=static
debug: Setenv GNATCOLL_OS=osx
debug: Setenv GPR_PROJECT_PATH=...
debug: Setenv LIBRARY_TYPE=static-pic
debug: Setenv OS=macOS
debug: Setenv PATH=...
I tried using git bisect to see where the change happened; was OK by f6b58d7, but the build totally failed at bec5bd0 because clic and stopwatch were missing.
The build succeeds at e6e19a7 (28 Sep 2021), but this commit isn’t in v1.2.2 (27 Jan 2022). e6e19a7 is "Enable and update self-build" - the lack of this might explain this issue?
Thanks for the investigation, Simon. So I understand the problem is only with alr building alr itself on v1.1.2 due to missing https://github.com/alire-project/alire/commit/e6e19a74656e4b9c6077d158d6096fe604a10c57
@mosteo after the next release, building Alire with Alire should probably be the main workflow.
@mosteo Yes, the problem is half-solved with V1.1.2 + e6e19a7; after fixing up the conflicts the build starts, but fails later,
alire-properties-configurations.adb:48:19: no selector "Item_Kind" for private type "TOML_Value" defined at toml.ads:35
alire-properties-configurations.adb:140:19: no selector "Item_Kind" for private type "TOML_Value" defined at toml.ads:35
alire-properties-configurations.adb:141:62: no selector "Item_Kind" for private type "TOML_Value" defined at toml.ads:35
alire-properties-configurations.adb:704:44: no selector "Item_Kind_Set" for private type "TOML_Value" defined at toml.ads:35
alire-properties-configurations.adb:706:41: no selector "Item_Kind" for private type "TOML_Value" defined at toml.ads:35