Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake version #3

Open
hrheydarian opened this issue Dec 3, 2018 · 8 comments
Open

cmake version #3

hrheydarian opened this issue Dec 3, 2018 · 8 comments
Assignees

Comments

@hrheydarian
Copy link
Contributor

hrheydarian commented Dec 3, 2018

Hi Ben,

In the CMakeLists.txt, the minimum required version of cmake is 3.12. I have cmake version 2.8 which seems to be a different version numbering (isn't it? larger number but older version). When I try to run cmake with version 2.8 (after changing the required minimum version) I get the following error:

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_LANGUAGES_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_LANGUAGES_COMPILER
CMake Error: Could not find cmake module file: /home/hheydarian/testtt/smlm_datafusion2d/CMakeFiles/2.8.12.2/CMakeLANGUAGESCompiler.cmake
CMake Error: Could not find cmake module file: CMakeLANGUAGESInformation.cmake
CMake Error: CMAKE_LANGUAGES_COMPILER not set, after EnableLanguage
CMake Error at CMakeLists.txt:14 (matlab_add_mex):
Unknown CMake command "matlab_add_mex".
-- Configuring incomplete, errors occurred!
See also "/home/hheydarian/testtt/smlm_datafusion2d/CMakeFiles/CMakeOutput.log".

I got the same error on my colleague's linux machine which has cmake 3.5 version. There the error was about another flag related to CUDA which was undefined.

Unfortunately, on HPC servers I cannot update cmake version. So it there any solution to make this compatible with older version of cmake?

@benvanwerkhoven
Copy link
Collaborator

Hi,

That error happens because version 2.8 of CMake is very old. The FindMatlab module that also implements the matlab_add_mex function that we use was introduced in CMake 3.2.

The CUDA language support in CMake is different from the way Matlab is supported. There used to be a FindCUDA module, but as of version 3.10 CUDA became a 'first-class language' and that's why we should use enable_language instead of find_module.

I had set the minimum version 3.12, because it was the latest at the time. I think 3.10 may work as well, but any lower than that won't work. Interpret these version numbers not as decimals but ..

I've installed CMake version 3.12 in my home directory on the HPC servers, so that's how I've been using it there. I'd recommend that you install the latest version from here: https://cmake.org/download/#latest
Let me know if you run into anything.

@hrheydarian
Copy link
Contributor Author

Hi,

That error happens because version 2.8 of CMake is very old. The FindMatlab module that also implements the matlab_add_mex function that we use was introduced in CMake 3.2.

The CUDA language support in CMake is different from the way Matlab is supported. There used to be a FindCUDA module, but as of version 3.10 CUDA became a 'first-class language' and that's why we should use enable_language instead of find_module.

I had set the minimum version 3.12, because it was the latest at the time. I think 3.10 may work as well, but any lower than that won't work. Interpret these version numbers not as decimals but ..

I've installed CMake version 3.12 in my home directory on the HPC servers, so that's how I've been using it there. I'd recommend that you install the latest version from here: https://cmake.org/download/#latest
Let me know if you run into anything.

Hi Ben,

Thanks for the tips.
I installed the latest version of cmake locally in my home directory. Before, I thought that this is not possible without admin permission.
Now, I can compile everything using the cmake without any error in Linux.
For this, I updated readme with instructions on how to install latest version of cmake locally in Linux environment.

By the way, have you made any progress for the Windows installation?

@benvanwerkhoven
Copy link
Collaborator

I've made some progress, but haven't fully resolved the issues. There seems to be a bug in cmake on windows for Matlab. When I manually add libmx as a linker requirement, in addition to libmex, Visual Studio is able to compile the mexfiles for the CPU version. I plan to make a small example and report this as a bug.

Furthermore, it seems I have mismatching versions of CUDA and MS Visual Studio. I just installed the latest version of both, which are apparently incompatible. So I need to figure out which versions are compatible and then I can continue.

@hrheydarian
Copy link
Contributor Author

I've made some progress, but haven't fully resolved the issues. There seems to be a bug in cmake on windows for Matlab. When I manually add libmx as a linker requirement, in addition to libmex, Visual Studio is able to compile the mexfiles for the CPU version. I plan to make a small example and report this as a bug.

Furthermore, it seems I have mismatching versions of CUDA and MS Visual Studio. I just installed the latest version of both, which are apparently incompatible. So I need to figure out which versions are compatible and then I can continue.

OK, good.
So wouldn't it be possible to provide two different ways for compiling the code on Windows and Linux for the moment until the time we can fix this and provide a single solution?

@hrheydarian
Copy link
Contributor Author

Hi Ben,

Have you made any progress on this?

Bests,
Hamid

@benvanwerkhoven
Copy link
Collaborator

I'm sorry for the slow progress on this. I've been searching for a solution that works and is sustainable, but at this point I'm not sure if we can find a solution that is both.

I've also been looking at how other projects are handling this, for example ASTRA (https://github.com/astra-toolbox/astra-toolbox) has a set of scripts that generate the MS project build files. I was hoping that we could avoid something like that and use CMake instead.

@benvanwerkhoven
Copy link
Collaborator

Hi Hamid,

I've managed to make it work under windows, albeit with a workaround to fix the ms build files. I've pushed to a branch named 'windows' could you check it out and see if you can get it to work on your machine?

@hrheydarian
Copy link
Contributor Author

Hi Hamid,

I've managed to make it work under windows, albeit with a workaround to fix the ms build files. I've pushed to a branch named 'windows' could you check it out and see if you can get it to work on your machine?

Hi Ben,

That is great. I am going to test it on my windows machine and will let you know about the outcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants