How to configure cmake for msys2 - cmake

I'm using external cmake with msys2, since cmake-gui provided by msys2 won't run (invalid win32 application). Now the problem is there's only so much I can configure using cmake-gui. I downloaded OpenALSoft today and when I ran make install it installed to C:\Program Files (x86)\. How do I configure external cmake to install into mingw32 or mingw64 depending on what's running? On top of that, I'm having a problem differentiating between PATH RPATH and PREFIX (and how those correspond to msys2 install structure), so if you could, please, clarify those too, I'd really appreciate that.

I always use this invocation to make sure the install directory is set to /mingw32 or /mingw64:
MSYS2_ARG_CONV_EXCL=- cmake . -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX
And then when you want to install the built project, you must do this:
make install DESTDIR=/
All of this trickiness is due to the fact that CMake is a native Windows program that does not understand MSYS2-style paths like /, and MSYS2 has some automatic conversions of paths that happen when it detects you are running a native Windows program like CMake.
By the way, MSYS2's cmake-gui works for me, so maybe you should try reinstalling the CMake package in MSYS2 or something. However, I expect my answer to work for both the external CMake and the one in MSYS2.

Related

CMake: "The C compiler identification is unknown" in Windows SDK

This is the first time I've come across CMake. When I follow CMake instructions to extract a C# project, it give the below error.
Selecting Windows SDK version to target Windows 10.0.15063.
The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
No CMAKE_C_COMPILER could be found.
CMake Error in CMakeLists.txt:
No CMAKE_CXX_COMPILER could be found.
I tried to fix the error by googling, but not able to find the problem yet. Can someone please help me.
Note:
I am running CMake on a Windows 10 computer, that has Windows 8.1 SDK, Visual studio 2015, 2017 installed.
I was having the same issue with a very similar system configuration. In my case, it appears to have been related to this question which pointed me to this bug report.
So the fix (for me) was to update CMake:
Uninstall your current version of CMake.
If you installed it using an installer script, you'll need to run the uninstaller as noted on CMake.org.
Installer tool has changed. Uninstall CMake 3.4 or lower first!
If you installed a zipped portable version, you can simply delete it and/or move it out of your PATH environment variable.
Download the latest CMake (at time of writing, 3.14.5). This time I opted to install the zipped version and manually add it to my PATH environment variable since I only ever use CMake from command prompt anyway, but you're welcome to use the MSI instead.
And after that everything worked fine! Hope this helps.

How to install g++ in Cygwin?

I'm trying to compile a piece of MATLAB code containing a makefile. For the reason that I'm using Windows, I need to use Cygwin.
I have downloaded and installed Cygwin. When I tried to compile the code using make, there was an error that g++ is not found.
I searched for Cygwin package manager on the net and I installed apt-cyg but when I search for g++ using apt-cyg search g++, there is no result there!
I have updated package list (apt-cyg update) but finally I could not find c++ compiler for Cygwin!
How can I do it by apt-cyg package manager or any other way?
Try installing the package cygport. It will take care of many of the dependencies you need, including g++.
Finally I could find the answer in this link.
If one uses the MinGW installation file again, one can add some other packages.
I installed all Devel packages for MinGW and followed this tutorial which helped me to solve the problem.
If using apt-cyg and looking for g++ I would suggest to look up for the name gcc-g++ instead of just g++.
In this case the command would look like:
apt-cyg search gcc-g++ - for searching the package
or
apt-cyg install gcc-g++ - for installing the package
Hint:
Names of packages can be checked on the "Select Packages" page of the Cygwin installation program. There is no need to install, sometimes it is easier just to check the name of a package and cancel the installation.

msys2 and mingw64 gcc version mismatch? (msys-perl)

