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

What's the correct way to build ALS on Windows 10 with Alire ? #1103

Open
NicoPy opened this issue Jan 1, 2023 · 4 comments
Open

What's the correct way to build ALS on Windows 10 with Alire ? #1103

NicoPy opened this issue Jan 1, 2023 · 4 comments

Comments

@NicoPy
Copy link

NicoPy commented Jan 1, 2023

I've created a new project with alr get ada_language_server.
This created a new folder named ada_language_server_23.0.0_66f2e7fb.

alr build generates ada_language_server.exe in .obj/server folder.
alr run does nothing (except running a build). alr run ada_language_server.exe neither.

Running ada_language_server.exe manually opens an error dialog box saying that libgmp-10.dll is not found.

image

In the dependencies, Alire installed and compiled gnatcoll_gmp_23.0.0_57de4a1a. However, there is no libgmp-10.dll generated.

Did I miss something ?

@NicoPy NicoPy changed the title What's the correct way to build ALS on Windows with Alire ? What's the correct way to build ALS on Windows 10 with Alire ? Jan 1, 2023
@Fabien-Chouteau
Copy link
Member

Hi @NicoPy, libgmp-10.dll is provided by msys2 on Windows so you have to run you executable in an msys2 mingw64 shell.
It's a big limitation of Alire on Windows at the moment, the Alire project is looking for way to improve that.

@NicoPy
Copy link
Author

NicoPy commented Jan 8, 2023

Thanks for your answer.

I didn't think about this.
So, I tried running ada_language_server.exe from Msys2. The previous error is gone but :

ada_language_server.exe exits a few seconds after launch without any message.

When running ada_language_server.exe --help I get :

$ ./ada_language_server.exe --help
Command line interface for the Ada Language Server
Usage: ada_language_server.exe [switches] [arguments]

 --tracefile=ARG Full path to a file containing traces configuration
 --language-gpr  Handle GPR language instead of Ada
 --version       Display the program version
 --help          Display this help
Segmentation fault

Looks like there is still something wrong somewhere (please note the segmentation fault).

@reznikmm
Copy link
Member

try to export LIBRARY_TYPE=static before running alr build. This way you could avoid messing with .dll loading/searching.

@NicoPy
Copy link
Author

NicoPy commented Mar 21, 2023

I used powershell syntax : $Env:LIBRARY_TYPE='static'

Unfortunately, the build did not finished successfully :

.
.
.
Bind
   [gprbind]      lsp-ada_driver.bexch
   [Ada]          lsp-ada_driver.ali
Link
   [link]         lsp-ada_driver.adb
c:/users/nicolas/.config/alire/cache/dependencies/gnat_native_12.1.2_3126cd6f/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Nicolas/.cache/alire/msys64/mingw64/lib/../lib\libgmp.a(lt20-get_str.o):(.text+0x2ad): undefined reference to `__stack_chk_fail'
c:/users/nicolas/.config/alire/cache/dependencies/gnat_native_12.1.2_3126cd6f/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Nicolas/.cache/alire/msys64/mingw64/lib/../lib\libgmp.a(lt20-get_str.o):(.rdata$.refptr.__stack_chk_guard[.refptr.__stack_chk_guard]+0x0): undefined reference to `__stack_chk_guard'
c:/users/nicolas/.config/alire/cache/dependencies/gnat_native_12.1.2_3126cd6f/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Nicolas/.cache/alire/msys64/mingw64/lib/../lib\libgmp.a(mod.o):(.text+0x10f): undefined reference to `__stack_chk_fail'
c:/users/nicolas/.config/alire/cache/dependencies/gnat_native_12.1.2_3126cd6f/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Nicolas/.cache/alire/msys64/mingw64/lib/../lib\libgmp.a(lt31-mul.o):(.text+0x37e): undefined reference to `__stack_chk_fail'
c:/users/nicolas/.config/alire/cache/dependencies/gnat_native_12.1.2_3126cd6f/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Nicolas/.cache/alire/msys64/mingw64/lib/../lib\libgmp.a(realloc.o):(.text+0x47): undefined reference to `__stack_chk_fail'
c:/users/nicolas/.config/alire/cache/dependencies/gnat_native_12.1.2_3126cd6f/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Nicolas/.cache/alire/msys64/mingw64/lib/../lib\libgmp.a(lt43-set_str.o):(.text+0x2d3): undefined reference to `__stack_chk_fail'
c:/users/nicolas/.config/alire/cache/dependencies/gnat_native_12.1.2_3126cd6f/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Nicolas/.cache/alire/msys64/mingw64/lib/../lib\libgmp.a(tdiv_q.o):(.text+0x22f): undefined reference to `__stack_chk_fail'
c:/users/nicolas/.config/alire/cache/dependencies/gnat_native_12.1.2_3126cd6f/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Nicolas/.cache/alire/msys64/mingw64/lib/../lib\libgmp.a(tdiv_r.o):(.text+0x2ec): more undefined references to `__stack_chk_fail' follow
collect2.exe: error: ld returned 1 exit status
gprbuild: link of lsp-ada_driver.adb failed
gprbuild: failed command was: C:\Users\Nicolas\.config\alire\cache\dependencies\gnat_native_12.1.2_3126cd6f/bin\g++.exe lsp-ada_driver.o @C:\Users\Nicolas\AppData\Local\Temp\GNAT-TEMP-000057.TMP
ERROR: Command ["gprbuild", "-s", "-j0", "-p", "-P", "Z:\ada\alire_projects\ada_language_server_23.0.0_66f2e7fb\gnat/lsp_server.gpr"] exited with code 4
ERROR: Compilation failed.

It looks like a library is missing.

Notes :

  • I did not used a very recent ALS version for the build.
  • I used GNAT 12.1.2

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

3 participants