ValoMC icon indicating copy to clipboard operation
ValoMC copied to clipboard

Error at CMakeLists

Open aliesk97 opened this issue 2 years ago • 5 comments

Hi, I hope you are doing well. I did everything you wrote for the Valomc installation but when I want to compile it in cmd I face these errors, I also put the Valomc file in another drive and did the same thing but I also faced this error, could you please help me? Thanks. CMake Error at CMakeLists.txt:10 (message): Did not detect a 64 bit target platform. Use "cmake --help" to list all available target platforms and select a 64 bit one using e.g.

cmake . -G "Visual Studio 15 2017 Win64"

-- Configuring incomplete, errors occurred! Capture

aliesk97 avatar May 14 '23 15:05 aliesk97

Hello!

Did you try the hint provided by the error message? That is, to first list the target platforms using "cmake --help" and selecting target from the list provided.

If you encounter problems, you can try compling the program at MATLAB command prompt by issuing these commands at "ValoMC-master/" folder

mex -DUSE_OMP cpp/2d/MC2Dmex.cpp COMPFLAGS='$COMPFLAGS /openmp /O2' CXXFLAGS='$CXXFLAGS ' LDFLAGS='$LDFLAGS '

mex -DUSE_OMP cpp/3d/MC3Dmex.cpp COMPFLAGS='$COMPFLAGS /openmp /O2' CXXFLAGS='$CXXFLAGS ' LDFLAGS='$LDFLAGS '

Regards, Aleksi

aaleino avatar May 16 '23 20:05 aaleino

mex -DUSE_OMP cpp/2d/MC2Dmex.cpp COMPFLAGS='$COMPFLAGS /openmp /O2' CXXFLAGS='$CXXFLAGS ' LDFLAGS='$LDFLAGS ' Building with 'Xcode Clang++'. Error using mex In file included from /Users/yg/Desktop/Cola/X/led/ValoMC-master/cpp/2d/MC2Dmex.cpp:13: /Users/yg/Desktop/Cola/X/led/ValoMC-master/cpp/2d/MC2D.hpp:26:10: fatal error: 'omp.h' file not found #include <omp.h> ^~~~~~~ 1 error generated.

I am getting this error, and I've tried a bunch of random fixes on the web, but nothing seems to work. Including:

  1. Making sure the flags are set properly
  • echo $LDFLAGS -L/opt/homebrew/opt/libomp/lib
  • echo $CPPFLAGS -I/opt/homebrew/opt/libomp/include
  1. Trying to update the #include <omp.h> in MC2D.hpp to include the opt/homebrew/opt/libomp/include/omp.h path.

I'd appreciate if there's a way to solve this error. I'm on Macbook M1.

Thanks, Yatin

yg2753 avatar Jan 25 '24 06:01 yg2753

Hi,

We haven't ever tested the program on Macbook. I'm curious, what error do you get when you change

#include <omp.h>

to

#include "/usr/local/opt/libomp/include/omp.h"

after installing openmp "brew install libomp" as suggested here https://stackoverflow.com/questions/25990296/how-to-include-omp-h-in-os-x?

Best, Aleksi

aaleino avatar Jan 25 '24 21:01 aaleino

When I run "compile_vmc_mex" in MatlabR2022a, I get a ton of deprecated usage of certain functions warnings but in the end I get "MEX completed successfully", with or without the omp.h include path.

With the include path, when I run the command "mex -DUSE_OMP cpp/2d/MC2Dmex.cpp COMPFLAGS='$COMPFLAGS /openmp /O2' CXXFLAGS='$CXXFLAGS ' LDFLAGS='$LDFLAGS '" in matlab prompt, I get the same error.

`fatal error: 'opt/homebrew/opt/libomp/include/omp.h' file not found
#include <opt/homebrew/opt/libomp/include/omp.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.`

Then, if I run a sample simple simulation code, I get:

>> mymcsimulation
Invalid MEX-file
'/Users/ValoMC-master/MC2Dmex.mexmaci64':
dlopen(/Users/ValoMC-master/MC2Dmex.mexmaci64,
0x0006): Library not loaded: @rpath/libMatlabEngine.dylib
  Referenced from: <60D54BEB-DC3F-3DF3-B186-9D8C95FCBA60>
  /Users/ValoMC-master/MC2Dmex.mexmaci64
  Reason: tried: '/Applications/MATLAB_R2022a.app/bin/maci64/libMatlabEngine.dylib'
  (no such file), '/Applications/MATLAB_R2022a.app/bin/maci64/./libMatlabEngine.dylib'
  (no such file),
  '/Applications/MATLAB_R2022a.app/bin/maci64/../../sys/os/maci64/libMatlabEngine.dylib'
  (no such file),
  '/Applications/MATLAB_R2022a.app/Contents/MacOS/libMatlabEngine.dylib' (no such
  file), '/Applications/MATLAB_R2022a.app/Contents/MacOS/./libMatlabEngine.dylib' (no
  such file),
  '/Applications/MATLAB_R2022a.app/Contents/MacOS/../../standalone/bin/maci64/libMatlabEngine.dylib'
  (no such file),
  '/Applications/MATLAB_R2022a.app/Contents/MacOS/../../sys/os/maci64/libMatlabEngine.dylib'
  (no such file), '/Applications/MATLAB_R2022a.app/bin/maci64/libMatlabEngine.dylib'
  (no such file)

Error in ValoMC (line 265)
        [solution.element_fluence, solution.boundary_exitance, solution.boundary_fluence, solution.simulation_time, solution.seed_used] = MC2Dmex(H, HN, BH, r, BCType, BCIntensity, BCLightDirectionType, BCLightDirection, BCn, mua, mus, g, n, f, phase0, Nphoton, GaussianSigma, disable_pbar, uint64(rnseed));

Error in mymcsimulation (line 21)
solution = ValoMC(vmcmesh, vmcmedium, vmcboundary);

Any suggestions on how to compile this?

Thanks, Yatin

yg2753 avatar Jan 26 '24 16:01 yg2753

Hmm, it's a little bit difficult to debug as I do not have a mac system at hand. Maybe this discussion is related. It worth checking if any MEX code will work, or is it an issue related to ValoMC. Yes, I would definitely try to get the basic version without OpenMP to work first. That is, the "compile_vmc_mex" approach. Only once that runs, I would try the OpenMP version.

aaleino avatar Jan 29 '24 14:01 aaleino