Paul,
You were exactly correct. WSL is really a bare-bones installation by design and everything that is needed needs to be added by user. For others that may be facing the same issue, here is how I resolved it:
Follow steps in
https://docs.microsoft.com/en-us/windows/wsl/install-win10 to install WSL and your preferred linux distribution.
Follow steps in
https://code.visualstudio.com/docs/cpp/config-wsl to configure VSCode. In particular, after you have installed your linux distribution, do:
sudo apt-get update
and
sudo apt-get install build-essential gdb
To install JRE, run: sudo apt install default-jre
Then download linux distribution of CPLEX. Run cplex installation via sudo since it needs write permission to /opt/ folder:
sudo ./cplex_studio1210.linux-x86-64.bin
Then, open VSCode via "code ." There is no need to reinstall VSCode in WSL, for some reason. It seems to pickup the Windows version itself without any trouble. You may be asked to reinstall some extensions for WSL Remote since that has been newly installed and you are calling "code ." from within WSL bash prompt. Follow normal VSCode recommendations. You may have to close and open VSCode a couple of times until you get in the bash terminal:
Installing VS Code Server for x64 (e790b931385d72cf5669fcefc51cdf65990efa5d)
Downloading: 100%
Unpacking: 100%
Unpacked 2341 files and folders to /home/username/.vscode-server/bin/e790b931385d72cf5669fcefc51cdf65990efa5d.
If you need boost, do: sudo apt-get install libboost-all-dev
If you need ncurses.h do: sudo apt-get install libncurses5-dev libncursesw5-dev
Now run code . and you should be all set.
One additional important point seems to be that launch.json of VSCode should have the path of the executable beginning from /mnt/ right through to the executable. In normal linux box, relative address seems to be enough. Hence, one would have to create an additional configuration within launch.json to account for the new WSL environment since the path is now mounted from /mnt/ onward.
Once you do this, with normal make files that you had running under the pure linux box, you should be able to debug C++ code from WSL.
Thanks.
------------------------------
CPLEX User
------------------------------
Original Message:
Sent: Tue September 29, 2020 05:02 PM
From: Paul Rubin
Subject: CPLEX Linux distribution for WSL
I'm not familiar with WSL, but Linux systems (including Ubuntu) also have a PATH variable in the environment. The installer needs to run Java (the JRE, I believe, not the JDK), which means you need to have Java installed in the Ubuntu system. I think it will work with Open JDK, and I'm pretty sure Open JDK is installed by default on an Ubuntu system, but I don't know if that's true of WSL.
From the bash prompt, try running 'java -version'. If you get back version information, Java is properly installed (and on the Ubuntu PATH). If not, I think you need to install Java under Ubuntu before installing CPLEX.
------------------------------
Paul Rubin
Professor Emeritus
Michigan State University
Original Message:
Sent: Tue September 29, 2020 04:47 AM
From: CPLEX User
Subject: CPLEX Linux distribution for WSL
I went ahead and installed WSL. Then I installed Ubuntu 20 LTS. Then, I installed appropriate extensions for VSCode. I further installed g++ and gdb and make and other utilities.
I downloaded the most recent linux installation file from IBM.
On trying to install CPLEX from within the ubuntu bash prompt, I get.
./cplex_studio1210.linux-x86-64.bin
Preparing to install
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
No Java virtual machine could be found from your PATH
environment variable. You must install a VM prior to
running this program.
----
I am not fully clear how PATH windows variable is needed for installation within WSL. Any help would be appreciated.
------------------------------
CPLEX User
Original Message:
Sent: Tue September 29, 2020 02:02 AM
From: CPLEX User
Subject: CPLEX Linux distribution for WSL
Hello,
(1) I have a separate windows machine on which I use Visual Studio IDE (and Visual Studio Code) and the cplex binary for windows.
(2) I also have a separate linux machine on which I use Visual Studio Code for my CPLEX/C++ development and use the cplex binary for linux.
On (1), the Windows machine, I would like to go ahead and create a bash shell by installing Windows Subsystem for Linux (WSL) and then installing the latest linux (ubuntu, in my case) distribution. What this would mean is that then, on this machine, from within the ubuntu bash that would be newly installed, I would have to download the cplex binary for linux and then install it. I would further be installing g++, make, VSCode and other utilities for full fledged C++/CPLEX development on linux from within my windows machine.
Before going through all of this, I would like to check whether having both cplex binary for windows and cplex binary for linux installed and working on the same machine is even possible (both would be installed in separate directories, for sure) and whether this is supported, or if it would lead to conflict because I am trying to run some linux functionality on a windows machine, and so forth.
Thanks.
------------------------------
CPLEX User
------------------------------
#DecisionOptimization