GStreamer compilation error on Mac OS-X 64 bit - gstreamer

I have tried to compile and link Gstreamer library to a run the first tutorial but unfortunately, I get a bunch of errors. The errors are:
Can't write output file: basictutorial for architecture x86_64
gst-plugin-scanner:Failed to load plugin '/Library/GStreamer/lib/gstreamer-0.10/libgstcoreelements.so': dlopen(/Library/GStreamer/lib/gstreamer-0.10/libgstcoreelements.so, 2): no suitable image found.
Did find:
/Library/GStreamer/lib/gstreamer-0.10/libgstcoreelements.so: mach-o, but wrong architecture
The command i used in gstreamer is
gcc -I/Library/Frameworks/GStreamer.framework/Headers basic-tutorial-1.c -o basictutorial -framework GStreamer

Related

How can I fix my OpenGL build environment on OSX?

UPDATE
I've sorted this by explicitly adding the appropriate -I and -L options, but I'm curious as to why this is necessary now when it wasn't before? On the plus side those annoying library out-of-sync warnings are gone.
UPDATE ENDS
I've broken my OSX OpenGL build environment. I'm building from terminal (using make) with g++, for example:
g++ -o myprog main.o -lglfw -lglew -framework OpenGL
and getting errors:
ld: library not found for -lglfw clang: error: linker command failed with exit code 1 (use -v to see invocation)
These are in addition to compiler errors such as:
g++ -c main.cpp main.cpp:3:10: fatal error: 'GL/glew.h' file not found
So it seems the OpenGL libraries and includes have been lost. Everything was working fine until I executed the command:
export SDKROOT="$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
Which I did to try and fix warning messages like:
ld: warning: text-based stub file /System/Library/Frameworks//OpenGL.framework/OpenGL.tbd and library file /System/Library/Frameworks//OpenGL.framework/OpenGL are out of sync. Falling back to library file for linking.
I got that 'fix' from here: macOS framework lib problem
I realise it was reckless running commands that I don't fully understand but nonetheless... now I can't compile/link any OpenGL code and after scouring the internet for help I've come up with nothing, so here I am.
I'm running OSX 10.13.6 on a 2013 MacBook Pro.
First post BTW so please forgive me if I've not provided enough detail.

Problems compiling/executing GDAL in C++

I am working on a MacOS, and have just installed GDAL. Now when I type in the terminal
gdal-config --libs
I get
-L/anaconda2/lib -lgdal,
and if I type
gdal-config --cflags
I get
-I/anaconda2/include.
Now when I compile my program as
g++ myprogram.cpp -L/anaconda2/lib -lgdal -I/anaconda2/include -o myprogram
./myprogram
I get this error
dyld: Library not loaded: #rpath/libgdal.20.dylib
Referenced from: /Users/ducciopiovani/Desktop/WORK_NAMR/polygon_features_c++/./myprogram
Reason: Incompatible library version: myprogram requires version 24.0.0 or later, but libgdal.20.dylib provides version 23.0.0
Abort trap: 6
Now I had trouble installing GDAL, therefore I hav tried everything I could and perhaps installed it several times. Can I get any help on how to get this program running ?
Ciao Duccio, it looks like your installation is broken. In fact, the linker is complaining about a version mismatch.
How did you install GDAL? I suggest you to use the prebuilt frameworks provided here.

Xcode static library seems to change architecture on build

