Cocos2dx Firebase CPP without Pod Integration - c++

I want to integrate Cocos2dx v4 cpp project with Firebase (I am using firebase_cpp_sdk_8.11.0). This has been successfully integrated in Android. The problem that I am facing right now is integrate with IOS (without Pod). I already followed this link https://medium.com/firebase-developers/how-to-use-firebase-in-ios-games-written-in-c-fef1a6a9f87d and official Google Firebase tutorial but still failed.
The step that I did was:
Create a new project Cocos2dx with command
cocos new CocosFirebase -p <com.your_company.your_game> -l cpp -d .
Download the firebase_cpp_sdk and put inside the folder (follow the tutorial made a folder third_party). Modify the CMakeLists.txt and add this code below
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/firebase_cpp_sdk)
target_link_libraries(${APP_NAME}
firebase_analytics
firebase_messaging
firebase_app
)
Run the cmake and try to build the project (inside the Xcode is also can). Without section 2 above, the project can be built successfully. With Firebase code in CMakeLists.txt, it failed with error below (error build both in simulator or product any ios device arm64 amv7).
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FIROptions", referenced from:
objc-class-ref in libfirebase_app.a(app_ios.mm.o)
"_OBJC_CLASS_$_FIRConfiguration", referenced from:
objc-class-ref in libfirebase_app.a(app_ios.mm.o)
"_OBJC_CLASS_$_UNUserNotificationCenter", referenced from:
objc-class-ref in libfirebase_messaging.a(messaging.mm.o)
"_OBJC_CLASS_$_FIRApp", referenced from:
objc-class-ref in libfirebase_app.a(app_ios.mm.o)
"_OBJC_CLASS_$_FIRMessaging", referenced from:
objc-class-ref in libfirebase_messaging.a(messaging.mm.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also tried to link the library needed as stated in here Firebase Undefined symbols for architecture x86_64 but no luck. Or tried also to link directly inside the xcframework that provided from firebase cpp sdk.
Please note that I have successfully integrate with Android, and due to complexity and issue with Pod, I would like to integrate directly since Firebase also provide CPP SDK.
Any help will be much appreciated. Thanks.

I have exactly the same issue with my project using the Qt framework.
It looks like you're only using the firebase-cpp SDK.
This issue seems to be relative : https://github.com/firebase/firebase-cpp-sdk/issues/19
You might miss the native FirebaseIOS libs which the firebase-cpp-sdk wraps: https://firebase.google.com/download/ios

Related

dyld: Library not loaded: /usr/local/opt/gsl/lib/libgsl.23.dylib

I am trying to get a piece of software called emergent working. It relies on qt and coin, which I've both installed.
But when I try to run emergent, I get the following error:
dyld: Library not loaded: /usr/local/opt/gsl/lib/libgsl.23.dylib
Referenced from: /usr/local/bin/emergent
Reason: image not found
Abort trap: 6
gsl 2.6 is already installed on my computer. Also using Mac OS. Any ideas what could be causing this?
ls /usr/local/opt/gsl
see which version of the library you have (I had .25)
then
ln -s libgsl.25.dylib libgsl.23.dylib
Makes symbolic link between files.
then it worked!

cocos2dx admob/firebase not woking

I am trying to integrate firebase into my cocos2dx project using the following this link
I have install firebase core and firebase admob in pod file. My pod file looks like this:
**source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
# Replace "MyGame" with the name of your game.
target 'MyGame-mobile' do
pod 'Firebase'
pod 'Firebase/AdMob'
end**
I have successfully install admob and firebase in my project but I cannot use it in my project. As soon as I'm trying to add this header file into my project it gives me an error which looks like:
**The project does not compile. This is the error:
Apple Mach-O Linker (ld) Error Group
“OBJC_CLASS$_FIRApp”, referenced from:
“OBJC_CLASS$_FIROptions”, referenced from:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried to add $(inherited) in Build Settigs > “Other Linker Flags” and these errors disappear, but this persist:
Apple Mach-O Linker (ld) Error Group
clang: error: linker command failed with exit code 1 (use -v to see invocation)**

Upgrading from Cocos2D 0.99.5 to 2.1 resulting in 3 errors

I was attempting to upgrade Cocos2D in my existing project resulting in issues no one knew how to solve, so I decided to start with fresh project then migrate my files over. I'm not sure when this happened but now I have 3 errors:
1.) Lexical or Preprocessor Issue
'XCTest/XCTest.h' file not found
2.) ld: file not found: /Users/Admin/Library/Developer/Xcode/DerivedData/test_cocos2d_proj-atnaeyeebjlopnbgbcqjaoeylldh/Build/Intermediates/test cocos2d proj.build/Debug-iphonesimulator/test cocos2d proj.build/Objects-normal/i386/cocos2d_libraryTests.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
3.) error: unable to open executable '/Users/Admin/Library/Developer/Xcode/DerivedData/test_cocos2d_proj-atnaeyeebjlopnbgbcqjaoeylldh/Build/Products/Debug-iphonesimulator/test cocos2d proj.app/test cocos2d proj'

