Menu

Compiling_hrtf_mesh_grading_on_Windows

Sergejs

Compiling hrtf_mesh_grading on Windows

How to recompile "hrtf_mesh_grading", in case the compiled Windows binaries from Here are obsolete or not working

Tutorial Status Date Written Date Last Updated
Complete. 2022-10-29 2022-10-29

Compiling on Linux/Mac

Note, "hrtf_mesh_grading" is native for Linux so the original instructions are valid for these platforms: https://github.com/cg-tub/hrtf_mesh_grading#getting-started .

Compiling on Windows using MSYS2

To re-compile hrtf_mesh_grading.exe use any MinGW 64bit compiler. This method uses MSYS2 version of MinGW64 compiler, but there are also other valid approaches to use MinGW compiler variants on Windows.
Sidenote MSYS2 is also used to compile NumCalc.exe for Mesh2HRTF.

1 Install MSYS2 compiler

Go to https://www.msys2.org and get the MSYS2 by following the excellent Installation instructions on the front-page.

  1. First run the Windows Installer using simple GUI.

  2. Then Update everything using pacman within “MSYS2 MSYS.exe” by pasting-in the following commands (answer “Y” or just hit Enter key on all prompts). Tip: re-run all update commands more than once until it says that there is nothing more to update.:

    • pacman -Syu (Update the package database and base packages.)

    • pacman -Su (Update the rest of the base packages)

  3. Install the MinGW with GCC needed for NumCalc compiling:

    • pacman -S --needed base-devel mingw-w64-x86_64-toolchain
  4. Close “MSYS2 MSYS.exe”

2 Comment out some code

To make "hrtf_mesh_grading" source code (as of 2022-10) compile on Windows, it is required to comment-out some compiling instructions that cause problems:

1- In the “..\hrtf_mesh_grading\pmp-library\src\apps\CMakeLists.txt” change

  # build mconvert only on unix / OS-X
  if(NOT WIN32)
    add_executable(hrtf_mesh_grading hrtf-mesh-grading.cpp)
    target_link_libraries(hrtf_mesh_grading pmp)
    add_executable(mconvert mconvert.cpp)
    target_link_libraries(mconvert pmp)
  endif()

to

  # build mconvert, always
#  if(NOT WIN32)
    add_executable(hrtf_mesh_grading hrtf-mesh-grading.cpp)
    target_link_libraries(hrtf_mesh_grading pmp)
    add_executable(mconvert mconvert.cpp)
    target_link_libraries(mconvert pmp)
#  endif()

2- In the “..\hrtf_mesh_grading\pmp-library\external\rply\CMakeLists.txt” change

  add_compile_options(/wd4700)

to

#  add_compile_options(/wd4700)

3- in the “..\hrtf_mesh_grading\pmp-library\CMakeLists.txt” change

  add_compile_options(/wd4267) # conversion from size_t
  add_compile_options(/wd4244) # conversion from double to float
  add_compile_options(/wd4305) # truncation from double to float

to

#  add_compile_options(/wd4267) # conversion from size_t
#  add_compile_options(/wd4244) # conversion from double to float
#  add_compile_options(/wd4305) # truncation from double to float

3 Run MSYS2 compiler

Open “MSYS2 MinGW 64-bit.exe” that you just installed and proceed to compile NumCalc.exe:

  • Use the following commands to change to the “pmp-library” folder on (in this case) disk "C:\" from which the compilation needs to be started. We also create new folder "build" where all compiled binaries will be saved (To be on the safe side, do not use paths with spaces and non-standard characters):
cd C:
cd path/on/drive/C:/WhereYouHave/hrtf_mesh_grading/pmp-library
mkdir build
cd build
cmake .. -G "MSYS Makefiles"
  • Compiling is initiated using the normal Linux make command:
    make

  • In the "build" folder you should have several .exe files ready , but there are a few steps left before running the simulation.

  • Close “MSYS MinGW 64-bit.exe”

4 Fixing the DLLs

To make your "hrtf_mesh_grading.exe" work some additional DLL files need to be copied from MSYS2 distribution. (Note, it is somehow possible to include all the necessary DLLs into .exe file during compilation, but this method works too):

  1. Move the relevant compiled files to a folder where you will use it, for example to “C:\hrtf_mesh_grading_WindowsExe\bin\” (like here: https://sourceforge.net/p/mesh2hrtf-tools/code/ci/master/tree/hrtf_mesh_grading_WindowsExe/bin/ ). Relevant files are:

    • hrtf_mesh_grading.exe
    • mpview.exe
    • libpmp_vis.dll
    • libpmp.dll
  2. Try running “mpview.exe”. Most likely you will get "............... .dll not found" error which means that it needs some .dll files in the same folder as hrtf_mesh_grading.exe to run. You can find all the missing .dll files in the C:\msys64\mingw64\bin folder. Just copy the files with the right name into the “..\hrtf_mesh_grading_WindowsExe\bin\” folder. Most likely the needed DLLs are:

    • libgcc_s_seh-1.dll
    • libstdc++-6.dll
    • libwinpthread-1.dll”.
  3. When everything is correct, if you double-click “mpview.exe” it will open a GUI and remain open - it means everything is working and ready to be used.

Done


Related

Wiki: Home