Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Cross compile the AVS Device SDK 1.8.1 for MIPS linux can not work #898

Closed
6 tasks
gavinlwz opened this issue Aug 14, 2018 · 8 comments
Closed
6 tasks

Cross compile the AVS Device SDK 1.8.1 for MIPS linux can not work #898

gavinlwz opened this issue Aug 14, 2018 · 8 comments

Comments

@gavinlwz
Copy link

Briefly summarize your issue:

What is the expected behavior?

What behavior are you observing?

$SampleApp /usr/mnt_app/alexa/AlexaClientSDKConfig_xxx.json DEBUG9
Bus erro

the SampleApp exit in the LD libAVSCommon.so stage ,and report bus error .
the error seem to arise in the stage when g_shutdownMonitor class to instantiate
libAVSCommon.so ->RequiresShutdown.cpp ->g_shutdownMonitor.m_destructorLogger

core dump info:
gdb) where
#0 getValue<char const*> (getType=, isType=, defaultValue=, out=, key=..., this=0x7f8aa0e4)
at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/include/AVSCommon/Utils/Configuration/ConfigurationNode.h:254
#1 alexaClientSDK::avsCommon::utils::configuration::ConfigurationNode::getString (this=0x7f8aa0e4, key=..., out=0x7f8a9f40, defaultValue=0x4a340c <_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4+12> "")
at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Configuration/ConfigurationNode.cpp:158
#2 0x762821b8 in alexaClientSDK::avsCommon::utils::configuration::ConfigurationNode::getString (this=, key=..., out=0x7f8aa0b0, defaultValue=...)
at /xxxt/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Configuration/ConfigurationNode.cpp:150
#3 0x762aaa64 in alexaClientSDK::avsCommon::utils::logger::Logger::initLogLevel (this=0x792808, configuration=...) at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Logger/Logger.cpp:51
#4 0x762aadc4 in alexaClientSDK::avsCommon::utils::logger::Logger::init (this=0x792808, configuration=...) at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Logger/Logger.cpp:44
#5 0x762a7f24 in alexaClientSDK::avsCommon::utils::logger::ConsoleLogger::ConsoleLogger (this=0x792808) at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Logger/ConsoleLogger.cpp:54
#6 0x762a8418 in alexaClientSDK::avsCommon::utils::logger::ConsoleLogger::instance () at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Logger/ConsoleLogger.cpp:35
#7 0x762a854c in alexaClientSDK::avsCommon::utils::logger::getConsoleLogger () at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Logger/ConsoleLogger.cpp:64
#8 0x762ab940 in alexaClientSDK::avsCommon::utils::logger::LoggerSinkManager::LoggerSinkManager (this=0x762ebd20 alexaClientSDK::avsCommon::utils::logger::LoggerSinkManager::instance()::singleLoggerSinkManager)
at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Logger/LoggerSinkManager.cpp:73
#9 0x762ab9e8 in alexaClientSDK::avsCommon::utils::logger::LoggerSinkManager::instance () at /xxx/output/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Logger/LoggerSinkManager.cpp:26
#10 0x762ad4a4 in alexaClientSDK::avsCommon::utils::logger::ModuleLogger::ModuleLogger (this=0x762ebde0 alexaClientSDK::avsCommon::utils::g_shutdownMonitor+48, configKey=...)
at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/Logger/ModuleLogger.cpp:75
#11 0x762b4828 in alexaClientSDK::avsCommon::utils::ShutdownMonitor::ShutdownMonitor (this=0x762ebdb0 alexaClientSDK::avsCommon::utils::g_shutdownMonitor)
at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/RequiresShutdown.cpp:99
#12 0x76238bf4 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /xxx/output/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/RequiresShutdown.cpp:118
#13 _GLOBAL__sub_I_RequiresShutdown.cpp(void) () at /xxx/build/avs-device-sdk-1.8.1_rc002/AVSCommon/Utils/src/RequiresShutdown.cpp:152
#14 0x762bd4f4 in __do_global_ctors_aux () from /xxx/output/host/usr/mipsel-buildroot-linux-gnu/sysroot/usr/lib/libAVSCommon.so
#15 0x76234e64 in _init () from /xxx/output/host/usr/mipsel-buildroot-linux-gnu/sysroot/usr/lib/libAVSCommon.so
#16 0x771d8c3c in call_init.part.0 () from /xxx/output/host/usr/mipsel-buildroot-linux-gnu/sysroot/lib/ld.so.1
#17 0x771d8ddc in _dl_init_internal () from /xxx/output/host/usr/mipsel-buildroot-linux-gnu/sysroot/lib/ld.so.1
#18 0x771c8f64 in _dl_start_user () from /xxx/output/host/usr/mipsel-buildroot-linux-gnu/sysroot/lib/ld.so.1

Provide the steps to reproduce the issue, if applicable:

Tell us about your environment:

What version of the AVS Device SDK are you using?

  <1.8.1>

Tell us what hardware you're using:

  • Desktop / Laptop
  • Raspberry Pi
  • [ *] Other - tell us more:
    MIPS CPU ,mips32r2 ,LITTLE-END

Tell us about your OS (Type & version):

  • [* ] Linux
  • MacOS
  • Raspbian Stretch
  • Raspbian Jessy
  • Other - tell us more:
    linux kernel 3.12.71 , mips GNU/Linux
    GCC mips-linux-gnu-g++ 4.8.3
@kjkh
Copy link

kjkh commented Aug 16, 2018

Hi @gavinlwz,

Thanks for the detailed stack trace. Can you also provide the DEBUG9 logs to help better explain the "bus error" that is being thrown. Any other information you can provide would be helpful. Is it segfaulting when you attempt to run the SampleApp?

@gavinlwz
Copy link
Author

No DEBUG9 logs , because SampleApp not exec main when arise bus error . the SampleApp exit when load dynamic library (libAVSCommon.so). Not segfault ,just arise bus error.

@kjkh
Copy link

kjkh commented Aug 17, 2018

Hi @gavinlwz,

This issue sounds similar to what you are experiencing. The problem appeared to be insufficient memory on the target system. How much RAM does your system have?

@gavinlwz
Copy link
Author

Hi @kjkh My system have 256M RAM .
I found nullptr value is 0x80 on MIPS system. I modified the code as below and the SampleApp can run.
Instantiation of “static ShutdownMonitor g_shutdownMonitor ” class will be done when load libAVSCommon.so dynamic library . These is before the SampleApp main function, so the config JSON is null.

  1. ConfigurationNode.cpp
    ConfigurationNode::operator bool() const {
    return (!(m_object==nullptr));
    }

  2. Logger.cpp
    bool Logger::initLogLevel(const configuration::ConfigurationNode configuration) {
    std::string name;
    if(!configuration)
    return false;

    if (configuration.getString(CONFIG_KEY_LOG_LEVEL, &name)) {
    Level level = convertNameToLevel(name);
    if (level != Level::UNKNOWN) {
    setLevel(level);
    return true;
    } else {
    // Log without ACSDK_* macros to avoid recursive invocation of constructor.
    log(Level::ERROR, LogEntry("Logger", "unknownLogLevel").d("name", name));
    }
    }
    return false;
    }

  3. LogStringFormatter.cpp
    /// Separator string between milliseconds value and ExampleLogger name.
    static const char MILLIS_AND_THREAD_SEPARATOR = '[';

/// Separator between thread ID and level indicator in log lines.
static const char THREAD_AND_LEVEL_SEPARATOR = ']';

@bennyAv10
Copy link

Hi @gavinlwz,

I just want to confirm the issue has been solved and SampleApp is running successfully.

Please let me know if you ave any other questions.

Thanks,
Benny

@gavinlwz
Copy link
Author

@bennyAv10 The issue has been solved and SampleApp is running successfully.

Thanks

@vladvan
Copy link

vladvan commented Dec 5, 2019

I had the exact same segv failures, and after making the changes above my segv's went away as well.
I am using v1.16 on a cross compiled x86 target.

@vladvan
Copy link

vladvan commented Dec 5, 2019

Here is a patch file for the above changes:

--- ./AVSCommon/Utils/src/Logger/Logger.cpp.orig 2019-12-04 09:59:51.489766665 -0700
+++ ./AVSCommon/Utils/src/Logger/Logger.cpp 2019-12-04 10:00:31.996109173 -0700
@@ -48,6 +48,8 @@

bool Logger::initLogLevel(const configuration::ConfigurationNode configuration) {
std::string name;

  • if (!configuration)
  •    return false;
    
    if (configuration.getString(CONFIG_KEY_LOG_LEVEL, &name)) {
    Level level = convertNameToLevel(name);
    if (level != Level::UNKNOWN) {
  • --- AVSCommon/Utils/src/Logger/LogStringFormatter.cpp.orig 2019-12-05 09:07:18.228690321 -0700
    +++ AVSCommon/Utils/src/Logger/LogStringFormatter.cpp 2019-12-05 09:08:21.070003021 -0700
    @@ -39,10 +39,10 @@
    static const int MILLIS_STRING_SIZE = 4;

/// Separator string between milliseconds value and ExampleLogger name.
-static const std::string MILLIS_AND_THREAD_SEPARATOR = " [";
+static const char MILLIS_AND_THREAD_SEPARATOR = '[';

/// Separator between thread ID and level indicator in log lines.
-static const std::string THREAD_AND_LEVEL_SEPARATOR = "] ";
+static const char THREAD_AND_LEVEL_SEPARATOR = ']';

/// Separator between level indicator and text in log lines.
static const char LEVEL_AND_TEXT_SEPARATOR = ' ';

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants