neutronimaging / imagingsuite

Sources for imaging related tools
GNU General Public License v3.0
18 stars 11 forks source link

Fixed build error/added constexpr #695

Closed vlocateli closed 3 months ago

vlocateli commented 3 months ago

Fixed build error, added

constexpr

to class member to make it compiler-time constant.

vlocateli commented 3 months ago

Weird. Isn't because the MinGW compiler is interpreting \openmp and \O2 as files?

c++.exe: warning: /openmp: linker input file unused because linking not done
c++.exe: warning: /O2: linker input file unused because linking not done

Should be:

-fopenmp 
-O2

@anderskaestner

vlocateli commented 3 months ago

I think I know why it's failing, in Actions webpage, if you see Actions Workflow file, the Windows compiler is set to cl but the errors show MinGW being used...

-- The CXX compiler identification is GNU 12.2.0
[...]
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 

The problem is using cl (Microsoft's Visual C++ Compiler) with GCC flags. That's why it fails. :) @anderskaestner

vlocateli commented 3 months ago

@damskii9992 Could you change the Windows compiler to MinGW in the workflow file? :)

anderskaestner commented 3 months ago

@damskii9992 Could you change the Windows compiler to MinGW in the workflow file? :)

I'd prefer adapting the compile arguments for msvc. But, good that you found the cause of the problem.

vlocateli commented 3 months ago

@damskii9992 Could you change the Windows compiler to MinGW in the workflow file? :)

I'd prefer adapting the compile arguments for msvc. But, good that you found the cause of the problem.

The problem is that MSVC uses an old version of OpenMP library from 2002. We can use the flags /openmp:llvm to use LLVM runtime with MSVC, /openmp:experimental is also an option. See: OpenMP support in MSVC

anderskaestner commented 3 months ago

I'm actually about to replace the openmp code with std:thread based implementations. See thread pool. So openmp will anyway be phased out.

damskii9992 commented 3 months ago

The broken Windows build seems to be due to visual studio changing how they version their software. I am currently looking into it.