alire icon indicating copy to clipboard operation
alire copied to clipboard

Alire refuses to recognize system libgmp on Fedora

Open stalecu opened this issue 2 years ago • 3 comments

Info about Alire:

$ alr toolchain
CRATE         VERSION  STATUS    NOTES                        
gprbuild      21.0.2   Default                                
gprbuild      22.0.1   Available                              
gprbuild      2020.0.0 Available Detected at /usr/bin/gprbuild
gnat_arm_elf  12.2.1   Default                                
gnat_native   12.2.1   Available                              
gnat_external 12.2.1   Available Detected at /usr/bin/gnat    
$ alr --version
alr 1.2.2

I want to install ada_language_server from Alire, but it refuses to find libgmp, even though the libraries exist:

$ alr get ada_language_server
⚠ Complete solution not found after 5 seconds.                           
ⓘ The best incomplete solution yet is:                          
                                                                
   RELEASE                           DEPENDENCY                                         
   adasat=24.0.0-20230126            adasat* (solved)                                   
   gnat_arm_elf=12.2.1               gnat(>=2020|(>=11 & <=2000)) & (/=2020) (solved)   
   gnatcoll=24.0.0-20230126          gnatcoll24.0.0-20230126 (solved)                   
   gnatcoll_bindings=24.0.0-20230126 gnatcoll_bindings* (solved)                        
   gnatdoc=24.0.0-20230126           gnatdoc24.0.0-20230126 (solved)                    
   langkit_support=24.0.0-20230126   langkit_support24.0.0-20230126 (solved)            
   libadalang=24.0.0-20230126        libadalang24.0.0-20230126 (solved)                 
   libadalang_tools=24.0.0-20230126  libadalang_tools24.0.0-20230126 (solved)           
   (none)                            libgmp* (hinted)                                   
   libgpr=24.0.0-20230126            libgpr24.0.0-20230126 (solved)                     
   libgpr2=24.0.0-20230126           libgpr224.0.0-20230126 (solved)                    
   markdown=24.0.0-20221229          markdown24.0.0-20221229 (solved)                   
   spawn=1.1.0-20230126              spawn1.1.0-20230126 (solved)                       
   templates_parser=22.0.0           templates_parser* (solved)                         
   vss=24.0.0-20230126               vss(24.0.0-20230126) & (>=24.0.0-20221229) (solved)
   xmlada=22.0.0                     xmlada~22.0.0 (solved)                             
                                                                
Do you want to keep solving for a few more seconds?
[Y] Yes  [N] No  [A] Always  (default is Yes) n
warn:                                                           
warn:    New solution is incomplete.
warn:    +  adasat            24.0.0-20230126 (new,indirect)                       
warn:    +♼ gnat              12.2.1          (new,installed,gnat_arm_elf,indirect)
warn:    +  gnatcoll          24.0.0-20230126 (new)                                
warn:    +  gnatcoll_bindings 24.0.0-20230126 (new,indirect)                       
warn:    +  gnatdoc           24.0.0-20230126 (new)                                
warn:    +  langkit_support   24.0.0-20230126 (new,indirect)                       
warn:    +  libadalang        24.0.0-20230126 (new)                                
warn:    +  libadalang_tools  24.0.0-20230126 (new)                                
warn:    +↪ libgmp            *               (new,external,indirect)              
warn:    +  libgpr            24.0.0-20230126 (new,indirect)                       
warn:    +  libgpr2           24.0.0-20230126 (new)                                
warn:    +  markdown          24.0.0-20221229 (new,indirect)                       
warn:    +  spawn             1.1.0-20230126  (new)                                
warn:    +  templates_parser  22.0.0          (new,indirect)                       
warn:    +  vss               24.0.0-20230126 (new)                                
warn:    +  xmlada            22.0.0          (new,indirect)                       
warn: 
warn: Could not find a complete solution for ada_language_server=23.0.13
Build will fail unless externals are made available, do you want to continue?
[Y] Yes  [N] No  (default is No) n
error: Crate retrieval abandoned.                  
$ alr index --update-all
Already up to date.
$ # the pkg-config command returns true when I run it standalone!
$ alr show --external libgmp
Kind           Description                 Details                     Available
System package 4 candidate system packages Debian: libgmp-dev          True     
                                           Ubuntu: libgmp-dev                   
                                           Msys2: mingw-w64-x86_64-gmp          
                                           Arch: gmp                            
                                           others: unavailable                  
