-
Notifications
You must be signed in to change notification settings - Fork 131
Description
Description:
When compile applications with the GNU compile under MinGW installed with Qt 6.8, many applications crash when called printf() and the message indicates segmentation fault. For example, the example project 05_timer crashes and the debugger indication this call stack:
To Reproduce
Steps to reproduce the behavior.
Precondition:
- Install Qt 6.8 and install MinGW deployed with the Qt installer;
- Clone the sources from branch
feature/494-compile-with-mingw, which is adapted to compile with MinGW. The main branch will not be compiled with MinGW.
Actions:
- Select example project
05_timeras the Startup project; - Start debugging.
Result:
Shortly the application is crashing with Segmentation Fault message and the callstack indicates printf() method. See the screenshot.
Expected behavior
You can as well reproduce the same behavior with the simple `printf("Hello World!") project. To do so,
- Manually create a directory, for example
hello, somewhere in theareg-sdk. To simplify, let's create in theframeworkdirectory ahellosub-directory. - Create a file
hello.cppwith the following content:#include <stdio.h> int main(int argc, char* argv[], char* envp[]) { printf("Hello World!"); return 0; }
- In the same
hellosub-directory create aCMakeLists.txtfile with the following content:add_executable(hello "${AREG_FRAMEWORK}/hello/hello.cpp") target_compile_definitions(hello PRIVATE ${COMMON_COMPILE_DEF}) target_compile_options(hello PRIVATE "${AREG_OPT_DISABLE_WARN_TOOLS}") target_include_directories(hello BEFORE PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_options(hello PRIVATE -mwin32 -municode -mconsole) target_link_libraries(hello areg aregextend ${AREG_LDFLAGS} )
- Modify
CMakeLists.txtfile located in theframeworkdirectory, include new created project in the last lineinclude("${AREG_FRAMEWORK}/hello/CMakeLists.txt")
- Open
Qt-Creator==> openareg-sdkdirectory ==> configure projects ==> build - When all projects are compiled without error, you'll see
hello.exeamong other binaries. - In the
Qt-Creatorselecthelloproject as the startup project and start with debugger. Additionally, you can set a breakpoint at the lineprintf("Hello World!"); - As soon as the program hits the
printf()you'll see the following dialog and the debugger callstack pointing to theprintf()method.
Note
The application runs without a problem is you remove aregextend library from this line target_link_libraries(hello areg aregextend ${AREG_LDFLAGS} ) in the CMakeLists.txt file.
Desktop or embedded (please complete the following information):
- OS:
Windows 11 - Hardware:
AMD64 - Compiler:
g++ for MinGW-64 - AREG SDK version:
feature/494-compile-with-mingwbranch
Additional context
The projects in examples are compiled with the same flags and options. The projects 01_hello, 02_buffer, 03_file, 04_logging run without a problem. The project 05_timer is crashing with the same SIGSEGV signal.
Metadata
Metadata
Assignees
Labels
Projects
Status

