Building ffmpegx fails for dependency x265

  • Trying to build ffmpeg-tools with
    PROJECT=Generic ARCH=x86_64 scripts/create_addon ffmpeg-tools

    is failing building ffmpegx's dependency x265.

    Building x265 on it's own with

    PROJECT=Generic ARCH=x86_64 scripts/build x265

    fails with the error:

    /home/simon/AdditionalStorage/git/http://LibreELEC.tv/build.LibreELEC-Generic.x86_64-9.2-devel/x265-3.2/source/common/param.cpp:57:14: error: 'char* strtok_r(char*, const char*, char**)' was declared 'extern' and later 'static' [-fpermissive]

    static char* strtok_r(char* str, const char* delim, char** nextp)

    The full output is here: pastebin link

    ffmpeg-tools builds successfully on the same machine (Arch Linux) for the RPi4 - is it something to do with the x86_64 compiler? Maybe the settings for the ARM compiler are more relaxed?

    Any help gratefully received,

    Cheers,

    Simon

  • Thanks CVH.

    I noticed in the log at lines 78

    -- Looking for strtok_r

    -- Looking for strtok_r - not found

    and (x265) param.cpp checks if strtok_r is defined, and if not re-defines it. It looks like it's not finding that previous definition for some reason, so uses it's own and it's re-definition is declared differently so the error flags up. I just patched param.cpp to be the same as the toolchain def (i.e. static to extern) and it compiles OK.

    I haven't got around to testing it yet so it might not work (object method v class method? * ) but when I get around to it I'll update here to say if the workaround works.

    * dunno, might be total BS, too lazy to look at code structure

    Cheers,

    Simon

    Edited once, last by sihy: Added asterisk comment (February 11, 2020 at 7:37 PM).