CppUTest examples build fails - xcode4

I am new to mac!
I download the xcode4.2 and tried to build CppUTest-v3
1)when I do make, I have the following logs
compiling AllTests.cpp
compiling AllocationInCppFile.cpp
compiling CheatSheetTest.cpp
compiling CommandLineArgumentsTest.cpp
compiling CommandLineTestRunnerTest.cpp
compiling JUnitOutputTest.cpp
compiling MemoryLeakDetectorTest.cpp
compiling MemoryLeakOperatorOverloadsTest.cpp
compiling MemoryLeakWarningTest.cpp
compiling NullTestTest.cpp
compiling PluginTest.cpp
compiling PreprocessorTest.cpp
compiling SetPluginTest.cpp
compiling SimpleStringTest.cpp
compiling TestFailureTest.cpp
compiling TestFilterTest.cpp
compiling TestHarness_cTest.cpp
compiling TestInstallerTest.cpp
compiling TestMemoryAllocatorTest.cpp
compiling TestOutputTest.cpp
compiling TestRegistryTest.cpp
compiling TestResultTest.cpp
compiling UtestTest.cpp
compiling AllocationInCFile.c
compiling TestHarness_cTestCFile.c
compiling CommandLineArguments.cpp
compiling CommandLineTestRunner.cpp
compiling JUnitTestOutput.cpp
compiling MemoryLeakDetector.cpp
compiling MemoryLeakWarningPlugin.cpp
compiling SimpleString.cpp
compiling TestFailure.cpp
compiling TestFilter.cpp
compiling TestHarness_c.cpp
compiling TestMemoryAllocator.cpp
compiling TestOutput.cpp
compiling TestPlugin.cpp
compiling TestRegistry.cpp
compiling TestResult.cpp
compiling Utest.cpp
compiling UtestPlatform.cpp
Building archive lib/libCppUTest.a
ar: creating archive lib/libCppUTest.a
a - objs/src/CppUTest/CommandLineArguments.o
a - objs/src/CppUTest/CommandLineTestRunner.o
a - objs/src/CppUTest/JUnitTestOutput.o
a - objs/src/CppUTest/MemoryLeakDetector.o
a - objs/src/CppUTest/MemoryLeakWarningPlugin.o
a - objs/src/CppUTest/SimpleString.o
a - objs/src/CppUTest/TestFailure.o
a - objs/src/CppUTest/TestFilter.o
a - objs/src/CppUTest/TestHarness_c.o
a - objs/src/CppUTest/TestMemoryAllocator.o
a - objs/src/CppUTest/TestOutput.o
a - objs/src/CppUTest/TestPlugin.o
a - objs/src/CppUTest/TestRegistry.o
a - objs/src/CppUTest/TestResult.o
a - objs/src/CppUTest/Utest.o
a - objs/src/Platforms/Gcc/UtestPlatform.o
Linking CppUTest_tests
ld: library not found for -lgcov
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [CppUTest_tests] Error 1
I found out that I can build by using the llvm make command
CC=/Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc-4.2 make
Linking CppUTest_tests
Running CppUTest_tests
..................................................
..................................................
..................................................
..................................................
..................................................
...........................................
OK (293 tests, 293 ran, 791 checks, 0 ignored, 0 filtered out, 7 ms)
2)Then I cd to the examples directory. I got the following errors. I tried to investigate but could not find out how to solve it. Your help will be appreciated.
compiling AllTests.cpp
compiling CircularBuffer.cpp
compiling CircularBufferTest.cpp
compiling EventDispatcher.cpp
compiling EventDispatcherTest.cpp
compiling HelloTest.cpp
compiling MockDocumentationTest.cpp
ApplicationLib/MockDocumentationTest.cpp:193:85: warning: expression result unused [-Wunused-value]
mock_c()->actualCall("foo")->withIntParameters("integer", 10)->returnValue().value.doubleValue;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
1 warning generated.
compiling Printer.cpp
compiling PrinterTest.cpp
compiling hello.c
Building archive lib/libCppUTestExamples.a
ar: creating archive lib/libCppUTestExamples.a
a - objs/ApplicationLib/CircularBuffer.o
a - objs/ApplicationLib/CircularBufferTest.o
a - objs/ApplicationLib/EventDispatcher.o
a - objs/ApplicationLib/EventDispatcherTest.o
a - objs/ApplicationLib/HelloTest.o
a - objs/ApplicationLib/MockDocumentationTest.o
a - objs/ApplicationLib/Printer.o
a - objs/ApplicationLib/PrinterTest.o
a - objs/ApplicationLib/hello.o
Linking CppUTestExamples_tests
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
"mock(SimpleString const&)", referenced from:
TEST_EventDispatcher_EventWithRegistrationForEventResultsIntoCallback_Test::testBody() in libCppUTestExamples.a(EventDispatcherTest.o)
TEST_EventDispatcher_RegisterTwoObserversResultIntoTwoCallsAndARegistrationNotification_Test::testBody() in libCppUTestExamples.a(EventDispatcherTest.o)
TEST_GROUP_CppUTestGroupEventDispatcher::setup() in libCppUTestExamples.a(EventDispatcherTest.o)
TEST_GROUP_CppUTestGroupEventDispatcher::teardown() in libCppUTestExamples.a(EventDispatcherTest.o)
ObserverMock::notify(Event const&, int)in libCppUTestExamples.a(EventDispatcherTest.o)
ObserverMock::notifyRegistration(EventObserver*) in libCppUTestExamples.a(EventDispatcherTest.o)
productionCode() in libCppUTestExamples.a(MockDocumentationTest.o)
...
"MockNamedValue::getIntValue() const", referenced from:
TEST_MockDocumentation_returnValue_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
TEST_MockDocumentation_setData_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
"MockNamedValue::~MockNamedValue()", referenced from:
TEST_MockDocumentation_returnValue_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
TEST_MockDocumentation_setData_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
"MockSupport::setData(SimpleString const&, int)", referenced from:
TEST_MockDocumentation_setData_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
"MockSupport::setDataObject(SimpleString const&, SimpleString const&, void*)", referenced from:
TEST_MockDocumentation_setData_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
"MockSupport::getData(SimpleString const&)", referenced from:
TEST_MockDocumentation_setData_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
"MockNamedValue::getObjectPointer() const", referenced from:
TEST_MockDocumentation_setData_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
"_mock_c", referenced from:
TEST_MockDocumentation_CInterface_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
"_mock_scope_c", referenced from:
TEST_MockDocumentation_CInterface_Test::testBody() in libCppUTestExamples.a(MockDocumentationTest.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [CppUTestExamples_tests] Error 1

I was able to find the location of CppUTest's missing libgcov.a on my Mac running Lion.
/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/libgcov.a
/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgcov.a
Apparently these locations aren't in the loaders default search path, so after linking the 64 bit variant to /usr/local/lib I was able to make CppUTest without a hiccup.
sudo ln -s /usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgcov.a /usr/local/lib/libgcov.a
Best of luck

Related

An error occurred when the ASAP(Automated Slide Analysis Platform) software was running

With the enthusiastic help of SO netizens, I configured all the environments required for ASAP (Automated Slide Analysis Platform)
The necessary libraries including Boost, Openslide, Qt, etc. have been successfully linked, but the following error occurred
====================[ Build | ASAP | Debug ]====================================
"D:\_Jason\Clion\CLion 2021.2.2\bin\cmake\win\bin\cmake.exe" --build D:\_Jason\C++_hospital\orignal\CLion1.9\ASAP-1.9\cmake-build-debug --target ASAP -- -j 9
[ 25%] Automatic MOC and UIC for target ASAP
[ 25%] Built target ASAP_autogen
[ 50%] Linking CXX executable ASAP.exe
CMakeFiles\ASAP.dir/objects.a(main.cpp.obj): In function `main':
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:6: undefined reference to `__imp__ZN12QApplicationC1ERiPPci'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:7: undefined reference to `__imp__ZN4ASAPC1EP7QWidget'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:8: undefined reference to `__imp__ZN7QWidget4showEv'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:10: undefined reference to `__imp__ZN12QApplication4execEv'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:7: undefined reference to `__imp__ZN4ASAPD1Ev'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:6: undefined reference to `__imp__ZN12QApplicationD1Ev'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:7: undefined reference to `__imp__ZN4ASAPD1Ev'
D:/_Jason/C++_hospital/orignal/CLion1.9/ASAP-1.9/ASAP/main.cpp:6: undefined reference to `__imp__ZN12QApplicationD1Ev'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\ASAP.dir\build.make:111: ASAP.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:163: CMakeFiles/ASAP.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:170: CMakeFiles/ASAP.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:168: ASAP] Error 2
It can be seen from "__imp__ZN12QApplicationD1Ev" that this is a Qt problem. The solution they gave in other forums is to add the statement QT += gui widgets core to the .pro file under this project.However, there is no .pro file in the ASAP source code, so I tried to use the qmake -project command to generate the .pro file. It still doesn't work after adding QT += gui widgets core

Cmake (Clion) cant link QT5 UiTools

I have a cmake file for various dummy Qt5 applications.
cmake_minimum_required(VERSION 3.15)
project(Qt_demo)
set(CMAKE_CXX_STANDARD 17)
# Tell cmake where Qt is located
set(Qt5_DIR "~/Code/Cpp/Qt/5.12.6/gcc_64/lib/cmake/Qt5")
#enable mocking compiler
set(CMAKE_AUTOMOC ON)
#enable ui compiler
set(CMAKE_AUTOUIC ON)
#enable resources
set(CMAKE_AUTORCC ON)
# Tell cmake to find the modules Qt5Core and Qt5widgets
find_package(Qt5 COMPONENTS Core Widgets UiTools REQUIRED)
get_target_property(QtUiTools_location Qt5::UiTools LOCATION)
message("${QtUiTools_location}")
add_executable(screenshot_demo screenshot/screenshot_main.cpp screenshot/screenshot.cpp)
# Link the library to the executable
target_link_libraries(screenshot_demo Qt5::Core Qt5::Widgets)
qt5_add_resources(RC_SRC "application/application.qrc")
add_executable(application_demo application/main.cpp application/mainwindow.cpp ${RC_SRC})
qt5_use_modules(application_demo Core Widgets)
qt5_add_resources(CALC_RC_SRC "calculator_builder/calculatorbuilder.qrc")
add_executable(calculator_builder_demo calculator_builder/main.cpp calculator_builder/calculatorbuilder.cpp ${CALC_RC_SRC})
target_link_libraries(calculator_builder_demo Qt5::UiTools Qt5::Core Qt5::Widgets )
Furthermore I added the Qt5 desinger as an external tool in clion as per setup
The first two projects compile and run just fine. However in the last project (calculator builder) I am trying to use UITools which is a Qt5 Addon. When I hit the compile button I get the following error:
[ 28%] Linking CXX executable calculator_builder_demo
/home/marc/Code/Cpp/Qt/5.12.6/gcc_64/lib/libQt5UiTools.a(properties.o): In function `QFormInternal::variantToDomProperty(QFormInternal::QAbstractFormBuilder*, QMetaObject const*, QString const&, QVariant const&)':
/home/qt/work/qt/qttools/src/designer/src/uitools/../lib/uilib/properties.cpp:594: undefined reference to `QString::arg(QLatin1String, int, QChar) const'
/home/marc/Code/Cpp/Qt/5.12.6/gcc_64/lib/libQt5UiTools.a(formbuilderextra.o): In function `QFormInternal::QFormBuilderExtra::readUi(QIODevice*)':
/home/qt/work/qt/qttools/src/designer/src/uitools/../lib/uilib/formbuilderextra.cpp:145: undefined reference to `QVersionNumber::fromString(QStringView, int*)'
/home/qt/work/qt/qttools/src/designer/src/uitools/../lib/uilib/formbuilderextra.cpp:150: undefined reference to `QString::arg(QStringView, int, QChar) const'
collect2: error: ld returned 1 exit status
CMakeFiles/calculator_builder_demo.dir/build.make:137: recipe for target 'calculator_builder_demo' failed
make[3]: *** [calculator_builder_demo] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/calculator_builder_demo.dir/all' failed
make[2]: *** [CMakeFiles/calculator_builder_demo.dir/all] Error 2
CMakeFiles/Makefile2:89: recipe for target 'CMakeFiles/calculator_builder_demo.dir/rule' failed
make[1]: *** [CMakeFiles/calculator_builder_demo.dir/rule] Error 2
Makefile:118: recipe for target 'calculator_builder_demo' failed
make: *** [calculator_builder_demo] Error 2
I am totally lost. Any help would be greatly appreciated

Error while packaging application - Flex ANE

We are integrating Push notification with AppBoy SDK in our Flex project.
We are created ANE but while packaging application got error like this
Error occurred while packaging the application:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:
objc-class-ref in libcom.fingent.appboyapn.a(ABKDevice.o)
"_CTFontManagerRegisterGraphicsFont", referenced from:
-[ABKInAppMessageViewController applyIconToLabelView:] in libcom.fingent.appboyapn.a(ABKInAppMessageViewController.o)
"_SLServiceTypeFacebook", referenced from:
+[ABKFacebookDataProvider facebookAccountExistsInIOS] in libcom.fingent.appboyapn.a(ABKFacebookDataProvider.o)
___85+[ABKFacebookDataProvider fetchAndPostFacebookDataAccessPromptWithSuccessCompletion:]_block_invoke in libcom.fingent.appboyapn.a(ABKFacebookDataProvider.o)
"_ACFacebookPermissionsKey", referenced from:
+[ABKFacebookDataProvider fetchAndPostFacebookDataAccessPromptWithSuccessCompletion:] in libcom.fingent.appboyapn.a(ABKFacebookDataProvider.o)
"_ACFacebookAppIdKey", referenced from:
+[ABKFacebookDataProvider fetchAndPostFacebookDataAccessPromptWithSuccessCompletion:] in libcom.fingent.appboyapn.a(ABKFacebookDataProvider.o)
"_ACAccountTypeIdentifierFacebook", referenced from:
+[ABKFacebookDataProvider fetchAndPostFacebookDataAccessPromptWithSuccessCompletion:] in libcom.fingent.appboyapn.a(ABKFacebookDataProvider.o)
"_OBJC_CLASS_$_SLRequest", referenced from:
objc-class-ref in libcom.fingent.appboyapn.a(ABKFacebookDataProvider.o)
"_OBJC_CLASS_$_ACAccountStore", referenced from:
objc-class-ref in libcom.fingent.appboyapn.a(ABKFacebookDataProvider.o)
"_OBJC_CLASS_$_SLComposeViewController", referenced from:
objc-class-ref in libcom.fingent.appboyapn.a(ABKFacebookDataProvider.o)
ld: symbol(s) not found for architecture armv7
Compilation failed while executing : ld64
Have your ANE been recompiled to 64bit from old 32bit xcode compile? If not you need to do this to compile w Apache Flex SDK above 16 (check doc for exact version...) Someplace on this site is a nifty ANT compiler that I used once: http://easynativeextensions.com/making-your-ios-apps-universal/ Good luck.

CocoaAsyncSocket Apple Mach-O Linker Error

I need to receive TCP packets using CocoaAsyncSocket. When I'm importing that library to Xcode and trying to run my application, it gives me Apple Mach-O Linker Errors:
Undefined symbols for architecture i386:
"_kCFStreamErrorDomainMach", referenced from:
-[AsyncSocket errorFromCFStreamError:] in AsyncSocket.o
"_kCFStreamErrorDomainNetDB", referenced from:
-[AsyncSocket errorFromCFStreamError:] in AsyncSocket.o
"_kCFStreamErrorDomainNetServices", referenced from:
-[AsyncSocket errorFromCFStreamError:] in AsyncSocket.o
"_kCFStreamErrorDomainSystemConfiguration", referenced from:
-[AsyncSocket errorFromCFStreamError:] in AsyncSocket.o
"_kCFStreamPropertySSLSettings", referenced from:
-[AsyncSocket maybeStartTLS] in AsyncSocket.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So, What Can I do???
You just need to add SecurityFramework in the Frameworks.
I also met this similar problem.

How to build Quazip 0.5.1 on Windows 7?

I'm trying to build the quazip libary (version 0.5.1) on Windows 7 (32-bit) with Qt 5.0.1 32-Bit LGPL installed.
When i run in the Qt-Commandprompt:
qmake
mingw32-make
with the directory set to the folder in which I extracted Quazip (C:\Qt\quazip-0.5.1\quazip), I get the following error-log:
C:\Qt\quazip-0.5.1\quazip>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Qt/quazip-0.5.1/quazip'
g++ -Wl,-s -shared -mthreads -Wl,--out-implib,release\libquazip.a -o release\qua
zip.dll object_script.quazip.Release -LC:\Qt\Qt5\5.0.1\mingw47_32\lib -lQt5Core
./release\unzip.o:unzip.c:(.text+0x1008): undefined reference to `crc32'
./release\unzip.o:unzip.c:(.text+0x10aa): undefined reference to `inflate'
./release\unzip.o:unzip.c:(.text+0x10da): undefined reference to `crc32'
./release\unzip.o:unzip.c:(.text+0x1110): undefined reference to `crc32'
./release\unzip.o:unzip.c:(.text+0x1327): undefined reference to `inflateEnd'
./release\unzip.o:unzip.c:(.text+0x1727): undefined reference to `get_crc_table'
./release\unzip.o:unzip.c:(.text+0x186f): undefined reference to `inflateInit2_'
./release\zip.o:zip.c:(.text+0xac7): undefined reference to `crc32'
./release\zip.o:zip.c:(.text+0xb7c): undefined reference to `deflate'
./release\zip.o:zip.c:(.text+0xcdf): undefined reference to `deflate'
./release\zip.o:zip.c:(.text+0xef5): undefined reference to `deflateEnd'
./release\zip.o:zip.c:(.text+0x13a8): undefined reference to `get_crc_table'
./release\zip.o:zip.c:(.text+0x1af9): undefined reference to `deflateInit2_'
./release\quaadler32.o:quaadler32.cpp:(.text+0x2e): undefined reference to `adle
r32'
./release\quaadler32.o:quaadler32.cpp:(.text+0x61): undefined reference to `adle
r32'
./release\quaadler32.o:quaadler32.cpp:(.text+0xa1): undefined reference to `adle
r32'
./release\quaadler32.o:quaadler32.cpp:(.text+0xb1): undefined reference to `adle
r32'
c:/qt/qt5/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64
-mingw32/bin/ld.exe: ./release\quaadler32.o: bad reloc address 0x0 in section `.
rdata$_ZTI13QuaChecksum32[__ZTI13QuaChecksum32]'
collect2.exe: error: ld returned 1 exit status
Makefile.Release:106: recipe for target 'release\quazip.dll' failed
mingw32-make[1]: *** [release\quazip.dll] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/quazip-0.5.1/quazip'
makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
But in my Zlib-Folder (C:\Qt\Qt5\5.0.1\Src\qtbase\src\3rdparty\zlib) are all this listed files installed.
.
As I tried to solve the problem, I have added into the quazip.pro and into the quazip.pri:
INCLUDEPATH += $$[QT_INSTALL_PREFIX]/src/3rdparty/zlib
, how it is suggested here.
All other solutiuons I have found on Google so far aren't helping.
I hope someone of you can help me.
Greetings,
LVreg
The problem is that QuaZIP can not find the zlib library. You should include the path of the headers an also the libraries when you run qmake:
qmake "INCLUDEPATH+=C:/Qt/Qt5/5.0.1/Src/qtbase/src/3rdparty/zlib" "LIBS+=-LC:/Qt/Qt5/5.0.1/Src/qtbase/src/3rdparty/zlib -lz"
mingw32-make
There is a full explanation in my blog if you want to check it out: http://www.antonioborondo.com/2014/10/22/zipping-and-unzipping-files-with-qt/
Here is what worked for me (QuaZip 0.7 on Windows 7 compiled with MSVC13 32 bits):
In the command line type:
SET INCLUDE=<PathToZib\include>;%INCLUDE%
SET LIB=<PathToZib\lib>;%LIB%
qmake PREFIX=<FolderWhereInstallWillPutFiles> LIBS+=<PathToZib\lib>/zdll.lib
nmake
nmake install
everything between <> must be changed to your applicable path
NOTE:
in the LIBS+= part use / instead of \ as folders delimiter
try to make the lib of quazip on windows - look here:
https://www.maefloresta.com/wiki/doku.php?id=quazip_windows
but - try the following command - instead of "make" take "mingw32-make".

Resources