make test Qt test case - duplicated symbol - qt

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?

Related

Linking error for RInside on Mac OS X 11.6 (Big Bur): pcre2-8 library not found

This is likely an error installing PCRE2 (which I did using "sudo port install pcre2"), but when I "make" sample code for RInside, I get:
$ make rinside_sample0
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include rinside_sample0.cpp -L/usr/local/lib -F/Library/Frameworks/R.framework/.. -framework R -L/usr/local/lib -lpcre2-8 -llzma -lbz2 -lz -licucore -ldl -lm -liconv -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/Library/Frameworks/R.framework/Resources/lib -lRlapack /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/lib/libRInside.a -o rinside_sample0
In file included from rinside_sample0.cpp:10:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/include/RInside.h:26:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/include/RInsideCommon.h:38:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:57:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data'
[-Wunused-variable]
SEXP data = Parent::get__();
^
1 warning generated.
ld: library not found for -lpcre2-8
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [rinside_sample0] Error 1
$
Thank you for the comment, Dirk. You got me pointed in the correct direction. I had two old versions of code: pcre2 and Rcpp.
I followed the directions for installing the latest version of "pcre2" here: https://izziswift.com/how-to-install-pcre-development-headers-on-mac-osx/.
I downloaded "pcre" version 10.39, cd'd to that directory, ran:
./configure
make
make install
After that, the examples in RInside compiled, but I got a runtime error:
$ ./rinside_sample0
Error: function 'Rcpp_precious_remove' not provided by package 'Rcpp'
Execution halted
$
Some searching showed that error arose from running an older version (1.0.6) of "Rcpp". I went into RStudio, typed "install.packages("Rcpp")" to update to version 1.0.7 and now everything runs!
Hopefully going through these steps will help anyone else who encounters these problems.

sourceCpp() fails to work in R 3.4.3: clang error [duplicate]

This question already has answers here:
Mac OS X R error "ld: warning: directory not found for option"
(12 answers)
Closed 4 years ago.
I have just updated R to the latest version on my iMac.
When trying to source an Rcpp file via sourceCpp() from RStudio, I get the error
ld: warning: directory not found for option '- L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_3.so] Error 1
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include - I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/i nclude" -I"/Users/jarrett/Desktop/HAC simulation" -I/usr/local/include -fPIC -Wall -g -O2 -c accumulate.cpp -o accumulate.o
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o sourceCpp_3.so accumulate.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
Error in sourceCpp("accumulate.cpp") :
Error 1 occurred building shared library.
Any thoughts on how to proceed with resolving the issue?
Check out the following article which seems to match the problems you have posted and presents a solution: Rcpp, RcppArmadillo and OS X Mavericks "-lgfortran" and "-lquadmath" error

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

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 .

How install package from source in Mac OS when fortran is needed in R?

