Installing GTK3 on Haskell Platform 7.10.2a for Windows - windows

Has anyone succeeded in installing gtk2hs on Windows? I am using Haskell Platform 7.10.2a on Windows 10, both 64-bit, and tried running "cabal install gtk3", but it failed on the gio package with error message:
gcc.exe: error: unrecognized option '-pthread'
(Edit extra note: next line of error message below)
compiling dist\build\System\GIO\File\FileAttribute_hsc_make.c failed (exit code 1)
It appears that the gcc in the mingw subfolder in the Haskell Platform package is a little outdated. Is there any way to update this subfolder? The only clue I found on the Internet is the link below, which does not seem to offer any solution:
https://ghc.haskell.org/trac/ghc/ticket/10726
(Edit: version of gcc seems unrelated. '-pthread' switch appears to be invalid for gcc when run under Windows, it's only valid in Linux, see this link, but I have no idea why GHC/GTK3 is using -pthread and no idea how to change this to -mthread http://mingw-users.1079350.n2.nabble.com/pthread-vs-mthreads-td7114500.html)
Before running cabal, I installed GTK+ 3.18.0.1 on Windows using MSYS2.
I have installed gtk2hs on Linux easily with no issues at all.

Update: Also got GTK3 (bundle from below) running a Windows 10 64 bit device.
The additional step I had to accomplish was to include the libintl.def and
libintl.dll.a from an older bundle into the lib folder. I obtained those two files from a GTK2.x bundle, i.e. https://download.gnome.org/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip.mirrorlist, otherwise cabal was complaining about the missing C library intl. To sum up:
1) Obtain a GTK3 x64 bundle from the link http://www.tarnyko.net/dl/gtk.htm.
2) Obtain the missing files libintl.def and libintl.dll.a from an older
bundle, i.e. GTK2 (link from above) and include them in the lib folder.
3) Install glib first, run cabal install glib. Ensure that you have administrator privileges and GTK3/bin is on your PATH variable. Additionally,
you can set LIB and INCLUDE pointing to the GTK/lib and GTK/include folder respectively (might not be necessary).
4) Run cabal install gtk3 finally. You may use the flag --global.
(Tested on Windows 10, 64-Bit, Haskell Platform 8.x)
Installation steps for Windows 7, 64-Bit: (Original Post)
I figured it out how to install GTK3 on Windows7 (64 bit) when running
Haskell Platform 7.10.3. Therefor, I had to accomplish following steps:
Download the gtk3 64-bit bundle from http://www.tarnyko.net/dl/gtk.htm (personally I have used the 3.6 version of it)
Download the gtk3 binding https://hackage.haskell.org/package/gtk3 (0.14.5)
Install the dependencies separately. This encompasses the libraries gio, glib and pango (not cairo in my case). (cabal install package-name)
Adjust the gtk3.cabal file. I have removed following lines (all are within 5 lines):
if os(darwin)
cpp-options: -D__attribute__(A)=
-DWIN32 (just that one flag)
extra-libraries: kernel32
Adjust the gtk.h file (comes with the gtk3 bundle, include\gtk-3.0\gtk) I have defined following macros BEFORE the include operation of #include :
define GDK_VERSION_3_0 (G_ENCODE_VERSION (3, 0))
define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_0
define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_6
define GDK_DISABLE_DEPRECATION_WARNINGS
Add the path of the MinGW and gtk3 folders bin, include, lib to the PATH variable.
Run cabal install gtk3.cabal
Following tricks also helped me (command line parameters):
--gcc-options="C=LANG"
--with-gcc="path to gcc.exe"
--global
To be honest, this was more luck than knowledge. Took me several hours
to find a workaround. I had the same troubles with the gtk2 bindings for haskell. (Installing gtk2hs failure)

Related

msys2 doesn't find mingw64

