Geant4 Build hanging at G4Processes

Ubuntu 18.04 LTS (used under Windows WSL)
Geant4-10.6.p02
gcc 7.5.0
GNU Make 4.1
cmake version 3.10.2

Hello,
I used to use Geant4 v10.6.2 in Ubuntu under WSL and but now changed PC and I can’t get to build it even though I follow the same process as before.
Once running

cd geant4.10.06.p02-build/
cmake -DCMAKE_INSTALL_PREFIX=../geant4.10.06.p02-install -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_QT=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_OPENGL_X11=ON ../geant4.10.06.p02-source

I get

-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_TLS
-- Performing Test HAVE_TLS - Success
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found version "2.2.5")
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Configuring download of missing dataset G4NDL (4.6)
-- Configuring download of missing dataset G4EMLOW (7.9.1)
-- Configuring download of missing dataset PhotonEvaporation (5.5)
-- Configuring download of missing dataset RadioactiveDecay (5.4)
-- Configuring download of missing dataset G4PARTICLEXS (2.1)
-- Configuring download of missing dataset G4PII (1.3)
-- Configuring download of missing dataset RealSurface (2.1.1)
-- Configuring download of missing dataset G4SAIDDATA (2.0)
-- Configuring download of missing dataset G4ABLA (3.1)
-- Configuring download of missing dataset G4INCL (1.0)
-- Configuring download of missing dataset G4ENSDFSTATE (2.2)
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- The following Geant4 features are enabled:
GEANT4_BUILD_CXXSTD: Compiling against C++ Standard '11'
GEANT4_BUILD_MULTITHREADED: Build multithread enabled libraries
GEANT4_BUILD_TLS_MODEL: Building with TLS model 'initial-exec'
GEANT4_USE_SYSTEM_EXPAT: Using system EXPAT library
GEANT4_USE_QT: Build Geant4 with Qt support
GEANT4_USE_OPENGL_X11: Build Geant4 OpenGL driver with X11 support

-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/d/Linux_Software/GEANT4/geant4.10.06.p02-build

which seems OK to me.
Now, when going for sudo make -j4 install all goes well until G4Processes. Every time make reaches G4Processes, it seems to hang and not progress at all

[ 27%] Building CXX object source/digits_hits/CMakeFiles/G4digits_hits.dir/utils/src/G4VScoreWriter.cc.o
[ 27%] Building CXX object source/digits_hits/CMakeFiles/G4digits_hits.dir/utils/src/G4VScoringMesh.cc.o
[ 27%] Linking CXX shared library ../../BuildProducts/lib/libG4digits_hits.so
[ 27%] Built target G4digits_hits
Scanning dependencies of target G4processes

To understand what’s going on, I then try sudo strace -p <makepid> which shows me that make is trapped inside an infinite loop of not finding specific files. Below I have attached part of the output i get
strace_output.txt (709.1 KB)

It seems that make is looking for files that are not included inside the source folder, which seems strange. Does anyone have an idea what is going on or could give me a tip on what to try?
Thank you very much,
Alex

I have re-uploaded the strace file when trying v10.6.p03 as the result is the same. But this time I have added 4000 lines now

Could you try and isolate where the infinite loop is happening please? I think there’s a lot of “correct” lookup in the report as the compiler goes through a list of things needed to be included, and it then goes through the paths configured to search for them. So isolating the actual file causing the loop will be needed (if that indeed is what’s causing things).

Do you have any additional environment settings for CMake, GCC etc?

Hi @bmorgan and thank you for taking a look at this.
Apologies for the term “infinite loop” and “hanging”. It is clear, as you observed, that this is not what’s happening here. The compiler is looking up things it is supposed to be.

After your response, I started building v10.7.02 and let my machine to see if Scanning dependencies of target G4processes will ever complete and it did after 4 hours and then it started building the target. The same searches took place for the rest targets as well but these were smaller directories so did not take such a long time.
I ran make in single-threaded mode.

I am not sure why that happens. Maybe my machine is making redundant searches? or it is slow (intel i5 2.4GhZ)?

Regarding my gcc configuration, gcc -v -E -x c++ - < /dev/null outputs

Using built-in specs.
COLLECT_GCC=gcc
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
COLLECT_GCC_OPTIONS='-v' '-E' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/7/cc1plus -E -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE - -mtune=generic -march=x86-64 -fstack-protector-strong -Wformat -Wformat-security
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/7"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/7
 /usr/include/x86_64-linux-gnu/c++/7
 /usr/include/c++/7/backward
 /usr/lib/gcc/x86_64-linux-gnu/7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "<stdin>"
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-E' '-mtune=generic' '-march=x86-64'

while printenv (before Geant4 install and sourcing its .sh files) outputs

LD_LIBRARY_PATH=/mnt/d/Linux_Software/ROOT/6.22.02-install/lib
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
HOSTTYPE=x86_64
LESSCLOSE=/usr/bin/lesspipe %s %s
LIBGL_ALWAYS_INDIRECT=1
LANG=C.UTF-8
DISPLAY=172.26.0.1:0
WSL_INTEROP=/run/WSL/4591_interop
WSL_DISTRO_NAME=Ubuntu-18.04
DYLD_LIBRARY_PATH=/mnt/d/Linux_Software/ROOT/6.22.02-install/lib
ROOTSYS=/mnt/d/Linux_Software/ROOT/6.22.02-install
USER=aeroulis89
PWD=/home/aeroulis89
HOME=/home/aeroulis89
CMAKE_PREFIX_PATH=/mnt/d/Linux_Software/ROOT/6.22.02-install
NAME=LAPTOP-587NA1AO
JUPYTER_PATH=/mnt/d/Linux_Software/ROOT/6.22.02-install/etc/notebook
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
SHLIB_PATH=/mnt/d/Linux_Software/ROOT/6.22.02-install/lib
LIBPATH=/mnt/d/Linux_Software/ROOT/6.22.02-install/lib
SHELL=/bin/bash
TERM=xterm-256color
SHLVL=1
PYTHONPATH=/mnt/d/Linux_Software/ROOT/6.22.02-install/lib
MANPATH=/mnt/d/Linux_Software/ROOT/6.22.02-install/man:/usr/local/man:/usr/local/share/man:/usr/share/man:/mnt/d/CMake/man
LOGNAME=aeroulis89
PATH=/mnt/d/Linux_Software/ROOT/6.22.02-install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2020.824.0_x64__79rhkp1fndgsc:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/d/CMake/bin:/mnt/d/Microsoft VS Code/bin:/mnt/c/Program Files/Wolfram Research/WolframScript/:/mnt/d/Git/cmd:/mnt/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/:/mnt/c/Users/Alex/AppData/Local/Microsoft/WindowsApps:/mnt/d/MiKTeX/miktex/bin/x64/:/snap/bin
JUPYTER_CONFIG_DIR=/mnt/d/Linux_Software/ROOT/6.22.02-install/etc/notebook
WSLENV=
SWDIR=/mnt/d/Linux_Software
CLING_STANDARD_PCH=none
LESSOPEN=| /usr/bin/lesspipe %s
_=/usr/bin/printenv

Does anything look out of place?
Thank you very much again.
Alex

Hello again,

I changed the building directory from /mnt/ to $HOME and building is fast as a lightning! Built it in 20 mins.
It seems all these recursive accesses were very time-consuming for WSL.
That is interesting since in my previous machine I had an AMD CPU (roughly speaking equivalent to my current i5 CPU) and working with a Geant4 installation in /mnt/ was sufficiently fast.

I am aware that the Geant4 Collaboration is not officially supporting WSL systems but thank you for the help.
Maybe we can change the title of this post to something more representative of the problem I described.

Alex

Hi @AlexAerPhys, many thanks for the detailed info - whilst we don’t officially support WSL as you say, feedback like this is valuable both for us and other users of this system!

I don’t see anything amiss in your environment settings, so I think that’s fine. I don’t have recent WSL experience, but a very quick search suggested there may be some I/O performance issues with /mnt (e.g. this post on StackOverflow). That might offer some ways to mitigate things. G4processes is the largest component of Geant4, so file lookups for #includes will expose any I/O issues.

Good idea on changing the title - would “Slow Geant4 build on WSL due to I/O issues” be o.k. for you?

That sounds great. Can you please make the title change?
Thank you, Alex

The G4processes library is the largest library in all of Geant4. It can take well over half the total time required to build the package. On my MacBook, it’s typically about an hour. If I do the build on our compute cluster with a single thread, it can be three to four hours (because of contention for the networked filesystem).

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