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.
Related
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
I'm trying to compile my OpenMP program, but it doesn't work, this error message shows:
fatal error: 'omp.h' file not found
I've tried the solutions for this problem here, but nothing worked with me.
please help
I'm Mac user
You probably need to reinstall with:
brew reinstall gcc --without-multilib
Then you need to make sure you use the homebrew version of gcc (rather than anything Apple supplies) by running gcc-5 rather than plain gcc. You can check its name and version by running the following because homebrew normally always installs everything to /usr/local/bin:
ls /usr/local/bin/gcc*
Finally, you need to add the -fopenmp flag to your compiler invocation to tell the compiler to do the OpenMP thing.
So, your command will look like:
gcc-5 -fopenmp program.c -o program
Just recently I tried to install GTK+ on Windows 7 using all-in-one bundle and latest MinGW package. I proceeded with all steps of official tutorial. Lurking through several tutorials, especially this one helped me getting MinGW and MSYS set up, so GCC sure works. The command
pkg-config --cflags --libs gtk+-3.0
printed out the expected set of paths/options. However, when I tried to run either
gcc -o gtk3.exe gtk3.c (pasted 'pkg-config' output)
or
gcc -o gtk3.exe gtk3.c `pkg-config --cflags --libs gtk+-3.0`
I've got
gcc: error: gtk3.c: No such file or directory
as a result. Searching the file manually was no success as well. It seems that Windows command prompt has torn the original long command apart, but I don't think that it would be this way if GCC has initialized gtk3.c.
I believe that official tutorial can't be wrong, so please help me resolve this problem.
Best regards, Mathias.
A Windows installation tutorial for GTK+ might not be the most thoroughly tested thing... This is a better version of that page, it includes a link to the source file (although any GTK+ "hello world" code will do).
You could file a bug on the missing link and images as well if you want to help others.
The issue I'm having is that gcc (and family) don't appear to be properly setup. I have a 10.7.4 machine that I just installed Xcode on (from the app store). I've done no prior development on this machine.
Working w/in Xcode seems to work fine. I can build and compile no problem. However, trying to execute gcc command line fails.
First, I gcc wasn't on my path ... no big deal. I located it and ran as:
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -dynamiclib -fno-common -o s.dylib s.c
(I'm working on a lib w/some functions...). Anyways, it fails.
s.c:1:19: error: stdio.h: No such file or directory
s.c:2:20: error: stdlib.h: No such file or directory
s.c:3:20: error: string.h: No such file or directory
Surprise! hah, well I searched my machine for stdio.h and I can't find it anywhere. Since I've been out of the OSX game for a bit, I'm assuming I'm missing something -
Basically I want to be able to continue using Xcode but I want to be able to build C/C++/etc on the command line with all the dependencies (.h) in the correct place.
Any thoughts?
There are two main ways to run the compiler from the command line: the Command Line Tools package, and xcrun.
xcrun is particularly good if you just need this occasionally. Just stick "xcrun" at the start, like you'd do with sudo:
xcrun gcc -dynamiclib -fno-common -o s.dylib s.c
This will find the correct version of gcc and set the needed directories, etc. You can specify a specific SDK with --sdk.
If you do this a lot, download and install the Command Line Tools package (Xcode>Open Developer Tool>More Tools...; it also may be available in Preferences>Downloads). This installs a full copy of everything in /usr.
Probably xcrun is not enough if you are using 10.8.
Looking in to the clang documentation I found that you need to include the system root because you do not have your libraries in the standard place but inside Xcode.
using:
xcrun gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
or:
xcrun clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
I just upgraded from Snow Leopard to Lion, and an old python c-extension that I had to update didn't want to compile properly. I don't really know what to do here. Anyone who could help me out so it compiles ok? It compiled just fine back in Snow Leopard.
Home:folder Me$ python setup.py build
running build
running build_ext
building 'ccookies' extension
gcc -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ccookies.c -o build/temp.macosx-10.3-fat-2.7/ccookies.o
llvm-gcc-4.2: error trying to exec '/Developer/usr/bin//../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
In file included from /usr/include/architecture/i386/math.h:630,
from /usr/include/math.h:28,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,
from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,
from ccookies.c:5:
/usr/include/AvailabilityMacros.h:109:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
lipo: can't figure out the architecture type of: /var/folders/_t/yg4wppss5fv6dkmh89_6ykm40000gn/T//cc3Cgr3v.out
error: command 'gcc' failed with exit status 255
You appear to be using a 32-bit Python 2.7, possibly installed from python.org. Because of changes in Xcode 4 (dropping of support for the 10.4u SDK and gcc-4.0) it is not practical to build C extension modules with that Python on 10.7 Lion. Either use the Apple-supplied Python 2.7 (/usr/bin/python2.7) or install the python.org 64-bit/32-bit installer for 2.7.2 instead of the 32-bit-only one.
I was trying to install pynauty on my Mac OS X 10.7 and I got this problem. For some reasons, Ned Deily's answer didn't help me. I just want to provide one more way to solve this problem in case someone come to this page and is in the same situation as I am. The way I solved this prolem is:
Before running "python setup.py build", run:
export ARCHFLAGS="-arch x86_64"
On travis, I was getting this error. I've been using osx_image: osx10.11 since forever, but it suddenly stopped working, with this error, in last ~few weeks. Changing to osx_image: xcode7.3 fixed the error for me.