I downloaded:
https://mingw-w64.org/doku.php/download/mingw-builds
https://mingw-w64.org/doku.php/download/msys2
and installed them under C:/development/msys64. Under this folder I find the msys2.exe and the mingw64 folder, which in turn contains the bin one with all the mingw executable.
I added C:/development/msys64/mingw64/bin folder to the PATH env var.
In fact from a Windows prompt I can invoke the gcc - for example. Instead inside the msys2 shell I cannot find them. I mean, they are in /mingw64/bin but they are not available at prompt.
I'm sure I missed some steps!
Method to switch from MinGW-w32 to MinGW-w64
Download the executable file of MinGW-w64 Refer the EDIT
(Executable file link may change for future releases, this is for Version 8.1.0, Kindly cross verify the latest version before installing from this link)
Installation Process (In Settings):
Version: PICK LATEST
Architecture: x86_64
Threads: posix
Exception: seh
If anyone is trying to add MinGW-w64 as a PATH variable and is not able to find the gdb.exe in C:\msys64\mingw64\bin, try looking for it in the Program files.
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
The gdb.exe and other files are located in this directory.
EDIT:
After making some changes in the launch.json file in VSCode, the MinGW-w64 GDB debugger started giving errors because there was 2 versions of MinGW in different folders i.e, MINGW and mingw64!
It is essential that the installation path does not contain any spaces
(i.e., space in "Program Files"), this will create conflicts later.
STEPS:
1. Uninstalled all the versions of GCC that was installed in the PC - Cygwin, MSYS2(32 bit) and mingw64(64 bit) and installed the MinGW-w64 again, this time using the MSYS2.
Please start afresh, if debugger is giving errors and if versions are clashing!
2. Download the MSYS2 installer from this link.
Install process is simple, follow the steps mentioned in the website!
It is essential that the installation path does not contain any spaces. Therefore, we cannot install MinGW-w64 in Program Files.
3. After Installation is complete: Open MSYS2 terminal (pink icon).
Update the package database and base packages using:
pacman -Syu
After this, Update rest of the base packages using:
pacman -Su
4. Now switch over to MSYS2 MinGW 64-bit terminal (blue icon).
To install gcc and g++ for C and C++.
For 64 bit:
pacman -S mingw-w64-x86_64-gcc
To install debugger (gdb).
For 64 bit:
pacman -S mingw-w64-x86_64-gdb
5. Now you're all SET!
Check versions:
gcc --version
g++ --version
gdb --version
6. Finally, remove the old environment variables if any are left and add the new environment variable to the PATH!
BEFORE DEBUGGING FILES IN VSCode, MAKE SURE TO ADD -g tag while building, otherwise breakpoints will be ignored by the debugger!
Footnote:
It's very important to keep all the versions in one folder, if folders are different, then life will get tough later!
MSYS2 has packages for its own GCC toolchains and you would probably be better off using those toolchains instead of downloading a different one. For example, to use a 64-bit MinGW GCC, you would have to run pacman -S x86_64-w64-mingw32-toolchain and then make sure you are starting MSYS2 using the "MinGW-w64 64-bit Shell" shortcut (or something like that) so that /mingw64/bin is on your PATH.
Also, MSYS2 does not respect your system or user environment variables; it uses its own PATH by default.

Gstreamer on windows

I'd like to build application using Gstreamer 1.0 and GTK+-3.0 on Windows 8 (64bit).
I have sucessfully install and build GTK+-3.0, 32 bit version using Dev-C++ and Mingw 32-bit (there is no 64 bit version of GTK+). Everything works perferkt. It also installed pkg-config, I addeded it in %PATH% and it works.
I have installed gstreamer-1.0-devel-x86-1.4.4.msi and gstreamer-1.0-x86-1.4.4.msi from here
1) First problem: it installed itself into I:\gstreamer\ without asking me. I am very unhappy about it, I'd like have it on C:. But its not the biggest problem.
2) pkg-config do not know about gstreamer. I have found in I:\gstreamer\1.0\x86\lib\pkgconfig\ *.pc files, so I looked into gstreamer-1.0.pc and added to my projekt this options:
C compiler:
-I"I:/gstreamer/1.0/x86/include/gstreamer-1.0/"
Linker:
-L"I:/gstreamer/1.0/x86/lib" -lgstreamer-1.0
3) Now the program was compiled, but when I run it, it was not able to find gstreamer-1.0-0.dll. So i tried copy I:\gstreamer\1.0\x86\bin\gstreamer-1.0-0.dll into to the same directory as is my compiled file. Then it was not able to find libwinptread-1.dll. So I copied it also.
Then te program run, but it faild with some error like "cannot find entry point to windows thread ..." (I do not remember it exactly). So I copied ALL dll files from I:\gstreamer\1.0\x86\bin\ and then finally the program run.
But now it is not able to create elements:
source = gst_element_factory_make ("videotestsrc", "source");
//source is null
So, my question is, how to install gstreamer, that my program will find all dll files and will be able to create elements?
installing -- choose "custom install", there you can change the installation path.
for vs you can use *.props (gstreamer\1.0\x86\share\vs\2010\libs)
you need set Environment variable - GST_PLUGIN_SYSTEM_PATH_1_0 to plug-ins. For more details see http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gst-running.html

Is it possible to set up GStreamer for use in MinGW, similar to how it's done in Linux?

Apologies for the tardy title, I'm not quite sure how to phrase this question. At its most basic, I'm attempting to compile a program with GStreamer. When running the configure script for said program I get the following error:
0:20.39 configure: checking for gstreamer-1.0 >= 1.0
0:20.39 gstreamer-app-1.0
0:20.39 gstreamer-plugins-base-1.0
0:20.39 configure: error: gstreamer and gstreamer-plugins-base development pack
ages are needed to build gstreamer backend. Install them or disable gstreamer su
pport with --disable-gstreamer
The build environment I'm compiling in:
Windows 7 (64-Bit)
MINGW & MSYS
Visual C/C++ 2010 SP1 (command line)
Now if this error occurred on a Linux distro, - say Ubuntu - it could be remedied by running the following commands:
apt-get install libgstreamer-plugins-base1.0-dev
apt-get install libgstreamer1.0-dev
What is the equivalent for Windows? I've found two type of versions that can be used: The gstreamer bin from the developer website, which has the following structure:
bin
include
lib
share
And a dynamic library of gstreamer for mingw with the following structure:
bin
lib
How am I supposed to let mingw/msys know that the gstreamer library is installed? Do I place the folders above in the relevant MSYS directories? Then, how does the configure know that it's installed and ready to be used?
I hope what I'm asking makes sense, please let me know if anything is confused. Cheers!
Using the first solution (official binaries from GStreamer), you need to tell the configure script where everything is located.
The simplest way is to set the environment variable PKG_CONFIG_PATH to where the .pc files are located. Generally it's in
$install_directory/lib/pkgconfig/
Replace $install_directory with the actual location, ex if it's installed in /c/GStreamer :
PKG_CONFIG_PATH=/c/GStreamer/lib/pkgconfig ./configure
That should make configure figure out everything

Ubuntu mingw-w64 package referencing non-existent binaries in Windows cross-compile config?

So, after installing the mingw-w64 and g++-mingw-w64 packages, I'm trying to cross-compile a QT application, running the suggested command:
qmake -spec unsupported/win32-g++-cross
However, when that runs, I get errors along the lines of:
i686-pc-mingw32-g++: Command not found
And indeed the qmake.conf file in that directory refers to binaries with that prefix i686-pc-mingw32-g++ does not exist on the system; the mingw applications installed have a i686-w64-mingw32- prefix (i686-w64-mingw32-g++ exists). Clearly, from the name of the manifest, that specification is "unsupported", but I would think it would at least refer to binaries by their proper name that were installed with the same package? Or is there something else I'm doing wrong in general to compile a QT package on Linux, for running on a Windows box after?

LLVM MinGW installation on Vista?

From llvm.org I've downloaded llvm-2.6-x86-mingw32.tar.bz2 into c:\llvm and llvm-gcc-4.2-2.6-x86-mingw32-tar.bz2 into c:\llvm-gcc as well as setup a desktop shortcut the following batch file in c:\llvm-gcc which attempts to setup an environment for compiling via the llvm-gcc command line too:
#echo off
color 0E
echo Configuring LLVM environment...
set LLVM_LIB_SEARCH_PATH=%~dp0lib
set PATH=c:\llvm;%~dp0bin;%PATH%
Unfortunately, this setup gives the following error when trying to compile a simple hello world program:
C:\CDev\sandbox>llvm-gcc -o hello.exe hello.c
llvm-gcc: CreateProcess: No such file or directory
I've briefly looked through the LLVM binaries and it appears that the MinGW-based Win32 API and runtime files are already included. I also tried adding the MinGW DLL to c:\llvm-gcc\bin to no avail.
What have I missed in setting up the binary LLVM environment and GCC-based front end on Vista?
Thanks, Jon
Because the GNU/MinGW assembler 'as' was required by 'llvm-gcc' to generate the obj file. The problem can be solved by using:
Install GNU/MinGW binutils, extract the as.exe into c:\llvm-gcc\bin
Install a full MinGW package, add %MinGW%\bin your %PATH%
#rwallace is correct that one needs to also install MinGW's binutils along with the LLVM binary download. I've updated the LLVM documentation appropriately at
http://llvm.org/docs/GettingStarted.html#installcf
As far as I can tell, the answer is that the MinGW distribution supplied by LLVM is not complete, in particular, it doesn't come with the 'binutils' programs.
The recommended solution seems to be to download and install MinGW yourself. However, the MinGW download page seems to be saying this requires 10 different packages to be downloaded and installed separately.
The solution I tried today was to use the MinGW that comes with Qt, which does come in a single package; thus far, that appears to work.
It seems like it is looking for the base MinGW installation in C:\MinGW. I just had this error today using gcc.exe in msys. To solve it, I created a symbolic link from c:\msys to c:\MinGW and everything worked.

Resources