5

Consider this simple debian package: wolframscript.deb. After unpacking, it has the following file structure:

├── opt
│   └── Wolfram
│       └── WolframScript
│           └── bin
│               └── wolframscript
└── usr
    ├── local
    │   └── share
    │       └── man
    │           └── man1
    │               └── wolframscript.1
    └── share
        ├── icons
        │   └── hicolor
        │       ├── 128x128
        │       │   └── mimetypes
        │       │       └── application-vnd.wolfram.wls.png
        │       ├── 32x32
        │       │   └── mimetypes
        │       │       └── application-vnd.wolfram.wls.png
        │       └── 64x64
        │           └── mimetypes
        │               └── application-vnd.wolfram.wls.png
        └── mime
            └── packages
                └── application-vnd.wolfram.wls.xml

The only relevant file is the opt/Wolfram/WolframScript/bin/wolframscript binary (I think). I tried executing this plainly but I get a bash: ./wolframscript: No such file or directory error. How do I make this binary/package usable in NixOS?


EDIT: Answering Bastian's question:

$ file "$F"
opt/Wolfram/WolframScript/bin/wolframscript: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=7df4a6e1ea2c78bdac9b63bdb6a8486dcfa19876, stripped
NixBox:/home/george/Downloads/wolframscriptdeb
$ strace "$F"
execve("opt/Wolfram/WolframScript/bin/wolframscript", ["opt/Wolfram/WolframScript/bin/wo"...], 0x7ffcf5578410 /* 82 vars */) = -1 ENOENT (No such file or directory)
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
getpid()                                = 32004
exit_group(1)                           = ?
+++ exited with 1 +++

$ opt/Wolfram/WolframScript/bin/wolframscript -cloud -code 2+2
bash: opt/Wolfram/WolframScript/bin/wolframscript: No such file or directory
George
  • 6,927
  • 4
  • 34
  • 67
  • Unless you mistyped the path to the `wolframscript` executable, the `No such file or directory` error could indicate that the executable cannot find the shared libraries it needs, and perhaps it can't even find the dynamic loader that would be the first step in finding those shared libraries (ld.so). I think the Nix people have utilities for rewriting ELF headers to make executables look for those things in different places but I don't know the specifics. – David Grayson Jul 19 '18 at 16:39
  • 1
    George, unfortunately your question is just too broad since creating a Nix package heavily depends on what it is you're packing. Not to mention that the deb package you linked to requires a logon. In broad brush strokes, you'll need to use `ld` to determine which dynamic libraries the executable is expecting. Then, add those libraries as dependencies to your package. Finally, use `patchelf` to re-link the executable to the libraries but with hard-coded paths. Other than having someone write the package for you, there's no answer to "How do I make this binary/package usable in NixOS?" – Emmanuel Rosa Jul 21 '18 at 20:11

1 Answers1

3

It seems there are libraries missing.

What is the output of

F='opt/Wolfram/WolframScript/bin/wolframscript'
file "$F"
strace "$F"
Avishek Bhattacharya
  • 6,534
  • 3
  • 34
  • 53