-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ binaries incompatible with MinGW #5052
Comments
We add |
I use clion for build project. But as I understand it, the following command was executed: ====================[ Build | my_application | Debug-MinGW GCC ]================
C:\Users\Elf\AppData\Local\Programs\CLion\bin\cmake\win\x64\bin\cmake.exe --build F:\tests\slint-cpp-template\cmake-build-debug-mingw-gcc --target my_application -j 10 I tried using the system CMAKE. The result is the same. Path to cmake IDE changes: ====================[ Build | my_application | Debug-MinGW GCC ]================
"C:\Program Files\CMake\bin\cmake.exe" --build F:\tests\slint-cpp-template\cmake-build-debug-mingw-gcc --target my_application -j 10
[1/3] Generating appwindow.h
[2/3] Building CXX object CMakeFiles/my_application.dir/src/main.cpp.obj
FAILED: CMakeFiles/my_application.dir/src/main.cpp.obj
C:\msys64\mingw64\bin\g++.exe -IF:/tests/slint-cpp-template/cmake-build-debug-mingw-gcc -isystem "C:/Program Files/Slint-cpp 1.5.1/include/slint" -g -std=gnu++20 -fdiagnostics-color=always /bigobj -MD -MT CMakeFiles/my_application.dir/src/main.cpp.obj -MF CMakeFiles\my_application.dir\src\main.cpp.obj.d -o CMakeFiles/my_application.dir/src/main.cpp.obj -c F:/tests/slint-cpp-template/src/main.cpp
g++.exe: warning: /bigobj: linker input file unused because linking not done
g++.exe: error: /bigobj: linker input file not found: No such file or directory
ninja: build stopped: subcommand failed. |
Hm, could it be that your build directory was initially configured for MSVC? If you remove |
Two more possibly important points:
cmake_minimum_required(VERSION 3.21)
project(my_application LANGUAGES CXX)
set(CMAKE_PREFIX_PATH "C:/Program Files/Slint-cpp 1.5.1")
find_package(Slint QUIET)
if (NOT Slint_FOUND)
message("Slint could not be located in the CMake module search path. Downloading it from Git and building it locally")
include(FetchContent)
FetchContent_Declare(
Slint
GIT_REPOSITORY https://github.com/slint-ui/slint.git
# `release/1` will auto-upgrade to the latest Slint >= 1.0.0 and < 2.0.0
# `release/1.0` will auto-upgrade to the latest Slint >= 1.0.0 and < 1.1.0
GIT_TAG release/1
SOURCE_SUBDIR api/cpp
)
FetchContent_MakeAvailable(Slint)
endif (NOT Slint_FOUND)
add_executable(my_application src/main.cpp)
target_link_libraries(my_application PRIVATE Slint::Slint)
slint_target_sources(my_application ui/appwindow.slint)
# On Windows, copy the Slint DLL next to the application binary so that it's found.
if (WIN32)
add_custom_command(TARGET my_application POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:my_application> $<TARGET_FILE_DIR:my_application> COMMAND_EXPAND_LISTS)
endif()
"C:\Program Files\CMake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:/Users/Elf/AppData/Local/Programs/CLion/bin/ninja/win/x64/ninja.exe -DCMAKE_C_COMPILER=C:/msys64/mingw64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/msys64/mingw64/bin/g++.exe -G Ninja -S F:\tests\slint-cpp-template -B F:\tests\slint-cpp-template\cmake-build-debug-mingw-gcc
-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.5s)
-- Generating done (0.0s)
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_C_COMPILER
-- Build files have been written to: F:/tests/slint-cpp-template/cmake-build-debug-mingw-gcc
Problems were encountered while collecting compiler information:
cc1plus.exe: fatal error: /bigobj: No such file or directory
[Finished] The compiler is detected correctly. Then the problem repeated during the assembly stage. |
I found the following piece of code in the file # Create imported target Slint::Slint
add_library(Slint::Slint INTERFACE IMPORTED)
set_target_properties(Slint::Slint PROPERTIES
INTERFACE_COMPILE_FEATURES "cxx_std_20"
INTERFACE_COMPILE_OPTIONS "/bigobj"
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/slint"
INTERFACE_LINK_LIBRARIES "Slint::slint-cpp"
) Could this be causing the problem? I don't know cmake very well, unfortunately( |
The problem is that our binaries are built for the msvc target, and they are incompatible with mingw. This @tronical: Should we perhaps build both msvc and mingw binaries and have two packages? Or would it be possible to merge the two in a single package? |
Right. I suspect that a unified binary package might be possible - but it would require stitching two independent builds together. I think for now the best course of action is to rename our binary package to have a -MSVC suffix and add a -MinGW package separately. |
Add a -MSVC suffix to our binary package (and prepare for future MinGW build) cc #5052
Add a -MSVC suffix to our binary package (and prepare for future MinGW build) cc #5052
Hello!
I wanted to get acquainted with Slint with the slint-cpp-template example. I tried to build a project using MinGW. I installed it using msys. However, I received an error when building:
After that I changed the compiler to MSVC. In this case, the build went without problems and the test application launched. I would like to understand why the example did not work with GCC.
This is probably important too. The CMAke console also displays a warning related to
/bigobj
:The text was updated successfully, but these errors were encountered: