Compilation issues when supporting some old Linux platforms

I’m trying to take advantage of the ISC license for juce_core and porting it to “special” set-top boxes that are Broadcom and uClibc based.

I’m running into a few blocking compilation issues though, which I will PR to help unify the changes needed.

The two macros here don’t exist, because there’s no locale nor xlocale support.

String SystemStats::getUserLanguage()    { return getLocaleValue (_NL_IDENTIFICATION_LANGUAGE); }
String SystemStats::getUserRegion()      { return getLocaleValue (_NL_IDENTIFICATION_TERRITORY); }

We could just define them in juce_core when necessary:


Another issue is that std::_Exit is not supported. I need to somehow shoehorn this to use the Android solution…

void JUCE_CALLTYPE Process::terminate()
    _exit (EXIT_FAILURE);
    std::_Exit (EXIT_FAILURE);

Next, backtrace is unsupported because there’s no exec info on this platform. So you could check if this macro is available, _GLIBCXX_HAVE_EXECINFO_H, but I’m not so sure that’s the most generic solution.

//in "juce_core/system/juce_SystemStats.cpp" - SystemStats::getStackBacktrace()
    void* stack[128];
    int frames = backtrace (stack, numElementsInArray (stack));
    char** frameStrings = backtrace_symbols (stack, frames);

    for (int i = 0; i < frames; ++i)
        result << frameStrings[i] << newLine;

    ::free (frameStrings);

And lastly, because of the missing locale/xlocale, and nonexistent C++11 std::stod, this needs a quick patch in juce_CharacterFunctions.h. Obviously I hate this solution as much you do, so am totally open to a proper one.

       #if JUCE_WINDOWS
        static _locale_t locale = _create_locale (LC_ALL, "C");
        return _strtod_l (&buffer[0], nullptr, locale);
        #if __UCLIBC_HAS_LOCALE__
            static locale_t locale = newlocale (LC_ALL_MASK, "C", nullptr);
           #if JUCE_ANDROID
            return (double) strtold_l (&buffer[0], nullptr, locale);
            return strtod_l (&buffer[0], nullptr, locale);
        //I added this crap
            std::stringstream ss;
            ss << &buffer[0];

            double result = 0.0;
            ss >> result;
            return result;

…and a warning:

 In function `juce::File::setFileTimesInternal(long long, long long, long long) const':
[...]/c++/4.8.2/bits/stl_algobase.h:(.text+0x864c4): warning: the use of OBSOLESCENT `utime' is discouraged, use `utimes'

Though I still need to run more tests on Monday with my new changes, and even try compiling (I’m not at my workstation), I posted a PR attempting to rectify all of these things in the typical JUCE fashion:

If multiple people can take a look, that would be appreciated! It would be super fun to get BCM + uClibc support in JUCE.