I am having problems installing the Package packfor form source in Mac OS X Yosemite in the R software. I know that the package depends on fortran compiler, so I installed the gfortran available in CRAN but it does not affect anything. Bellow I am reproducing the error log.
please if anyone has any advice on this would be much appreciated.
Thanks in advance
install.packages("~/Downloads/packfor_0.0-8.tar", repos =
NULL,type="source")
installing source package ‘packfor’ ...
** libs clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c forward.c -o forward.o forward.c:411:3: warning: implicit declaration of function 'dgesvd_' is invalid in C99 [-Wimplicit-function-declaration]
F77_CALL(dgesvd)(&jobu, &jobvt,&size, &size,A, &size,
D,U,&size,V,&size,&work1, &lwork,&error); ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22:
note: expanded from macro 'F77_CALL'
define F77_CALL(x) x ## _
^ :8:1: note: expanded from here dgesvd_ ^ forward.c:421:43: warning: data argument not used by
format string [-Wformat-extra-args]
fprintf(stderr, "error in dinvG: ", error);
~~~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Resources/include/R_ext/Error.h:51:15:
note: expanded from macro 'error'
define error Rf_error
^ 2 warnings generated. clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o packfor.so forward.o -L/Library/Frameworks/R.framework/Resources/lib
-lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation Warning message: In install.packages("~/Downloads/packfor_0.0-8.tar", repos = NULL, :
installation of package ‘/Users/rafael/Downloads/packfor_0.0-8.tar’
had non-zero exit status ld: warning: directory not found for option
'-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2' ld: library not
found for -lquadmath clang: error: linker command failed with exit
code 1 (use -v to see invocation) make: *** [packfor.so] Error 1
ERROR: compilation failed for package ‘packfor’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/packfor’
>

Installation of Qt Messaging framework in mac?

Can some one explain the steps that are needed to include Messaging framework in to a Qt Application?
I have downloaded the Open source Project that contains the Messaging framework from this link:
http://get.qt.nokia.com/qt/solutions/qt-mobility-opensource-src-1.1.0-beta2.tar.gz
UPDATE:
Raised a bug with Nokia.
http://bugreports.qt.nokia.com/browse/QTSDK-229
Running build steps for project
writemessage... Configuration
unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w make:
Entering directory
/Users/xxxxxxx/Qt/qt-mobility-opensource-src-1.1.0-beta2/examples/writemessage-build-simulator'
g++ -c -pipe -g -gdwarf-2 -arch x86_64
-Xarch_x86_64 -mmacosx-version-min=10.5 -arch ppc -arch i386 -Wall -W -DQT_NO_PRINTER -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../../NokiaQtSDK/Simulator/Qt/gcc/mkspecs/macx-g++
-I../writemessage -I../../../../NokiaQtSDK/Simulator/Qt/gcc/lib/QtCore.framework/Versions/4/Headers
-I../../../../NokiaQtSDK/Simulator/Qt/gcc/include/QtCore
-I../../../../NokiaQtSDK/Simulator/Qt/gcc/lib/QtGui.framework/Versions/4/Headers
-I../../../../NokiaQtSDK/Simulator/Qt/gcc/include/QtGui
-I../../../../NokiaQtSDK/Simulator/Qt/gcc/include
-I/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/include/QtMessaging
-I/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/include/QtMobilitySimulator
-I../../src/global -I../../src/messaging -I/Users/xxxxxxx/install/include -I/Users/xxxxxxx/install/include/QtMobility
-I/Users/xxxxxxx/install/include/QtMessaging
-I../../../../Build/Debug/writemessage/moc
-I. -F/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/lib
-o ../../../../Build/Debug/writemessage/messagesender.o
../writemessage/messagesender.cpp g++
-headerpad_max_install_names -arch x86_64 -Xarch_x86_64
-mmacosx-version-min=10.5 -arch ppc -arch i386 -o writemessage.app/Contents/MacOS/writemessage
../../../../Build/Debug/writemessage/messagesender.o
../../../../Build/Debug/writemessage/main.o
../../../../Build/Debug/writemessage/moc_messagesender.o
-F/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/lib
-L/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/lib
-F/Users/xxxxxxx/lib -L/Users/xxxxxxx/lib -framework Message
-F/Users/xxxxxxx/install/Library/Frameworks
-L/Users/xxxxxxx/install/Library/Frameworks
-framework QtMobilitySimulator -framework QtMessaging -framework QtGui
-L/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib -F/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib -framework QtNetwork -framework QtCore ld: warning: directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -L not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -L not found ld: warning:
directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -F not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -F not found ld: framework
not found QtMobilitySimulator
collect2: ld returned 1 exit status
ld: warning: directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -L not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -L not found ld: warning:
directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -F not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -F not found ld: framework
not found QtMobilitySimulator
collect2: ld returned 1 exit status
ld: warning: directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -L not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -L not found ld: warning:
directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -F not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -F not found ld: framework
not found QtMobilitySimulator
collect2: ld returned 1 exit status
lipo: can't open input file:
/var/folders/CP/CP8sR5YZGx0b2xA2gYP5YE+++TI/-Tmp-//ccoxcfz2.out
(No such file or directory) make: ***
[writemessage.app/Contents/MacOS/writemessage]
Error 1 make: Leaving directory
/Users/xxxxxxx/Qt/qt-mobility-opensource-src-1.1.0-beta2/examples/writemessage-build-simulator'
The process "/usr/bin/make" exited
with code %2. Error while building
project writemessage (target: Qt
Simulator) When executing build step
'Make'
Add this to your .pro file:
macx {
LIBS += -framework Message
}
And include headers this way:
#include <Message/MessageExport.h>
This should work with Qt 4.7.

Resources