I just installed msys2 and mingw64, with their development packages. I really need perl-Gtk3. Perl is msys2 and compiled with gcc-4.9.x, Gtk and friends are mingw and compiled with gcc-5.
Perl complains "Glib.c: loadable library and perl binaries are mismatched (got handshake key 0xde00080, needed 0xdd80080)" when building Glib. Should this work?
Thanks.
PS ... mingw-w64-x86_64-perl is simply unable to compile. And yes, I'm careful to use a mingw shell vs an msys shell.
Are you still having this problem? I have been able to build a Perl dev environment in MinGW64, current as of this time.
I have been able to build Perl Gtk2 / Gtk3 applications in that environment and the GUIs work. (Both Gtk2 and Gtk3 based). These applications are used in a production environment with several thousand desktop users. The application runs on OSX, Windows, and Linux, and can be packed into a binary for release as an "executable" for those operating systems. The details here are for the Windows version.
I do this by either installing the requisite system packages first with pacman, then as necessary rebuilding whatever system library packages that I may have modified, from source, using makepkg-mingw.
Then I build the requisite Perl modules using the CPAN shell, and the "look" command.
I use pkg-config to detect what library and header files are needed.
I then build (at minimum), the Perl Glib, Pango, Cairo, Gtk2, and Gtk3 modules using the perl Makefile.PL command.
The LIBS and INC options need to be added to that command to create a Makefile that includes the correct header files, and links to the correct libraries. The EXTRALIBS and LDLOADLIBS sections of the Makefile needs be correct.
Also ExtUtils::MM_Win32.pm ExtUtils::Liblist::Kid.pm needed to be edited due to the different archname reported by the MinGW64 perl.
I am only giving a general answer, because I was thinking offing a YouTube video on this. If this is a desired topic I will.

CMake not able to find Qt4

I'm working on a project using PCL (point cloud library) for which I need to configure some code files using CMake. But some of these files aren't getting configured and the error CMake shows for those files is "Qt4 not found". I already have Qt 4.8 installed and this is the only Qt version I have. Also, for some of the other files, CMake used Qt without showing any error. And when I run qmake.exe, it shows "Qt : Untested windows version 6.2 detected". And for all the Qt5 related entries, CMake shows "NOT FOUND". Have I installed the correct version of Qt? And how can I get CMake to detect Qt4?
I'm using windows 8.1 64bit
When I typed qmake -v in command prompt, I got this -
Qt: Untested Windows version 6.2 detected!
QMake version 2.01a
Using Qt version 4.8.0 in C:\Qt\4.8.0\lib
cmake to find Qt users qmake, so if you run it not from command line,
make sure that global environment variable PATH set to proper value, so cmake can find qmake
cmake cache libraries search results, bad results also. Because of that, if it can find some library, you install it, then rerun cmake it can show again "library not found" message, even if your setup is corrret. So make sure to remove CMakeCache.txt before rerun cmake.

Troubling Compiling wxWidgets with MinGW

I am having trouble compiling wxwidgets with mingw on Windows 7 x64. It compiles for 30+ min, then runs out of memory. My computer has 6 GB of memory, so I don't know what is wrong.
Someone mentioned something about a 64 bit version of MinGW. Would this help, and if so, how would I use this?
I am able to compile just fine with Visual Studio.
Also, if I wish to use it with CodeBlocks, how do I add wxWidgets to CodeBlocks (I.e. link to it)?
Actually, I somehow solved my own problem a few days ago, but forgot to note this up here.
I deleted the wxWidgets folder, reinstalled it, then compiled it according to the directions in a zip file here: http://dev.arqendra.net/#cbnb.
After you have installed wxWidgets, fire up msys, cd to the wxwidgets folder, then run
mingw32-make -f makefile.gcc BUILD=debug UNICODE=1
(Assuming mingw32-make is in your path).
Wait a while (maybe 20 minutes, depending on your computer's processing power).
Repeat this for release i.e.:
mingw32-make -f makefile.gcc BUILD=release UNICODE=1
Next, you have to deal with a quirk by copying \wxWidgets\include\wx\msw\setup.h to \wxWidgets\include\wx.
You can apply other options to your liking.
Also, to "add" wxWidgets to a project in C::B, you can just set up a wxWidgets project, saving you the trouble of adding the right directories (and .a libraries).
I used MinGW 4.5, installed using the "MinGW GCC 4.5.0 Installer" from their site. To compile wxWidgets using MinGW, I used:
cd %WXDIR%\build\msw
mingw32-make -f makefile.gcc BUILD=debug RUNTIME_LIBS=static
In codeblocks there is a dialog for setting the path for MinGW. You set the path for wxWidgets in the new app wizard. I really recommend you set the same MinGW version you used to compile wxWidgets.
This is probably due to this gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601#c9 you may try installing another version of gcc.