Executable     pkg-config --modversion gmp ([\d\.]+)                   False    

The description looks suspect because it should have gmp-devel too listed. I believe this is an Alire problem instead of an ALS problem because as far as I'm concerned libgpr2 has the same problem:

$ alr get libgpr2
⚠ Complete solution not found after 5 seconds.                           
ⓘ The best incomplete solution yet is:                          
                                                                
   RELEASE                           DEPENDENCY                             
   adasat=24.0.0-20230126            adasat* (solved)                       
   gnat_arm_elf=12.2.1               gnat(/=2020) & (>=11) (solved)         
   gnatcoll=24.0.0-20230126          gnatcoll24.0.0-20230126 (solved)       
   gnatcoll_bindings=24.0.0-20230126 gnatcoll_bindings* (solved)            
   langkit_support=24.0.0-20230126   langkit_support24.0.0-20230126 (solved)
   (none)                            libgmp* (hinted)                       
   libgpr=24.0.0-20230126            libgpr24.0.0-20230126 (solved)         
   xmlada=22.0.0                     xmlada~22.0.0 (solved)                 
                                                                
Do you want to keep solving for a few more seconds?
[Y] Yes  [N] No  [A] Always  (default is Yes) 

To prove I have GMP:

$ sudo dnf list installed | grep gmp
gmp.i686                                             1:6.2.1-3.fc37                      @fedora                        
gmp.x86_64                                           1:6.2.1-3.fc37                      @anaconda                      
gmp-c++.x86_64                                       1:6.2.1-3.fc37                      @fedora                        
gmp-devel.x86_64                                     1:6.2.1-3.fc37                      @fedora                        
gmp-static.x86_64                                    1:6.2.1-3.fc37                      @fedora                        
gnatcoll-gmp.x86_64                                  2:21.0.0-9.fc37                     @fedora                        
texlive-gmp.noarch                                   9:svn21691.1.0-59.fc37              @fedora        

I am new to Ada and I would really like to get the tooling to work (just downloading the binary version of ALS isn't gonna cut it if other packages will depend on libgmp too). I suspect it's because Alire doesn't see libgmp because it doesn't have it in its path, but I don't know how I can look for that or if that's even the case (I would find it pretty dubious to not look in /usr/include). What could I do? And sorry if this issue is trivial, but I wasn't able to find anything similar (the closest IMO is #1312 but that's not quite my situation).

stalecu avatar Feb 08 '23 13:02 stalecu

I believe adding an entry like fedora = ["libgmp-devel"] to external.origin in the file index/li/libgmp/libgmp-external.toml (for community repository https://github.com/alire-project/alire-index)

I have prepared a minor PR, but I can't test if it works right now because I'm getting a lot of UTF-8 encoding errors on files that I haven't even touched (I'm not sure why at the moment because iconv -t UTF-8 does not change anything )

kondor6c avatar Feb 08 '23 18:02 kondor6c

I believe adding an entry like fedora = ["libgmp-devel"] to external.origin in the file index/li/libgmp/libgmp-external.toml (for community repository https://github.com/alire-project/alire-index)

I have prepared a minor PR, but I can't test if it works right now because I'm getting a lot of UTF-8 encoding errors on files that I haven't even touched (I'm not sure why at the moment because iconv -t UTF-8 does not change anything )

The name is "gmp-devel" and it is used on both Fedora and OpenSUSE (and I believe on CentOS and CentOS-derived distros like Rocky and Alma).

stalecu avatar Feb 08 '23 21:02 stalecu

Right, this is the expected behavior without a corresponding entry as @kondor6c pointed out.

mosteo avatar Feb 09 '23 12:02 mosteo