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

run_uvloop not loaded #361

Open
elliott-farrall opened this issue Mar 17, 2025 · 1 comment
Open

run_uvloop not loaded #361

elliott-farrall opened this issue Mar 17, 2025 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@elliott-farrall
Copy link

I (among others) would be very interested in seeing this included in nixpkgs. I had a go at writing a derivation myself but am having trouble with run_uvloop.

I managed to get the installer to start but it crashes when trying to load run_uvloop from ~/.config/wljs-notebook/wl_packages/KirillBelov_CSockets/LibraryResources/Linux-x86-64-v<version>/usockets.so. It tries version 7, 6 (failing to load on both) and then 5 (failing since it does not exist).

I have linked in libuv by wrapping the executable like so:

{
  lib,
  stdenv,
  fetchzip,
  makeWrapper,
  glib,
  ffmpeg,
  nss,
  nspr,
  dbus,
  atk,
  cups,
  libdrm,
  gtk3,
  pango,
  cairo,
  xorg,
  libgbm,
  expat,
  libxkbcommon,
  alsa-lib,
  libuv,
  libGL
}:

stdenv.mkDerivation rec {
  pname = "wolfram-js-frontend";
  version = "2.7.0";

  src = fetchzip {
    url = "https://github.com/JerryI/wolfram-js-frontend/releases/download/v${version}/wljs-notebook-${version}-x64-gnulinux.zip";
    hash = "sha256-dvJ9P4+Ym7seAS0gn+BINlsL4+OsWqOSWTyYSDoHAxs=";
    stripRoot = false;
  };

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    runHook preInstall

    makeWrapper $src/wljs-notebook $out/bin/wolfram-js-frontend \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ glib ffmpeg nss nspr dbus atk cups libdrm gtk3 pango cairo xorg.libX11 xorg.libXcomposite xorg.libXdamage xorg.libXext xorg.libXfixes xorg.libXrandr libgbm expat xorg.libxcb libxkbcommon alsa-lib libuv libGL ]}"

    runHook postInstall
  '';

  meta = {
    description = "Freeware notebook environment for Wolfram Language written in Javascript";
    homepage = "https://github.com/JerryI/wolfram-js-frontend";
    license = lib.licenses.gpl3Only;
    # maintainers = with lib.maintainers; [ ];
    mainProgram = "wolfram-js-frontend";
    platforms = lib.platforms.all;
  };
}

I understand that not many people use nixpkgs but any pointers on what might be causing this would be greatly appreciated.

@JerryI JerryI added bug Something isn't working help wanted Extra attention is needed labels Mar 17, 2025
@JerryI
Copy link
Owner

JerryI commented Mar 19, 2025

Hi @elliott-farrall
Thank you for your efforts!

The way how we build sockets library is automated in Github Actions and it does this command on x86 Ubuntu

generated by CreateLibrary function

/usr/bin/gcc -shared -o "/root/test/CSocketListener/LibraryResources/Linux-x86-64-v7/Working-wljs-343749-607313088-1/usockets.so" \
-m64  -fPIC -O2  -I"/usr/local/Wolfram/WolframEngine/14.2/SystemFiles/IncludeFiles/C" \
-I"/usr/local/Wolfram/WolframEngine/14.2/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions" \
-I"/usr/include" "/root/test/CSocketListener/Source/usockets.c"  \
-L"/usr/local/Wolfram/WolframEngine/14.2/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions" \
-L"/usr/local/Wolfram/WolframEngine/14.2/SystemFiles/Libraries/Linux-x86-64"  \
"/usr/lib/x86_64-linux-gnu/libuv.so"  2>&1

I am not in expert in GCC, but I guess, it should statically link uv. If not, may be it checks LD_LIBRARY_PATH...

Another possibility, it looks like Wolfram Engine itself uses dynamic libs located in its installation directory. At least $LibraryPath gives a big list. (sorry if my understanding of linking and your wrapper is too off :0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants