QtCS2024 Compile once. Run everywhere
Jump to navigation
Jump to search
Session Summary
Compiling and deploying of C++ applications on Windows, Linux, macOS for x86_64 and arm64 can be challenging. By using Cosmopolitan Libc we could have an alternative.
Slides at 2024.09.06/QtCS2024-CompileOnce-RunEverywhere.pdf · GitLab
Session Owners
Cristian Adam
Notes (AI transcribed)
Cristian Adam, a member of the Qt Creator team, presented a talk on "Compile Once, Run Everywhere" using Cosmopolitan libc for C++ applications.
Key points include:
- Qt Creator is currently compiled for multiple platforms (X64 and ARM64 for MacOS, separate packages for Linux, Windows ARM64 in progress) using the Qt installer framework.
- Cosmopolitan libc is a C runtime that detects the host machine at runtime and provides the right system calls, enabling "compile once, run everywhere" for C++ applications.
- Cosmopolitan applications are compiled twice (X64 and ARM64) and packaged as a batch script plus payload, similar to Linux run installers.
- Mozilla's llamafile is an example of a Cosmopolitan application that runs locally after downloading and adding execute permissions.
- Adam successfully built and ran CMake, Qt Base, and Qt GUI with VNC QPA using Cosmopolitan libc on MacOS and Linux, but encountered issues on Windows due to Cosmopolitan's Libc's POSIX implementation.
- Challenges include integrating with native platforms, launching applications, and supporting WebSockets for Qt QPA VNC platform.
- Adam demonstrated Qt Creator running in Cosmopolitan, with menus working but window borders missing.
- The size of the Cosmopolitan Qt Creator binary is around 230 megabytes, and there were no noteworthy performance differences compared to the native version.
- Adam plans to continue working on Cosmopolitan support for Qt Creator and encourages others to contribute and report issues.