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

Compiling on MSYS2 using MinGW-w64 compilers #631

Closed
Foadsf opened this issue Mar 19, 2020 · 3 comments · Fixed by #634
Closed

Compiling on MSYS2 using MinGW-w64 compilers #631

Foadsf opened this issue Mar 19, 2020 · 3 comments · Fixed by #634

Comments

@Foadsf
Copy link

Foadsf commented Mar 19, 2020

Following this SO question, here I want to summarize the steps I took so far using MinGW-w64 compilers in MSYS2 environment to compile BASIS:

  1. Edited the basis\include\basis\gtest\gtest.h according to here
  2. In the basis\src\utilities\cxx\stio.cxx the _dupenv_s doesn't exist on GCC, so they should be probably replaced by getenv_s
  3. The CMake command should be something like cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/<useName>/local -DBUILD_APPLICATIONS:BOOL=ON -DBUILD_EXAMPLE:BOOL=ON -DCMAKE_MAKE_PROGRAM=mingw32-make.exe .. -G "MSYS Makefiles"
@schuhschuh
Copy link
Contributor

schuhschuh commented Mar 23, 2020

Thanks for this concise list, this is very helpful. Do you want to send me a PR for the fix of gtest?

If you have one for stdio.cxx, that be great as well. Otherwise I'll make the changes myself.

Regarding CMAKE_MAKE_PROGRAM, it may be that you would need to set your PATH variable within the MSYS2 environment appropriately if you want to avoid having to set it explicitly? This seems a typical issue coming up with MinGW and MSYS generators. Not sure it's something that should be addressed on BASIS' end.

See for example, KDAB/GammaRay#239.

@Foadsf
Copy link
Author

Foadsf commented Mar 25, 2020

@schuhschuh thanks for the reply. I'm actually not at the level of confidence to send any PRs on this repository. So I would appreciate it if you could help by taking care of it yourself.

It would also very help full if you could keep this project alive. To my best understanding, there are no better alternatives for the moment.

P.S. You may wanna take a look at the Cookiecutter project.

@schuhschuh
Copy link
Contributor

Sorry for the delay. I fixed the compilation issues with MinGW GCC (used MSYS2 subsystem mingw64), i.e., non-MSVC compiler on Windows. See linked pull request for details.

Regarding CMake, I didn't manage myself to be able to use "MSYS Makefiles" generator with the CMake version installed with pacman. Neither the one from msys2 subsystem, nor mingw64. The generators "MinGW Makefiles" and "MSYS Makefiles" were simply not known. Instead, I simply used the native CMake Windows installation as follows:

export PATH="/c/Program\ Files/CMake/bin:$PATH"
cmake -G "MSYS Makefiles" -D BUILD_APPLICATIONS=ON -D BUILD_EXAMPLE=ON ..
cmake --build . --config Release

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

Successfully merging a pull request may close this issue.

2 participants