Using Boost Library on an example code causing Undefined symbols error?

I wish to run an example code g++ reference_counted.cpp, but the program produced an error
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
__static_initialization_and_destruction_0(int, int) in ccD1hl7z.o
boost::system::error_code::error_code() in ccD1hl7z.o
boost::asio::error::get_system_category() in ccD1hl7z.o
"boost::system::generic_category()", referenced from:
__static_initialization_and_destruction_0(int, int) in ccD1hl7z.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Running brew doctor produces the following warnings, but it's unclear what is causing the failure. How can this be fixed?
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/opt/local/bin/curl-config
/opt/local/bin/freetype-config
/opt/local/bin/icu-config
/opt/local/bin/libpng-config
/opt/local/bin/libpng15-config
/opt/local/bin/nc-config
/opt/local/bin/ncurses5-config
/opt/local/bin/ncursesw5-config
/opt/local/bin/pcre-config
/opt/local/bin/ppl-config
/opt/local/bin/python-config
/opt/local/bin/python2.7-config
/opt/local/bin/xml2-config
Warning: /Library/Frameworks/Mono.framework detected
This can be picked up by CMake's build system and likely cause the build to
fail. You may need to move this file out of the way to compile CMake.
Warning: You have MacPorts or Fink installed:
/opt/local/bin/port
This can cause trouble. You don't have to uninstall them, but you may want to
temporarily move them out of the way, e.g.
sudo mv /opt/local ~/macports
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libasan.0.dylib
/usr/local/lib/libatomic.1.dylib
/usr/local/lib/libgcc_ext.10.4.dylib
/usr/local/lib/libgcc_ext.10.5.dylib
/usr/local/lib/libgcc_s.1.dylib
/usr/local/lib/libgfortran.3.dylib
/usr/local/lib/libgomp.1.dylib
/usr/local/lib/libitm.1.dylib
/usr/local/lib/libmca_common_sm.3.dylib
/usr/local/lib/libmpi.1.dylib
/usr/local/lib/libmpi_cxx.1.dylib
/usr/local/lib/libmpi_f77.1.dylib
/usr/local/lib/libompitrace.0.dylib
/usr/local/lib/libopen-pal.4.dylib
/usr/local/lib/libopen-rte.4.dylib
/usr/local/lib/libopen-trace-format.1.dylib
/usr/local/lib/libotfaux.0.dylib
/usr/local/lib/libquadmath.0.dylib
/usr/local/lib/libssp.0.dylib
/usr/local/lib/libstdc++.6.dylib
/usr/local/lib/libvt-hyb.0.dylib
/usr/local/lib/libvt-mpi-unify.0.dylib
/usr/local/lib/libvt-mpi.0.dylib
/usr/local/lib/libvt-mt.0.dylib
/usr/local/lib/libvt.0.dylib
Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
/usr/local/lib/libasan.la
/usr/local/lib/libatomic.la
/usr/local/lib/libgfortran.la
/usr/local/lib/libgmp.la
/usr/local/lib/libgomp.la
/usr/local/lib/libitm.la
/usr/local/lib/libmca_common_sm.la
/usr/local/lib/libmpc.la
/usr/local/lib/libmpfr.la
/usr/local/lib/libmpi.la
/usr/local/lib/libmpi_cxx.la
/usr/local/lib/libmpi_f77.la
/usr/local/lib/libmpi_f90.la
/usr/local/lib/libompitrace.la
/usr/local/lib/libopen-pal.la
/usr/local/lib/libopen-rte.la
/usr/local/lib/libopen-trace-format.la
/usr/local/lib/libotfaux.la
/usr/local/lib/libquadmath.la
/usr/local/lib/libssp.la
/usr/local/lib/libssp_nonshared.la
/usr/local/lib/libstdc++.la
/usr/local/lib/libsupc++.la
/usr/local/lib/libvt-hyb.la
/usr/local/lib/libvt-mpi-unify.la
/usr/local/lib/libvt-mpi.la
/usr/local/lib/libvt-mt.la
/usr/local/lib/libvt-pomp.la
/usr/local/lib/libvt.la
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .pc files:
/usr/local/lib/pkgconfig/ompi-c.pc
/usr/local/lib/pkgconfig/ompi-cxx.pc
/usr/local/lib/pkgconfig/ompi-f77.pc
/usr/local/lib/pkgconfig/ompi-f90.pc
/usr/local/lib/pkgconfig/ompi.pc
/usr/local/lib/pkgconfig/orte.pc
Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/libatomic.a
/usr/local/lib/libgfortran.a
/usr/local/lib/libgmp.a
/usr/local/lib/libgomp.a
/usr/local/lib/libitm.a
/usr/local/lib/libmpc.a
/usr/local/lib/libmpfr.a
/usr/local/lib/libmpi_f90.a
/usr/local/lib/libopen-trace-format.a
/usr/local/lib/libotfaux.a
/usr/local/lib/libquadmath.a
/usr/local/lib/libssp.a
/usr/local/lib/libssp_nonshared.a
/usr/local/lib/libstdc++.a
/usr/local/lib/libsupc++.a
/usr/local/lib/libvt-hyb.a
/usr/local/lib/libvt-mpi-unify.a
/usr/local/lib/libvt-mpi.a
/usr/local/lib/libvt-mt.a
/usr/local/lib/libvt-pomp.a
/usr/local/lib/libvt.a
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
python
Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd /usr/local/Library && git stash && git clean -d -f
Warning: Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
/usr/local/facebook/arcanist/bin/
Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
echo export PATH="/usr/local/sbin:$PATH" >> ~/.bash_profile
Warning: Your Xcode (4.6.2) is outdated
Please install Xcode 5.0.
467502-mitll:Boost ch24515$ echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile
467502-mitll:Boost ch24515$ g++ reference_counted.cpp
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
__static_initialization_and_destruction_0(int, int) in ccmaaqd0.o
boost::system::error_code::error_code() in ccmaaqd0.o
boost::asio::error::get_system_category() in ccmaaqd0.o
"boost::system::generic_category()", referenced from:
__static_initialization_and_destruction_0(int, int) in ccmaaqd0.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
467502-mitll:Boost ch24515$ brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/opt/local/bin/curl-config
/opt/local/bin/freetype-config
/opt/local/bin/icu-config
/opt/local/bin/libpng-config
/opt/local/bin/libpng15-config
/opt/local/bin/nc-config
/opt/local/bin/ncurses5-config
/opt/local/bin/ncursesw5-config
/opt/local/bin/pcre-config
/opt/local/bin/ppl-config
/opt/local/bin/python-config
/opt/local/bin/python2.7-config
/opt/local/bin/xml2-config
Warning: /Library/Frameworks/Mono.framework detected
This can be picked up by CMake's build system and likely cause the build to
fail. You may need to move this file out of the way to compile CMake.
Warning: You have MacPorts or Fink installed:
/opt/local/bin/port
This can cause trouble. You don't have to uninstall them, but you may want to
temporarily move them out of the way, e.g.
sudo mv /opt/local ~/macports
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libasan.0.dylib
/usr/local/lib/libatomic.1.dylib
/usr/local/lib/libgcc_ext.10.4.dylib
/usr/local/lib/libgcc_ext.10.5.dylib
/usr/local/lib/libgcc_s.1.dylib
/usr/local/lib/libgfortran.3.dylib
/usr/local/lib/libgomp.1.dylib
/usr/local/lib/libitm.1.dylib
/usr/local/lib/libmca_common_sm.3.dylib
/usr/local/lib/libmpi.1.dylib
/usr/local/lib/libmpi_cxx.1.dylib
/usr/local/lib/libmpi_f77.1.dylib
/usr/local/lib/libompitrace.0.dylib
/usr/local/lib/libopen-pal.4.dylib
/usr/local/lib/libopen-rte.4.dylib
/usr/local/lib/libopen-trace-format.1.dylib
/usr/local/lib/libotfaux.0.dylib
/usr/local/lib/libquadmath.0.dylib
/usr/local/lib/libssp.0.dylib
/usr/local/lib/libstdc++.6.dylib
/usr/local/lib/libvt-hyb.0.dylib
/usr/local/lib/libvt-mpi-unify.0.dylib
/usr/local/lib/libvt-mpi.0.dylib
/usr/local/lib/libvt-mt.0.dylib
/usr/local/lib/libvt.0.dylib
Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
/usr/local/lib/libasan.la
/usr/local/lib/libatomic.la
/usr/local/lib/libgfortran.la
/usr/local/lib/libgmp.la
/usr/local/lib/libgomp.la
/usr/local/lib/libitm.la
/usr/local/lib/libmca_common_sm.la
/usr/local/lib/libmpc.la
/usr/local/lib/libmpfr.la
/usr/local/lib/libmpi.la
/usr/local/lib/libmpi_cxx.la
/usr/local/lib/libmpi_f77.la
/usr/local/lib/libmpi_f90.la
/usr/local/lib/libompitrace.la
/usr/local/lib/libopen-pal.la
/usr/local/lib/libopen-rte.la
/usr/local/lib/libopen-trace-format.la
/usr/local/lib/libotfaux.la
/usr/local/lib/libquadmath.la
/usr/local/lib/libssp.la
/usr/local/lib/libssp_nonshared.la
/usr/local/lib/libstdc++.la
/usr/local/lib/libsupc++.la
/usr/local/lib/libvt-hyb.la
/usr/local/lib/libvt-mpi-unify.la
/usr/local/lib/libvt-mpi.la
/usr/local/lib/libvt-mt.la
/usr/local/lib/libvt-pomp.la
/usr/local/lib/libvt.la
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .pc files:
/usr/local/lib/pkgconfig/ompi-c.pc
/usr/local/lib/pkgconfig/ompi-cxx.pc
/usr/local/lib/pkgconfig/ompi-f77.pc
/usr/local/lib/pkgconfig/ompi-f90.pc
/usr/local/lib/pkgconfig/ompi.pc
/usr/local/lib/pkgconfig/orte.pc
Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/libatomic.a
/usr/local/lib/libgfortran.a
/usr/local/lib/libgmp.a
/usr/local/lib/libgomp.a
/usr/local/lib/libitm.a
/usr/local/lib/libmpc.a
/usr/local/lib/libmpfr.a
/usr/local/lib/libmpi_f90.a
/usr/local/lib/libopen-trace-format.a
/usr/local/lib/libotfaux.a
/usr/local/lib/libquadmath.a
/usr/local/lib/libssp.a
/usr/local/lib/libssp_nonshared.a
/usr/local/lib/libstdc++.a
/usr/local/lib/libsupc++.a
/usr/local/lib/libvt-hyb.a
/usr/local/lib/libvt-mpi-unify.a
/usr/local/lib/libvt-mpi.a
/usr/local/lib/libvt-mt.a
/usr/local/lib/libvt-pomp.a
/usr/local/lib/libvt.a
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
python
Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd /usr/local/Library && git stash && git clean -d -f
Warning: Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
/usr/local/facebook/arcanist/bin/
Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
echo export PATH="/usr/local/sbin:$PATH" >> ~/.bash_profile
Warning: Your Xcode (4.6.2) is outdated
Please install Xcode 5.0.
Add -lboost_system to your linker flags:
g++ reference_counted.cpp -lboost_system
You need to link your application to boost_system library. I think for asio you also need boost_thread, so in summary it's:
g++ -lboost_system -lboost_thread reference_counted.cpp

Library not loaded on terminal but runs ok on Xcode

I built a command line tool within Xcode and it runs ok, but when I try to run it from the terminal it complains about one of my libs:
MacBook:Debug Jonathan$ ./MyApp
dyld: Library not loaded: /Users/Jonathan/Library/Frameworks/Josk.framework/Versions/A/Josk
Referenced from: /Users/Jonathan/Development/C++/MyApp/build/Debug/./MyApp
Reason: image not found
Trace/BPT trap
on my MyApp project I added a copy phase (destination: framework, no path and didn't mark the only-on-installing checkbox) to the target and on the directory of MyApp I can see the Josk.framework copied.
Thanks,
Jonathan
export DYLD_FRAMEWORK_PATH=/Users/Jonathan/Library/Frameworks
or
copy Josk.framework to /Users/Jonathan/Library/Frameworks
For deployment, there are various options such as #executable_path, #loader_path, #rpath.
see, man dyld

Categories