WSL Ubuntu: math.h: No such file or directory


I decided to try WSL 2 with Ubuntu and install Geant4 v11, for practical reasons. I followed the Installation Guide - “Building and Installing from Source on Unix Platforms” and as far as I’m aware the installation was successful.

However, when I try to compile my project (via make command), I get the following error:

Scanning dependencies of target Microbeam
[  5%] Building CXX object CMakeFiles/Microbeam.dir/
In file included from /usr/include/c++/9/complex:44,
                 from /opt/Geant4/Geant4-v11.0/geant4-v11.0.0-install/include/Geant4/G4Types.hh:74,
                 from /opt/Geant4/Geant4-v11.0/geant4-v11.0.0-install/include/Geant4/G4ios.hh:35,
                 from /opt/Geant4/Geant4-v11.0/geant4-v11.0.0-install/include/Geant4/globals.hh:35,
                 from /mnt/c/Users/joaod/Documents/GitHub/jfcanhoto-phd/Geant4/PTB/include/DetectorConstruction.hh:4,
                 from /mnt/c/Users/joaod/Documents/GitHub/jfcanhoto-phd/Geant4/PTB/
/usr/include/c++/9/cmath:45:15: fatal error: math.h: No such file or directory
   45 | #include_next <math.h>
      |               ^~~~~~~~
compilation terminated.

I am not really sure what the problem is or if it is related to G4, but if anyone can help me, I would really appreciate it.

I have a VM with Zorin OS (which is based on Ubuntu 20.04.1) and everything works properly.

I have the WLS with Ubuntu 20.04.4 on Windows 11.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.