How can I make ffmpeg executable file separately by using gcc command? - qt

actually, my goal is to use ffmpeg on Qt platform. But tow of them is unfamiliar with me..
I tried command on ./ffmpeg directory after build (./configure, make, sudo make install) as below on Mac (os x) 10.12.4 (Sierra)
$ gcc ffmpeg.c -o a.out -I /usr/local/include -I /Users/koseonjae/ffmpeg -L /usr/local/lib -lavdevice -lavutil -lavformat -lavcodec -lavutil -lx264 -lvpx -lvorbisenc -lvorbis -ltheoraenc -ltheoradec -logg -lmp3lame -lbz2 -lz -lxslt -lfdk-aac -liconv -lopus -lx265 -lxvidcore -lpng16 -lswresample -framework CoreFoundation -framework CoreServices -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework AVFoundation -framework CoreMedia -framework CoreVideo -framework CoreAudio -framework Foundation -framework Security -framework VideoDecodeAcceleration -framework VideoToolbox
I added many library, but result is as below
/Users/koseonjae/ffmpeg/ffmpeg2.h:157:8: error: unknown type name 'BOOL'
static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType);
/Users/koseonjae/ffmpeg/ffmpeg2.h:157:19: error: expected ';' after top level declarator
static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType);
what library should I add?? thank you!

This question is not about Qt, but about compiling ffmpeg on a Mac.
Read on about detailed installation of ffmpeg dependencies: https://trac.ffmpeg.org/wiki/CompilationGuide/MacOSX .

Related

rJava package installation on Mac 10.14

