Bug 11401 - Impossible do build a qt program using kf5-networkmanager-qt with qmake
Summary: Impossible do build a qt program using kf5-networkmanager-qt with qmake
Status: RESOLVED MOVED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-16 12:31 UTC by Nicolas Carrier
Modified: 2024-06-15 14:48 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:


Attachments
The example qt network manager application (1.60 KB, text/plain)
2018-10-16 13:21 UTC, Nicolas Carrier
Details
The default config used to reproduce the bug with the minimal example. (201 bytes, application/octet-stream)
2018-10-16 13:29 UTC, Nicolas Carrier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Carrier 2018-10-16 12:31:26 UTC
When trying to build a minimal c++ code, making use of the kf5-networkmanager-qt library, I obtain the following error:

    Project ERROR: Unknown module(s) in QT: NetworkManagerQt

There is a .pri file installed here:

    output/target/usr/mkspecs/modules/qt_NetworkManagerQt.pri

Which doesn't seem to be taken into account. When cp-ed alongsidef the qt .pri files:

    cp ../output/target/usr/mkspecs/modules/qt_NetworkManagerQt.pri ../output/host/mkspecs/modules/

The build fails this time with the following error:

    i686-buildroot-linux-gnu-g++: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/include/KF5/NetworkManagerQt'

Which seems to indicate that either the pri file isn't used properly or that its content is buggy.
Comment 1 Nicolas Carrier 2018-10-16 13:21:48 UTC
Created attachment 7816 [details]
The example qt network manager application
Comment 2 Nicolas Carrier 2018-10-16 13:26:22 UTC
Note: I'm originally using a custom buildroot version on top of the 2018.02.5, but I could reproduce the issue with the current master 0769f7fc4b3e47e05c9a7951aefa81a2dbaeab0d
Comment 3 Nicolas Carrier 2018-10-16 13:29:04 UTC
Created attachment 7821 [details]
The default config used to reproduce the bug with the minimal example.

The issue originally occurred with another buildroot workspace, for a real arm-based product.
The provided defconfig is the simplest I could make, to reproduce the issue in a minimal buildroot environment.
Comment 4 Pierre Ducroquet 2018-10-16 16:31:05 UTC
I will try to investigate tomorrow. I did not test with a QMake project, only with a CMake one. Could you try converting from qmake to cmake ?
The CMakeLists.txt would look like this:

cmake_minimum_required(VERSION 3.0)

find_package(Qt5 REQUIRED COMPONENTS Gui DBus)
find_package(KF5NetworkManagerQt REQUIRED)
add_executable(qt-network-manager main.cpp)
target_link_libraries(qt-network-manager Qt5::Gui Qt5::DBus KF5::NetworkManagerQt)

This would help confirm the issue lies in the QMake files.

Thank you very much for your report
Comment 5 Nicolas Carrier 2018-10-17 06:15:09 UTC
I'm going to try to convert the project to cmake.

For now, the following .pro file

QT -= gui                                                                       
QT += dbus network                                                              
CONFIG += c++11 console link_pkgconfig                                          
PKGCONFIG += libnm                                                              
SOURCES += main.cpp                                                             
INCLUDEPATH = $$[QT_SYSROOT]/usr/include/KF5/NetworkManagerQt                   
LIBS += -lKF5NetworkManagerQt                                                   
target.path = /                                                                 
!isEmpty(target.path): INSTALLS += target                                       

allowed me to build (and run) both for desktop and in buildroot. So this proves at least that the result of the kf5-networkmanager-qt build works fine.
Comment 6 Nicolas Carrier 2018-10-17 06:37:38 UTC
With the following CMakeLists.txt:

cmake_minimum_required(VERSION 3.0)
include(GNUInstallDirs)
find_package(Qt5 REQUIRED COMPONENTS Gui DBus Network)
find_package(KF5NetworkManagerQt REQUIRED)
add_executable(qt-network-manager main.cpp)
target_link_libraries(qt-network-manager Qt5::Gui Qt5::DBus KF5::NetworkManagerQt)
install(TARGETS qt-network-manager DESTINATION ${CMAKE_INSTALL_BINDIR})

and test-qt-networkmanager.mk:

TEST_QT_NETWORKMANAGER_VERSION = 0.0.1
TEST_QT_NETWORKMANAGER_SITE_METHOD = local
TEST_QT_NETWORKMANAGER_SITE = $(BR2_EXTERNAL_SPECTRACOM_PATH)/../test-qt-networkmanager-src
TEST_QT_NETWORKMANAGER_DEPENDENCIES = kf5-networkmanager-qt
$(eval $(cmake-package))

It builds fine.

I can't use the cmake solution though, because I need to use NetworkManagerQt is an already existing and quite complex, qmake-based project, which I'd like to avoid converting to cmake if possible.
Comment 7 Pierre Ducroquet 2018-10-17 06:39:31 UTC
Thank you for testing.
My message was not to imply you had to convert your project to CMake, I'm well too aware of the difficulty of such a task. It was just to make sure we identified the proper error.
Comment 8 Nicolas Carrier 2018-10-17 06:57:51 UTC
Sure, no problem, and in the meantime, I have to consider all the solutions.

I'd really like to propose a patch directly, but I don't have a sufficient knowledge in qmake.

I noticed that qt_lib_network.pri has its QT.network.includes variable parametered with $$QT_MODULE_INCLUDE_BASE, when for NetworkManagerQt, it's just:

QT.NetworkManagerQt.includes = /usr/include/KF5/NetworkManagerQt

Maybe something analogous should be done. But how ? As a buildroot patch ?
Comment 9 Pierre Ducroquet 2018-10-17 07:04:47 UTC
I'm looking into it. I can not promise any timeline, but I sure hope to have a patch for you during the day.
Comment 10 Nicolas Carrier 2018-10-17 07:11:11 UTC
Excellent, there's no hurry, thank you very much !
Comment 11 Pierre Ducroquet 2018-10-17 16:11:24 UTC
After analysis and some checks (thanks Nicolas for your availability on IRC) it looks like there are two issues:
- a bug in extra-cmake-modules that generates invalid pri when cross-building
- wrong cmake settings on my side, thus putting files in wrong places

I am still working on it and confident a solution will be found by tomorrow.
Comment 12 Yann E. MORIN 2024-06-15 14:48:53 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!