在linux上使用firebase C ++ SDK的问题,由于某种原因,它会从库内部引发分段错误。
我有下一个代码:
#include <iostream>
#include "firebase/app.h"
#include "firebase/analytics.h"
extern "C" int common_main(int argc, const char* argv[]);
int main(int argc, const char* argv[]) {
return common_main(argc, argv);
}
int common_main(int argc, const char* argv[]) {
namespace analytics = ::firebase::analytics;
::firebase::App* app;
::firebase::AppOptions appOptions;
appOptions.set_app_id("project-540NUMBERNUMBER67RR"); // changed
appOptions.set_api_key("CoDeCoDeCoDeCoDeOcDeCoDeCoDeCoDeCoDeCod"); // changed
app = ::firebase::App::Create(appOptions);
analytics::Initialize(*app);
return 0;
}
下一个stacktrace:
Program received signal SIGSEGV, Segmentation fault.
std::string::assign (this=this@entry=0x6170d0, __str=<error reading variable: Cannot access memory at address 0xf>)
at /var/tmp/portage/sys-devel/gcc-5.3.0/work/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:693
693 /var/tmp/portage/sys-devel/gcc-5.3.0/work/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc: No such file or directory.
(gdb) bt
#0 std::string::assign (this=this@entry=0x6170d0, __str=<error reading variable: Cannot access memory at address 0xf>)
at /var/tmp/portage/sys-devel/gcc-5.3.0/work/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:693
#1 0x0000000000402175 in std::string::operator= (__str=<error reading variable: Cannot access memory at address 0xf>, this=0x6170d0)
at third_party/crosstool/v18/stable/toolchain/x86_64-grtev4-linux-gnu/include/c++/4.9.x-google/bits/basic_string.h:555
#2 firebase::AppOptions::operator= (this=0x6170c8) at blaze-out/gcc-4.X.Y-crosstool-v18-hybrid-grtev4-k8-opt/genfiles/firebase/app/client/cpp/include/firebase/app.h:23
#3 firebase::App::Create (options=..., name=0x402bb5 "default") at firebase/app/client/cpp/src/app_stub.cc:43
#4 0x00000000004013ae in common_main (argc=1, argv=0x7fffffffdea8) at /home/ivan.sidarau/source/firebase_t/firebaseTest/main.cpp:29
#5 0x0000000000401306 in main (argc=1, argv=0x7fffffffdea8) at /home/ivan.sidarau/source/firebase_t/firebaseTest/main.cpp:14
在x86_64平台上。使用Firebase C ++ SDK版本1.0。
因此问题可能出现在此代码/ ABI /或SDK中。
之前有人遇到过这样的事情吗?
答案 0 :(得分:0)
目前无法在Linux平台上使用C ++ SDK。 Google Firebase C ++ SDK在Android或iOS上使用JNI / Java SDK内部。它不适用于Linux。