https://bugs.kde.org/show_bug.cgi?id=502434

            Bug ID: 502434
           Summary: org.kde.Sdk: Probable missmatch in provided stdlibs
    Classification: Developer tools
           Product: Qt/KDE Flatpak Runtime
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: aleix...@kde.org
          Reporter: allan4...@gmail.com
                CC: aa...@kde.org
  Target Milestone: ---

SUMMARY

I'm not really sure if here is the place to report it, but here I go :

Noticed when using QtCreator from Flatpak, it seems to depend on _org.kde.Sdk_
:
```sh
echo -e '#include <mutex> \n #include <thread> \n #include <memory> \n #include
<iostream> \n  int main(){ auto i = std::make_unique<int>(42); std::cout << i
<< " " << *i << std::endl ; auto t = std::thread([]{}); t.join(); std::mutex m
= {}; return 0 ; }' |
/var/lib/flatpak/runtime/org.kde.Sdk/x86_64/*/*/files/bin/c++ -std=c++20
-isystem /var/lib/flatpak/runtime/org.kde.Sdk/x86_64/*/*/files/include -x c++ -
 && ./a.outIn file included from
/var/lib/flatpak/runtime/org.kde.Sdk/x86_64/6.8/2b27c8d886fd7c262f2cf1d4e216eadb5c141cba5a5673afd629b8ab1e5ecf7f/files/include/c++/14.2.0/x86_64-unknown-linux-gnu/bits/gthr-default.h:35,
                 from
/var/lib/flatpak/runtime/org.kde.Sdk/x86_64/6.8/2b27c8d886fd7c262f2cf1d4e216eadb5c141cba5a5673afd629b8ab1e5ecf7f/files/include/c++/14.2.0/x86_64-unknown-linux-gnu/bits/gthr.h:157,
                 from
/var/lib/flatpak/runtime/org.kde.Sdk/x86_64/6.8/2b27c8d886fd7c262f2cf1d4e216eadb5c141cba5a5673afd629b8ab1e5ecf7f/files/include/c++/14.2.0/bits/std_mutex.h:41,
                 from
/var/lib/flatpak/runtime/org.kde.Sdk/x86_64/6.8/2b27c8d886fd7c262f2cf1d4e216eadb5c141cba5a5673afd629b8ab1e5ecf7f/files/include/c++/14.2.0/mutex:47,
                 from <stdin>:1:
/var/lib/flatpak/runtime/org.kde.Sdk/x86_64/6.8/2b27c8d886fd7c262f2cf1d4e216eadb5c141cba5a5673afd629b8ab1e5ecf7f/files/include/c++/14.2.0/bits/std_mutex.h:206:32:
error: cannot convert ‘<brace-enclosed initializer list>’ to ‘unsigned int’ in
initialization
  206 |     __gthread_cond_t _M_cond = __GTHREAD_COND_INIT;
      |                                ^~~~~~~~~~~~~~~~~~~
/var/lib/flatpak/runtime/org.kde.Sdk/x86_64/6.8/2b27c8d886fd7c262f2cf1d4e216eadb5c141cba5a5673afd629b8ab1e5ecf7f/files/include/c++/14.2.0/ext/concurrence.h:252:32:
error: cannot convert ‘<brace-enclosed initializer list>’ to ‘unsigned int’ in
initialization
  252 |     __gthread_cond_t _M_cond = __GTHREAD_COND_INIT;
      |                                ^~~~~~~~~~~~~~~~~~~
```
- The error already contains a reproducible test.
-  It completely breaks any Qt compilation.
-  It pretty much seems to be a mismatch between a header and its library.
Probably `pthread.h` or `mutex.h`.
    - Not confirmed yet, as I'd have to do lots of testings.
        - And it took me some time debugging my entire application before
reaching this "simple" conclusion.
         - And before doing it I'd like to know if it is already tracked.
             - I can, but I'd like to hear about it first.

STEPS TO REPRODUCE
1. Flatpak install `org.kde.Sdk`.
    - I probably got it as a dependency of `io.qt.QtCreator`, not sure since I
have lots of _snaps_ and _flatpaks_.
2.  Copy and paste the one-liner in SUMMARY section.
    - Valid tests with `-std=c++20` and `-std=c++23`
    - Earlier standards wouldn't even compile, but for other reasons.
        - `error: no type named ‘type’ in ‘struct std::enable_if<false, void>’`

OBSERVED RESULT
- Thread related operations can't be compiled due to mismatching type and
initialization **in standard libraries**.
- As described in summary, it pretty much seems to be a mismatch between
headers or header & library.
    - After testing many times, it may also be something wrong with the
compiler itself, still need more digging into the problem.

EXPECTED RESULT
- That standard libraries should work when dealing with thread-related calls.
- **It compiles without a problem on system's GCC that is at the same exact
version (14.2.0)**
    ```sh
    echo -e '#include <mutex> \n #include <thread> \n #include <memory> \n
#include <iostream> \n  int main(){ auto i = std::make_unique<int>(42);
std::cout << i << " " << *i << std::endl ; auto t = std::thread([]{});
t.join(); std::mutex m = {}; return 0 ; }' | c++ -std=c++20 -x c++ -  &&
./a.out
    0x5642e09c42b0 42
    ```

SOFTWARE/OS VERSIONS
Flatpak @ Linux : Flatpak 1.16.0, Debian testing (trixie) 6.12.20-amd64
GCC inside flatpak : 14.2.0
GCC from system : (Debian 14.2.0-19) 14.2.0
Qt Version: **Flatpak** io.qt.QtCreator 16.0.0
eb00007daed9426ac86c57556aa171f9d6459b2b53e7d7eb352dcc73e9757a4f
KDE SDK Version : **Flatpak** org.kde.Sdk 6.8
2b27c8d886fd7c262f2cf1d4e216eadb5c141cba5a5673afd629b8ab1e5ecf7f

ADDITIONAL INFORMATION
- I've just created a container from scratch, and it occurs as described.
- `-isystem` is optional **for the test**, but required to compile Qt apps.
    - The error will occur without it, but later for a Qt compilation it would
be required.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to