I’m running into issues while trying to install the rJava package on my Mac. I have tried the solutions proposed online, including running R CMD javareconf, but without success (output is below). Any advice on how to fix this issue would be much appreciated.
Among the things I tried is the solution proposed here: rJava installation fails on macOS 10.14
open macOS_SDK_headers_for_macOS_10.14.pkg```
This had worked for me with my previous Mac, but not this time.
Output of:
```sudo R CMD javareconf```
Java interpreter : /usr/bin/java
Java version : 12.0.2
Java home path : /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
/usr/local/Cellar/gcc/9.1.0/bin/gcc-9 -I"/usr/local/Cellar/r/3.6.1/lib/R/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/include/darwin -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -fPIC -g -O2 -c conftest.c -o conftest.o
/usr/local/Cellar/gcc/9.1.0/bin/gcc-9 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.6.1/lib/R/lib -L/usr/local/Cellar/gcc/9.1.0/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/lib/server -ljvm -L/usr/local/Cellar/r/3.6.1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
ld: library not found for -lintl
collect2: error: ld returned 1 exit status
make: *** [conftest.so] Error 1
Unable to compile a JNI program
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/local/Cellar/r/3.6.1/lib/R
Done.

make test Qt test case - duplicated symbol

While following test case example, I stuck at making.
My procedure is as below.
~/Qt/5.12.2/clang_64/bin/qmake -project "QT +=testlib"
=> it generated Testcase.pro
~/Qt/5.12.2/clang_64/bin/qmake
=> Makefile was generated
~/Qt/5.12.2/clang_64/bin/moc -o testqstring.moc testqstring.h
=> testqstring.moc was generated
make
=> moc_predefs.h and moc_testqstring.cpp were generated, and print error as below.
❯ make
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.12 -Wl,-rpath,#executable_path/../Frameworks -Wl,-rpath,/Users/sungyong/Qt/5.12.2/clang_64/lib -o Testcase.app/Contents/MacOS/Testcase testqstring.o moc_testqstring.o -F/Users/sungyong/Qt/5.12.2/clang_64/lib -framework QtGui -framework QtTest -framework Security -framework Foundation -framework ApplicationServices -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
duplicate symbol __ZN11TestQString18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZN11TestQString11qt_metacallEN11QMetaObject4CallEiPPv in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZNK11TestQString10metaObjectEv in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZTV11TestQString in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZTS11TestQString in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZTI11TestQString in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZN11TestQString11qt_metacastEPKc in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZN11TestQString16staticMetaObjectE in:
testqstring.o
moc_testqstring.o
ld: 8 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Testcase.app/Contents/MacOS/Testcase] Error 1
What did I mistake?

OS X clang rpy2

I'm trying to install the python library rpy2 in OS X (El Capitan) with R 3.4.
I did follow many posts on web and I end up replacing clang from xcode to one manually installed (after following http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/#clang-before-3-4-0):
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /usr/bin
Still, when I tried to install rpy2 (sudo pip3 install rpy2):
clang -bundle -undefined dynamic_lookup build/temp.macosx-10.11-x86_64-3.6/./rpy/rinterface/_rinterface.o -L/usr/local/lib -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -Lbuild/temp.macosx-10.11-x86_64-3.6 -L/usr/local/lib -lpcre -llzma -lbz2 -lz -licucore -lm -liconv -lr_utils -o build/lib.macosx-10.11-x86_64-3.6/rpy2/rinterface/_rinterface.cpython-36m-darwin.so -fopenmp -F/Library/Frameworks/R.framework/.. -framework R
ld: library not found for -lomp
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
What's lomp? I'm not sure what I can do now.
UPDATE:
I try to reinstall llvm through brew:
brew reinstall --with-clang --with-lld --with-python --HEAD llvm
now installing rpy2 I got:
clang -bundle -undefined dynamic_lookup build/temp.macosx-10.11-x86_64-3.6/./rpy/rinterface/_rinterface.o -L/usr/local/lib -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -Lbuild/temp.macosx-10.11-x86_64-3.6 -L/usr/local/lib -lpcre -llzma -lbz2 -lz -licucore -lm -liconv -lr_utils -o build/lib.macosx-10.11-x86_64-3.6/rpy2/rinterface/_rinterface.cpython-36m-darwin.so -fopenmp -F/Library/Frameworks/R.framework/.. -framework R
ld: library not found for -lomp
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
Although from the llvm installation I got the advice:
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/llvm/lib
CPPFLAGS: -I/usr/local/opt/llvm/include
do you know how to set it? It may be the reason it fails
This was discussed on the rpy2 issue tracker: https://bitbucket.org/rpy2/rpy2/issues/403/cannot-pip-install-rpy2-with-latest-r-340
Note that the issue was resolved and a precompiled binary wheel for rpy2-2.9.3 is now available on pypi.

Undefined symbols for architecture armv7: "_OBJC_CLASS_$_FIRApp"

I am integrating Firebase in my app according to the instructions and added [FIRApp configure]; in the code however, while compiling the app I am getting the following error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_FIRApp", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture armv7
Did CocoaPods write any warnings due to pods installation? I fixed a similar issue by setting OTHER_LDFLAGS build settings to $(inherited) flag.
s.static_framework = true
to podspec worked for me
URL: How to use Firebase SDK as a Pod dependency?
Updating the pod "Architectures" to $(ARCHS_STANDARD) worked for me.
Put
$(inherited) -ObjC -framework "AVFoundation" -framework "AudioToolbox" -framework "CFNetwork" -framework "CoreGraphics" -framework "CoreMedia" -framework "CoreMotion" -framework "CoreTelephony" -framework "CoreVideo" -framework "GLKit" -framework "GoogleMobileAds" -framework "MediaPlayer" -framework "MessageUI" -framework "MobileCoreServices" -framework "OpenGLES" -framework "QuartzCore" -framework "Security" -framework "StoreKit" -framework "SystemConfiguration" -weak_framework "AdSupport" -weak_framework "JavaScriptCore" -weak_framework "SafariServices" -weak_framework "WebKit"

install rJava - One or more JNI types differ from the corresponding native type on Mac Os 10.11

I am trying to get a working R environnement on my mac.
I just updated to Mac OS 10.11.1.
From rStudio, install.packages("rJava") leads to this error:
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver : '/usr/bin/jar'
compiler : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags : '-I/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/../include/darwin'
java libs : '-L/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/lib/server -ljvm'
checking whether Java run-time works... yes
checking whether -Xrs is supported... yes
checking whether JNI programs can be compiled... yes
checking JNI data types...
configure: error: One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this.
ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/local/lib/R/3.2/site-library/rJava’
The output of R CMD javareconf is:
Java interpreter : /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/bin/java
Java version : 1.8.0_66
Java home path : /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
Java compiler : /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/javac
Java headers gen.: /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/javah
Java archive tool: /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/jar
System Java on OS X
trying to compile and link a JNI program
detected JNI cpp flags : -I/System/Library/Frameworks/JavaVM.framework/Headers
detected JNI linker flags : -framework JavaVM
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I/usr/local/include -fPIC -g -O2 -c conftest.c -o conftest.o
conftest.c:4:5: warning: 'JNI_CreateJavaVM' is deprecated [-Wdeprecated-declarations]
JNI_CreateJavaVM(0, 0, 0);
^
/System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1937:1: note: 'JNI_CreateJavaVM' has been explicitly marked deprecated here
JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
^
1 warning generated.
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress - L/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/lib - L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -o conftest.so conftest.o -framework JavaVM -F/usr/local/Cellar/r/3.2.2_1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
Java library path:
JNI cpp flags : -I/System/Library/Frameworks/JavaVM.framework/Headers
JNI linker flags : -framework JavaVM
Updating Java configuration in /usr/local/Cellar/r/3.2.2_1/R.framework/Resources
I have no clue. Any idea to fix this?
Thanks
I had exactly the same problem, and finally resolved, via a solution I found here.
The new Mac OS X (10.11, El Capitan) has trouble with env variables.
The newest dev flavor of rJava manages to handle things correctly. Here is what I did to resolve it:
Download version 0.9-8 (rJava_0.9-8.tar.gz) from here
Install it from the downloaded source:
$ R CMD INSTALL ~/Downloads/rJava_0.9-8.tar.gz
(Or wherever you put it)
That's all it took!

Resources