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

Compiling sysimage on NixOS #960

Open
arunoruto opened this issue Aug 30, 2024 · 0 comments
Open

Compiling sysimage on NixOS #960

arunoruto opened this issue Aug 30, 2024 · 0 comments

Comments

@arunoruto
Copy link

I want to use the LanguageServer.jl with helix and there is also a great guide on how to configure helix and the environment for the LSP. My problem lies in the command, for generating the environment with a compiled sysimage:

julia --startup-file=no --project=@helix-lsp -e 'import Pkg; Pkg.add(["LanguageServer", "PackageCompiler"]); Pkg.update();using PackageCompiler; create_sysimage(:LanguageServer, sysimage_path=dirname(Pkg.Types.Context().env.project_file) * "/languageserver.so")'

Here is the expression nicely written:

import Pkg
Pkg.add(["LanguageServer", "PackageCompiler"])
Pkg.update()
using PackageCompiler
create_sysimage(:LanguageServer, sysimage_path=dirname(Pkg.Types.Context().env.project_file) * "/languageserver.so")

This command fails with while executing the following command:

g++ -m64 -march=x86-64 -shared -L/nix/store/vm4nnv8m4ip7v8sg4bzacgig5k9726mj-julia-1.10.3/lib -L/nix/store/vm4nnv8m4ip7v8sg4bzacgig5k9726mj-julia-1.10.3/lib/julia -o /home/mar/.julia/environments/helix-lsp/languageserver.so -Wl,--whole-archive /tmp/jl_VEjejs54l0.o -Wl,--no-whole-archive -Wl,-rpath-link,/nix/store/vm4nnv8m4ip7v8sg4bzacgig5k9726mj-julia-1.10.3/lib -Wl,-rpath-link,/nix/store/vm4nnv8m4ip7v8sg4bzacgig5k9726mj-julia-1.10.3/lib/julia -ljulia -ljulia-internal -fPIC -Wl,-soname,languageserver.so '-Wl,-rpath,$ORIGIN:$ORIGIN/julia'

Executing the command on its own, results in /nix/store/adakqsdbifx7d688z4874ap17clarhfn-binutils-2.41/bin/ld: cannot find crti.o: No such file or directory.

The crti.o file is a part of the glibc package, and I also included it into nix-ld, so it is available under $NIX_LD_LIBRARY_PATH, but it seems like the ld command in binutils isn't aware of it...

I know that this is highly specific to Nix and its ecosystem, but maybe someone has an idea how to solve this problem and set up the LSP server using a compiled sysimage!

P.S. I also tried prefixing the commands above with LD_LIBARAY_PATH=$NIX_LD_LIBARAY_PATH, but that didn't work eiterh...

julia> versioninfo()
Julia Version 1.10.3
Commit 0b4590a550 (2024-04-30 10:59 UTC)
Build Info:

    Note: This is an unofficial build, please report bugs to the project
    responsible for this build and not to the Julia project unless you can
    reproduce the issue using official builds available at https://julialang.org/downloads

Platform Info:
  OS: Linux (x86_64-unknown-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, sandybridge)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
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

1 participant