Memory order failure - Assertion '__b2 <= __b1' failed

Let me preface this by saying I’m certain it is probably my fault. I’ve been in IT almost 40 years, but this is my first flatpak. I create .deb and .rpm fine.

I’m porting my RedDiamond editor to flatpak and running into a run-time snag. There are Debian and RPM packages at the SourceForge link for anyone who cares.

Using this json

{
  "app-id": "org.flatpak.reddiamond",
  "runtime": "org.freedesktop.Platform",
  "runtime-version": "21.08",
  "sdk": "org.freedesktop.Sdk",
  "command": "reddiamond",
  "finish-args": [
    "--share=ipc", "--socket=x11",  /* X11 + XShm access */
    "--filesystem=host",            /* Filesystem Access */
    "--share=network",
    "--device=dri",
    "--socket=system-bus"
  ],
  "cleanup": [
        "/include"
  ],
  "modules": [
    {
        "name": "copperspice",
        "buildsystem": "cmake-ninja",
        "builddir": true,
        "build-options" : { 
            "cxxflags": "-Wno-error"
        },
        "no-parallel-make": false,
        "config-opts": [
            "-DCMAKE_BUILD_TYPE=Release",
            "-Wno-dev"
        ],
        "sources": [
            {
                "type": "git",
                "url": "https://github.com/copperspice/copperspice.git"
            }
        ]
    },
    {
        "name": "lexilla",
        "buildsystem": "simple",
        "build-commands": [
            "cd lexilla/src && ls && make",
            "cd lexilla/bin && install liblexilla.* /app/lib",
            "cd lexilla/include && install *.h /app/include"
        ],
        "sources": [
            {
                "type": "archive",
                "strip-components": 0,
                "url": "https://www.scintilla.org/scite523.zip",
                "sha256": "78614a7bd7e7238a064cdf81fa31d3f4aa2fe5ce23d690bbddbe6387f9c264b4"
            }
        ]
    },
    {
        "name": "csscintilla",
        "buildsystem": "simple",
        "build-commands": [
            "mkdir csscintilla_build",
            "cmake -G \"Ninja\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/app/lib/cmake/CopperSpice -DCMAKE_INSTALL_PREFIX=/app -S copperspice -B csscintilla_build",
            "cd csscintilla_build && ninja install",
            "rm -rf csscintilla_build"
        ],
        "sources": [
            {
                "type": "archive",
                "strip-components": 0,
                "url": "https://sourceforge.net/projects/csscintilla/files/csscintilla_1-0-1.zip",
                "sha256": "1ec451ae5a95405a335f97b09c3021705e788bfb2b3cb855072775d1a5319912"
            }
        ]
    },
    {
        "name": "reddiamond",
        "buildsystem": "cmake-ninja",
        "builddir": true,
        "build-options" : { 
            "cxxflags": "-Wno-error"
        },
        "no-parallel-make": false,
        "config-opts": [
            "-DCMAKE_BUILD_TYPE=Release",
            "-DCMAKE_LIBRARY_PATH=/app/lib",
            "-DCMAKE_INCLUDE_PATH=/app/include",
            "-DCMAKE_INSTALL_PREFIX:path=/app/bin",
            "-Wno-dev"
        ],
        "sources": [
            {
                "type": "git",
                "url": "git://git.code.sf.net/p/reddiamond/code"
            }
        ]
    }

  ]
}

It builds and local installs fine. CopperSpice doesn’t currently have a flatpak extensions or sdk, so I have to build it in my project. Not a big deal but 3819 files take a bit.

When I attempt to run I see the following, the first part is normal:

roland@roland-HP-EliteDesk-800-G2-SFF:~/sf_projects/reddiamond$ flatpak run org.flatpak.reddiamond
adding QXcbScreen(0x55d328962d80, name=:99.0-32, geometry=1920x1080+0+0, availableGeometry=1848x1053+72+27, devicePixelRatio=1.0, logicalDpi=QPair(96.0,96.0), physicalSize=508.0x285.0mm, screenNumber=0, virtualSize=3840x1080 (3840.0x1080.0mm), orientation=0, depth=24, refreshRate=60.0, root=77b, windowManagerName=GNOME Shell) (Primary: false )
adding QXcbScreen(0x55d328976aa0, name=:99.0-40, geometry=1920x1080+1920+0, availableGeometry=1920x1053+1920+27, devicePixelRatio=1.0, logicalDpi=QPair(96.0,96.0), physicalSize=508.0x285.0mm, screenNumber=0, virtualSize=3840x1080 (3840.0x1080.0mm), orientation=0, depth=24, refreshRate=60.0, root=77b, windowManagerName=GNOME Shell) (Primary: false )
primary output is :99.0-32
Choosing xcb gl-integration based on following priority
 (xcb_glx, xcb_egl)
No OpenGL integration plugin was found, this is only required for programs which use OpenGL.

Nothing wrong there. This is the error happening somewhere deep in the startup code.

/usr/include/c++/11.3.0/bits/atomic_base.h:569: bool std::__atomic_base<_IntTp>::compare_exchange_strong(std::__atomic_base<_IntTp>::__int_type&, std::__atomic_base<_IntTp>::__int_type, std::memory_order, std::memory_order) [with _ITp = int; std::__atomic_base<_IntTp>::__int_type = int; std::memory_order = std::memory_order]: Assertion '__b2 <= __b1' failed.

I assume I’m missing something in my json. I built on Ubuntu 20.04 with all updates applied. I have done some poking around and seen some Docker stuff having same issue in May of this year.

If it was this error it would make sense. That went past the end of an allocated space.

This error appears to fail the integer types. Is there some shiny new compiler option I need to use when compiling for Flatpak that I don’t need to use when building for Ubuntu and Fedora? If so, what is it please.

Has anyone seen and hopefully solved this error before?

Note: This computer does have NVIDIA. Seems to be related to incompatibility with NVIDIA.

https://bugzilla.redhat.com/show_bug.cgi?id=1674271

Per one of the other links above, is flatpak-builder enabling _GLIBCXX_ASSERTIONS

Author of the library here. There was a bug in the code which would only trigger when the setup has defined a macro _GLIBCXX_ASSERTIONS and would otherwise not show up. It should be fixed now in the latest version (1.7.0) - please try again (pip install -U outliertree) and comment in the github issue tracker if the problem persists.

Thanks,