I've installed MSYS2 on Windows 7 and I have successfully executed
pacman -S mingw-w64-x86_64-gtk3
(the above as per Step 2 of Setting up GTK for Windows) and
pacman -S mingw-w64-x86_64-toolchain base-devel
but when I try to compile the hello world with
gcc -o hello-world-gtk hello-world-gtk.c `pkg-config --cflags --libs gtk4`
I get the following
Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk4', required by 'virtual:world', not found
bash: gcc: command not found
If I try from MinGW 64-bit shell the output is
MyHome#MyHome-PC MINGW64 ~
$ gcc -o hello-world-gtk hello-world-gtk.c `pkg-config --cflags --libs gtk4`
Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk4', required by 'virtual:world', not found
hello-world-gtk.c:1:10: fatal error: gtk/gtk.h: No such file or directory
1 | #include <gtk/gtk.h>
| ^~~~~~~~~~~
compilation terminated.
I've also checked that
$ echo $PKG_CONFIG_PATH
/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig
the above as per Step 2 of Setting up GTK for Windows
They seem to have some outdated instructions on their site.
I actually have had to setup the following package
pacman -S mingw-w64-x86_64-gtk4
A couple of possible runtime issues
Then I could compile the example but it is not running fine. I still get a runtime error:
---------------------------
hello-world-gtk.exe - Errore di sistema
---------------------------
Impossibile avviare il programma perché libgio-2.0-0.dll non è presente nel computer. Per risolvere il problema, provare a reinstallare il programma.
Looking at this issue I've tried adding C:\msys64\mingw64\bin to my sys PATH: it does not show the runtime error but the exe is really not working anyway (the app does not show up as expected).
AFAICS gtk4-demo-application itself is not running fine on my Windows, so finally I've had to revert to GTK3 and I compiled the example the GTK3 getting started
gcc `pkg-config --cflags gtk+-3.0` -o example-1 example-1.c `pkg-config --libs gtk+-3.0`
and the above compiles and runs fine.
Solution of the runtime issue
Otherwise, there is the option to build GTK4 on Windows from source without MSYS2.
It is very important this note
It works out of the box on my VirtualBox machine, however on my physical PC with an intel GPU, I get a crash at startup:
Unhandled exception at 0x5211345E (ig4icd32.dll) in gtk4-demo.exe: 0xC0000005: Access violation reading location 0x00000050
This can be worked around by using cairo rendering:
C:\src\gtk>set GSK_RENDERER=cairo
C:\src\gtk>C:\gnome\bin\gtk4-demo.exe
Conclusion: procedure for GTK4 on MSYS2
In conclusion set GSK_RENDERER=cairo is the same fix that does the trick also to run the executable compiled under MSYS2, therefore the final solution consists of
installing pacman -S mingw-w64-x86_64-gtk4
adding C:\msys64\mingw64\bin; in the start of the PATH system environment variable
adding a new GSK_RENDERER system environment variable with value cairo
use the MSYS2 MinGW 64 bit shell to compile (as GTK4) and run the exe
Related
I downloaded Halide binaries for Linux. For compiling the tutorial programs(especially the autoscheduler program), I need to install g++ version 5.3. But, I am not able to install this particular version. How to solve the problem? Please find the instructions below copied from the link : https://github.com/halide/Halide/releases
Update 1:
I ran the command sudo apt install g++-5.3 . I got the error "Unable to locate the package g++5.3"
Update 2:
These are some of the errors I get.
Update 4:
I want to run this program :
https://halide-lang.org/tutorials/tutorial_lesson_21_auto_scheduler_generate.html.
The linux command is given at the very top of the above link. I am pasting it below:
g++ lesson_21_auto_scheduler_generate.cpp ../tools/GenGen.cpp -g -std=c++11 -fno-rtti -I ../include -L ../bin -lHalide -lpthread -ldl -o lesson_21_generate
Additionally, I moved the "libHalide.a" file from the lib folder to the bin folder and executed the commmand.
The problem is that you're on Windows, as your references to x86_64-pc-cygwin and /cygdrive/c in your screenshot indicate, but you're trying to use the Linux binaries. Cygwin is only source-compatible with Linux programs, not binary-compatible. Here's your choices:
Use the Windows or MinGW downloads instead of the Linux ones (you may have to switch to MinGW)
In Ubuntu in VirtualBox, just install g++ instead of g++-5.3, and then use the Linux download there
Compiling the Gstreamer Program works with no issues but when i try to run the output on MacOS it says "Illegal instruction: 4" and I can't figure out why this is happening.
I tried using -mmacosx-version-min=10.x 'x' being 6,7,8,9,10,11 and exported all these values as the same in the MACOSX_DEPLOYMENT_TARGET environment variable. Still running this gives me an error of "Illegal instruction: 4"
gcc basic-tutorial-1.c pkg-config --cflags --libs gstreamer-1.0, also gcc basic-tutorial-1.c pkg-config --cflags --libs gstreamer-1.0 -mmacosx-version-min=10.6 but running ./a.out gives the same error.
Now it's supposed to play the video from "basic-tutorial-1" but it does not play that instead it just drops this error "Illegal Instruction: 4".
Just compiling the application with that MACOSX_DEPLOYMENT_TARGET probably wont help you here. Most likely it is the Gstreamer library itself that has been compiled with an instruction set not available on your machine (SSE/AVX or alike). Is this via macports/brew or the official GStreamer .pkg? If none of the binary distributions support your CPU you may have to rebuild the GStreamer library yourself for your system.
I met this problem and it turned out that the libaries installed using brew were not working properly. For me, I would need to install from Mac pkg files here:
After installing those pkgs, mac would not link the libs automatically for you. So you would need to type the following command to set ENV PKG_CONFIG_PATH so that pkg-config could find the libs:
export PKG_CONFIG_PATH=/Library/Frameworks/GStreamer.framework/Libraries/pkgconfig:$PKG_CONFIG_PATH
You should be able to build with the following command afterwards:
gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs gstreamer-1.0`
However, I found that there is something wrong with mac's video display for basic-tutorial-1. See this.
When I run
gcc test.c
in the terminal of msys,
I get the error
test.c:1:18: fatal error: x264.h: No such file or directory
#include <x264.h>
I can find the x264.h in /local/include
$ ls /local/include/
x264.h x264_config.h
Why MinGW gcc doesn't search the default place?
It's not a "default place" for MinGW GCC. The fact that you're calling native Win32 GCC from the MSYS shell does not mean it knows about these Unix paths MSYS conjures up.
Either install to the / directory or add your 3rd party library directory to the include paths on the commandline:
-I/local/include
Note the above only works from within the MSYS shell.
I'm using Cygwin on windows to run this command:
g++ `pkgconfig --libs --cflags opencv` -I. -o mergevec mergevec.cpp ....
But I get an error:
-bash: pkg-config: command not found
I've installed cygwin directly on C:. I've added to the PATH environment variable the following:
C:\cygwin64\bin;
C:\cygwin64\lib
I've run cygcheck -c and it gives me a whole list of packages, but pkg-config isn't in that list.
There is a folder called pkgconfig in C:\cygwin64\lib though.
How do I fix this error?
pkg-config is a piece of software that allow your computer to check installed libraries for source compilation. It may not be installed on Windows so in last scenario please check for install.
However in your case i think it is installed, but not set on the right path for linux commands. Try to type in cygwin:
$ export PKG_CONFIG_PATH=c:\\cygwin\\usr\\local\\lib\\pkgconfig
as stated in this post.
Otherwise just abandon Windows and try to compile mergevec on an Linux VM, which is really easier (it was made for it). The only down point of this method is that you will have to do the mergevec operation (and the ones before, otherwise you may have encoding problems) under your linux space. See my previous answer for this manipulation.
If any problem don't hesitate.
run cgywin setup and in package search type pkg-config then make sure that pkg-config utility is installed.
it should solve the not found command problem.
I think that in this case it has nothing to do with the PKG_CONFIG_PATH, because the user complains on the "command not found" error message.
The user probably mixes up pkg-config as a tool (with -) and pkgconfig (without -) as a directory as I see from the command. If I run it without dash on my system I get the same error message of course:
$ pkgconfig --libs --cflags opencv
-bash: pkgconfig: command not found
On Cygwin there is pkgconf.exe as a tool, pkg-config as a symlink to it and pkgconfig as a directory. There is no tool pkgconfig.
If it is not found as pkg-config then it means that pkg-config tool is missing in the Cygwin installation (the solution is to upgate Cygwin tools and select it in the checkbox) or it is probably the symlink problem which I described in https://stackoverflow.com/a/66037850/4807875 (the solution in this case is to use the indeed Cygwin console instead of the native cmd.exe with C:\Cygwin64\bin in PATH in it, or to call explicitly pkgconf.exe).
I was trying to install gcc and gfortran on my intel mac with mountain lion and keep getting the above error when trying to compile the fortran file. gcc doesn't seem to work either with c programs. This is the error I get with my c program:
test.c:1:19: fatal error: stdio.h: No such file or directory
I tried typing this into terminal:
export PATH=${PATH}:/usr/local/bin
but that did not work. I added gcc and gfortran to /usr/local/bin instead of /usr/bin. I downloaded the compilers through hpc. The files had the given directory structure:
/usr/local/bin: contained gcc and gfortran along with other compilers
/uer/local/include/...
/usr/local/lib/...
etc...
I pretty much just copied and pasted all the files directly over to the exact same path directories on my computer and ran the export command. That is all I have done.
You probably need either odcctools (as provided by macports) or XCode (which contains the Mac "binutils", and the Clang compiler, GCC was discontinued).