Here's a bit of background before I dive into the question. My ultimate goal is to compile the source of a c++ static library for the architectures arm64, armv7, armv7s, i386, and x86_64, and then package the libraries into a fat library so that I can use them during iOS development. This will enable me to use the simulator and a device with the same library.
Here's my issue. I'm trying to test the i386 version of the library, on it's own, using the iPhone 5 simulator. I compiled the static library for i386 as follows:
./configure --enable-utf8-only --disable-shared --host=i386-apple-darwin LDFLAGS="-L." CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
then
make CXXFLAGS="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk" CCFLAGS="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk"
This resulted in my static library, libtest.a. I then ran the follow to verify the libraries architecture
jamespc:Desktop $ lipo -info libtest.a
input file libtest.a is not a fat file
Non-fat file: libtest.a is architecture: i386
Everything seemed to look good so far. Next I added the library to my Xcode project and tried to build the project. When building the project I get the following warning and error.
ld: warning: ignoring file
/Users/cleandev/Library/Developer/Xcode/DerivedData/MyProject-hjtfdovfmdsubkejojqknkmqkzps/Build/Products/Debug-iphonesimulator/libtest.a,
file was built for archive which is not the architecture being linked (i386):
/Users/cleandev/Library/Developer/Xcode/DerivedData/MyProject-hjtfdovfmdsubkejojqknkmqkzps/Build/Products/Debug-iphonesimulator/libtest.a
Undefined symbols for architecture i386:
...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Perplexed by error I ran lipo on my static lib again, this time using the path listed in the warning, in the derived data folder.
jamespc:Debug-iphonesimulator $ lipo -info libtest.a
input file libtest.a is not a fat file
Non-fat file: libtest.a is architecture: x86_64
I'm confused as to why the library appears to have a different architecture associated with it when I take a look at it in the derived data.
Is the way I'm compiling the static library wrong?
Is there something I might be doing wrong in my Xcode build settings?
Thank you for taking the time to read my question
I guess the framework was not compiled for the iOS Simulator's architecture, which is i386. Xcode only compiles a framework for the target architecture.
Please follow this tutorial: http://www.raywenderlich.com/65964/create-a-framework-for-ios
It may help.

Can't get openGL to link in ubuntu

This is my first question on stackoverflow. I've seen a few posts related to openGL on Ubuntu, but none seem to relate to the problem I'm having.
For some reason whenever I try to build my project in eclipse-CDT I get the following console output:
**** Build of configuration Debug for project windows ****
make all
Building file: ../src/windows.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/windows.d" -MT"src/windows.d" -o "src/windows.o" "../src/windows.cpp"
Finished building: ../src/windows.cpp
Building target: windows
Invoking: GCC C++ Linker
g++ -o "windows" ./src/OGdisplay.o ./src/windows.o -lGLEW -lGL -lSDL2
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
makefile:45: recipe for target 'windows' failed
make: *** [windows] Error 1
**** Build Finished ****
I've installed the mesa-common-Dev package and all the others I could find that have to do with opengl development, but it won't budge. I put: GLEW, GL, and SDL2 in libraries under the GCC C++ linker settings. It doesn't seem to have any issues finding SDL2 and GLEW, but for some reason just can't find GL.
I went to usr/include and can clearly see the GL folder with it's contents as well as SDL2(which it has no issues finding). I've tried the same thing in codeblocks with extremely simple code and get the same result saying it can't find GL.
I'm running Ubuntu 16.04LTS with an nvidia GeForce GTX 1060. I'm also using the NVIDIA Xserver driver version 367.44. Under the nvidia Xserver settings in the OpenGL information sections it says it has version: 4.5.0 NVIDIA 367.44 if that helps. If you need anymore information just let me know, I'm almost certain that it's something simple I'm not thinking of.
Here are my CDT linker settings if it'll let me post a pick:
linker settings screenshot
SOLUTION: I'm not sure it's much of a solution, but I reinstalled NVIDIA X server and it seems to be working fine now. Not sure what was orginally causing it though.

poco library linking issue in Solaris platform

I have build the poco library in solaris. My system configuration is SunOS solaris2 5.10 Generic_144488-07 sun4v sparc SUNW,SPARC-Enterprise-T1000. When I tried to run the sample which was provided along with the sample I am able to build and run the sample application. But when I wrote a seperate program and tried to link with poco library, I am getting the following error
ld: fatal: file /74bkp/ramesh/poco-1.4.7p1/lib/SunOS/sun4v/libPocoXML.so: wrong ELF class: ELFCLASS32
ld: fatal: file /74bkp/ramesh/poco-1.4.7p1/lib/SunOS/sun4v/libPocoFoundation.so: wrong ELF class: ELFCLASS32
I use the following command to compile the source
g++ -I/74bkp/ramesh/poco-1.4.7p1/XML/include -I/74bkp/ramesh/poco-1.4.7p1/Foundation/include -L/74bkp/ramesh/poco-1.4.7p1/lib/SunOS/sun4v DOMParser.cpp -lPocoXML -lPocoFoundation -m64
Can some one please give a clue. I could not move further.
regards,
Sam Mouli
You have built 32-bit binaries of Poco, therefore you cannot link them to 64-bit binaries.
Remove the -m64 option from the compiler call and optionally add -m32, then it should work. Alternatively, build 64-bit binaries of Poco and link to them.