Skip to content
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

Qt5::Help CMake target fails on Ubuntu 22.04.1 LTS #2995

Open
rayment opened this issue Jun 11, 2023 · 0 comments
Open

Qt5::Help CMake target fails on Ubuntu 22.04.1 LTS #2995

rayment opened this issue Jun 11, 2023 · 0 comments

Comments

@rayment
Copy link
Contributor

rayment commented Jun 11, 2023

Update: Can confirm same problem when using x86_64-w64-mingw32.shared.

I have successfully built qtbase and qttools, and then qt5 after noticing the error on a brand-new Ubuntu 22.04.1 LTS virtual machine by running the following commands:

git clone https://github.com/mxe/mxe
cd mxe
make qtbase qtools qt5 -j9 MXE_TARGETS='x86_64-w64-mingw32.static'

When I try to build my project with the bundled CMake:

cd ~/project
mkdir build
cd build
PATH=$PATH:/home/finn/mxe/usr/bin
x86_64-w64-mingw32.static-cmake -DCMAKE_BUILD_TYPE=Release ../CMakeLists.txt

I get the following output:

== Using MXE wrapper: /home/finn/mxe/usr/bin/x86_64-w64-mingw32.static-cmake
     - cmake version 3.26.3
     - warnings for unused CMAKE_POLICY_DEFAULT variables can be ignored
== Using MXE toolchain: /home/finn/mxe/usr/x86_64-w64-mingw32.static/share/cmake/mxe-conf.cmake
== Using MXE runresult: /home/finn/mxe/usr/share/cmake/modules/TryRunResults.cmake
loading initial cache file /home/finn/mxe/usr/share/cmake/modules/TryRunResults.cmake
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at /home/finn/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/cmake/Qt5Help/Qt5HelpConfig.cmake:14 (message):
  The imported target "Qt5::Help" references the file

     "/home/finn/mxe/usr/x86_64-w64-mingw32.static/qt5/bin/qcollectiongenerator"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/home/finn/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/cmake/Qt5Help/Qt5HelpConfigExtras.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /home/finn/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/cmake/Qt5Help/Qt5HelpConfigExtras.cmake:6 (_qt5_Help_check_file_exists)
  /home/finn/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/cmake/Qt5Help/Qt5HelpConfig.cmake:407 (include)
  /home/finn/mxe/usr/x86_64-w64-mingw32.static/qt5/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)
  CMakeLists.txt:38 (find_package)

We shouldn't need to include either qcollectiongenerator or qhelpgenerator as the cross-compilation negates their usefulness.

Here is my CMakelists.txt:

cmake_minimum_required(VERSION 3.26)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(COPYRIGHT 2023)

project(piper
        VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
        LANGUAGES CXX)

set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/dist)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_AUTOUIC_SEARCH_PATHS src)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (UNIX AND NOT APPLE)
	set(LINUX TRUE)
endif()

if (WIN32 OR MSVC OR MSYS OR MINGW)
	set(CMAKE_PREFIX_PATH $ENV{QTDIR})
	set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
	             $<$<CONFIG:RELWITHDEBINFO>:QT_MESSAGELOGCONTEXT
	)
endif()

find_package(QT
             NAMES Qt5 Qt6
             REQUIRED COMPONENTS Core Widgets Help PrintSupport)
find_package(Qt${QT_VERSION_MAJOR}
             NAMES Qt5 Qt6
             REQUIRED COMPONENTS Core Widgets Help PrintSupport)

file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS
     "src/*"
     "*/*.qrc"
)

if (${QT_VERSION_MAJOR} GREATER_EQUAL 6)
	qt_add_executable(
		${PROJECT_NAME}
	    MANUAL_FINALIZATION
	    ${PROJECT_SOURCES}
	)
else()
	add_executable(
		${PROJECT_NAME}
	    ${PROJECT_SOURCES}
	)
endif()

# force Qt error if using unoptimised string operations
target_compile_options(
    ${PROJECT_NAME} PRIVATE
    "-DQT_NO_CAST_FROM_ASCII"
    "-DQT_NO_CAST_TO_ASCII"
    "-DQT_NO_CAST_FROM_BYTEARRAY"
    "-DQT_NO_URL_CAST_FROM_STRING"
    "-DQT_USE_QSTRINGBUILDER"
)

target_compile_definitions(
    ${PROJECT_NAME} PRIVATE
    PROJECT_NAME="Piper"
    VERSION_MAJOR=${VERSION_MAJOR}
    VERSION_MINOR=${VERSION_MINOR}
    VERSION_PATCH=${VERSION_PATCH}
    COPYRIGHT=${COPYRIGHT}
)

if(MSVC)
	target_compile_options(
		${PROJECT_NAME} PRIVATE
		/W4
	)
else()
	target_compile_options(
		${PROJECT_NAME} PRIVATE
		-Wall -Wextra
		-fdiagnostics-show-option
	)
endif()

target_link_libraries(
	${PROJECT_NAME} PRIVATE
	Qt${QT_VERSION_MAJOR}::Core
	Qt${QT_VERSION_MAJOR}::Widgets
	Qt${QT_VERSION_MAJOR}::Help
	Qt${QT_VERSION_MAJOR}::PrintSupport
)

add_subdirectory(contrib/Qt-Advanced-Docking-System)
add_subdirectory(contrib/nodeeditor)
include_directories(
	contrib/Qt-Advanced-Docking-System/src
	contrib/nodeeditor/include
)
target_link_libraries(
	${PROJECT_NAME} PRIVATE
	qt${QT_VERSION_MAJOR}advanceddocking
	QtNodes
)

set_target_properties(
	${PROJECT_NAME} PROPERTIES
	MACOSX_BUNDLE_DUI_IDENTIFIER ${PROJECT_NAME}.rayment.fr
	MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
	MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
	MACOSX_BUNDLE TRUE
	WIN32_EXECUTABLE TRUE
)

install(TARGETS ${PROJECT_NAME}
        BUNDLE DESTINATION src
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

if (QT_VERSION_MAJOR GREATER_EQUAL 6)
	qt_finalize_executable(${PROJECT_NAME})
endif()

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/docs/gen/help.qch
     DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/docs/gen/help.qhc
     DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

Environment:

$ uname -a
Linux ubuntu-dev-server 5.15.0-73-generic #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release --all
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant