I need to install CPLEX to compile a project. There is a CPLEX package (the package still needs the binary installer, because its propitiatory software, which is fine for me. I got it on my system). After some fiddling I got so far, to set the environment-variable NIXPKGS_ALLOW_UNFREE=1 and added cplex.releasePath = <path to my installer> to ~/.config/nixpkgs/config.nix. But when I then run nix-shell -p jre cplex I get the error:
nix-shell -p jre cplex
this derivation will be built:
/nix/store/5vh1963xxg4zq47226blhwrd2vag78l3-cplex-128.drv
building '/nix/store/5vh1963xxg4zq47226blhwrd2vag78l3-cplex-128.drv'...
Running phase: unpackPhase
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
JRE libraries are missing or not compatible....
Exiting....
Running phase: glibPreInstallPhase
Running phase: installPhase
Running phase: dropIconThemeCache
Running phase: glibPreFixupPhase
Running phase: fixupPhase
patchelf: getting info about '/nix/store/xf2nv3chig5wnlch7an1j88ljrkhsz8v-cplex-128/opl/bin/x86-64_linux/oplrun': No such file or directory
error: builder for '/nix/store/5vh1963xxg4zq47226blhwrd2vag78l3-cplex-128.drv' failed with exit code 1;
last 10 log lines:
> no configure script, doing nothing
> Running phase: buildPhase
> JRE libraries are missing or not compatible....
> Exiting....
> Running phase: glibPreInstallPhase
> Running phase: installPhase
> Running phase: dropIconThemeCache
> Running phase: glibPreFixupPhase
> Running phase: fixupPhase
> patchelf: getting info about '/nix/store/xf2nv3chig5wnlch7an1j88ljrkhsz8v-cplex-128/opl/bin/x86-64_linux/oplrun': No such file or directory
For full logs, run 'nix-store -l /nix/store/5vh1963xxg4zq47226blhwrd2vag78l3-cplex-128.drv'.
I guess that I have to install JRE in order to install CPLEX, but that apparently didnât work. I am new to nix, so please look over my ignorance.
How can I fix the missing JRE in order to install CPLEX?
I first want to test if I can get cplex running in a nix-shell and then provide a shell.nix file in my repository. But I already struggle with getting it working in a nix-shell.
This would be an issue with the package expression in nixpkgs, though as itâs proprietary and paywalled, I imagine not many people are looking at this and maintaining itâŚ
Understandable, although sad⌠I desperatly need to make it work for OeGOR Summer School 2024 in just a few days⌠So Iâm currently trying to create a custom flake for the test project provided: See on GitHub. I have the CPLEX installer bin, and now, I need to make it work for the project⌠which is challenging since the installer bin expects a classic file system.
So I have worked on my custom flake, and I feel Iâm getting closer and closer to success. I get the error:
âŽonyr â nixos⯠âŽoegor_column_generation_2024âŻâŻ nix develop
warning: Git tree '/home/onyr/code/phd/oegor_column_generation_2024' is dirty
error: builder for '/nix/store/sakvgl3ik4kwk4p3ly710r1c748ga6bs-cplex-128.drv' failed with exit code 1;
last 10 log lines:
> calling 'envTargetTargetHook' function hook 'make_glib_find_gsettings_schemas' /nix/store/0b03sxzh696k4wlm7bjf7crxb8cjph9j-gtk+-2.24.33
> calling 'envTargetTargetHook' function hook 'findGdkPixbufLoaders' /nix/store/0b03sxzh696k4wlm7bjf7crxb8cjph9j-gtk+-2.24.33
> calling 'envTargetTargetHook' function hook 'addPkgToClassPath' /nix/store/kkdmb2qhyprdg9x373hd1bcfxdvkf6r9-libXtst-1.2.4
> calling 'envTargetTargetHook' function hook 'make_glib_find_gsettings_schemas' /nix/store/kkdmb2qhyprdg9x373hd1bcfxdvkf6r9-libXtst-1.2.4
> calling 'envTargetTargetHook' function hook 'findGdkPixbufLoaders' /nix/store/kkdmb2qhyprdg9x373hd1bcfxdvkf6r9-libXtst-1.2.4
> calling 'envTargetTargetHook' function hook 'addPkgToClassPath' /nix/store/acxxrpwzjg7xkhq8jxzasqby1bndnxs3-glibc-locales-2.39-52
> calling 'envTargetTargetHook' function hook 'make_glib_find_gsettings_schemas' /nix/store/acxxrpwzjg7xkhq8jxzasqby1bndnxs3-glibc-locales-2.39-52
> calling 'envTargetTargetHook' function hook 'findGdkPixbufLoaders' /nix/store/acxxrpwzjg7xkhq8jxzasqby1bndnxs3-glibc-locales-2.39-52
> Running phase: unpackPhase
> cp: cannot stat '/home/onyr/cplex2210/cplex_studio2210.linux_x86_64.bin': No such file or directory
For full logs, run 'nix log /nix/store/sakvgl3ik4kwk4p3ly710r1c748ga6bs-cplex-128.drv'.
error: 1 dependencies of derivation '/nix/store/rv1n3hyhsi7ww14sa5d0s90pl75i2zvl-nix-shell-env.drv' failed to build
âŽonyr â nixos⯠âŽoegor_column_generation_2024âŻâŻ ls /home/onyr/cplex2210/cplex_studio2210.linux_x86_64.bin
/home/onyr/cplex2210/cplex_studio2210.linux_x86_64.bin
I guess this is because flake doesnât allow the access to a âhard codedâ path. How can I fix that ?
EDIT
Ok, so I fixed the issue by making a derivation for the installer file for CPLEX⌠and now, I feel trapped like OuroborosâŚ
Running phase: buildPhase
JRE libraries are missing or not compatible....
Exiting....
Going back to CPLEX installer having JRE version or access issuesâŚ
EDIT 2:
Apparently, this is related to this known error where the installer needs sudo privileges to make a tmp dir in root⌠wtf
So I sent an email to the maintainer of the CPLEX nixpkgs (bfortz), letâs see where it goesâŚ
EDIT 3:
I got an answer from bfortz. Apparently this bug has stayed on his task list for around 2 years already. Unfortunatly, he really doesnât have the time to have a look at it and fix it.
So, I found a way to make CPLEX work on NixOS⌠using a rather creative method. I freed up some disk space, installed Ubuntu 24.04 LTS, and used it to run the CPLEX installer, deploying the files on my /home partitions. This setup allows me to switch operating systems with minimal hassle. After rebooting into NixOS and modifying some CMakeList variables with the necessary paths, BOOM! It worked
Iâm documenting this trick for the future, in case anyone else needs to use CPLEX on NixOS and is unable to successfully continue the packaging effort concerning the CPLEX installer and its installation on NixOS.