simulton / QSchematic

A library that allows creating diagrams such as flowcharts or even proper engineering schematics within a Qt application.
https://simulton.com
MIT License
251 stars 63 forks source link

Build faild when disable QSCHEMATIC_BUILD_STATIC under linux #65

Closed vowstar closed 8 months ago

vowstar commented 8 months ago

Build faild when disable DQSCHEMATIC_BUILD_STATIC under linux, but enable DQSCHEMATIC_BUILD_STATIC it build success.

OS: Gentoo Linux GCC: gcc version 13.2.1 20240210 (Gentoo Hardened 13.2.1_p20240210 p13) QT: QT6

cmake -B build -G Ninja -DQSCHEMATIC_BUILD_STATIC=OFF -DQSCHEMATIC_BUILD_DEMO=OFF -DQSCHEMATIC_DEPENDENCY_GPDS_TARGET:STRING="gpds::gpds-shared" -DQSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD=OFF
-- 
-- -------------------------
-- QSchematic configuration:
--   version      : 1.5.1
-- 
--   Build
--     Static     : OFF
--     Shared     : ON
--     Demo       : OFF
-- 
--   Dependencies
--     GPDS
--       Download : OFF
--       Target   : gpds::gpds-shared
-- -------------------------
-- 
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/vowstar/Projects/2023/QSchematic/build
QSchematic git:(master) cmake --build build -j

[1/48] Building CXX object qschematic/...atic-wiresystem-tests.dir/__/net.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/net.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/net.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/net.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/net.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/net.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/net.cpp:1:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/net.hpp:3:10: fatal error: QList: No such file or directory
    3 | #include <QList>
      |          ^~~~~~~
compilation terminated.
[2/48] Building CXX object qschematic/...ic-wiresystem-tests.dir/__/point.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/point.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/point.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/point.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/point.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/point.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/point.cpp:1:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/point.hpp:3:10: fatal error: QPointF: No such file or directory
    3 | #include <QPointF>
      |          ^~~~~~~~~
compilation terminated.
[3/48] Building CXX object qschematic/...tic-wiresystem-tests.dir/__/line.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/line.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/line.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/line.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/line.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/line.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/line.cpp:1:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/line.hpp:3:10: fatal error: QPointF: No such file or directory
    3 | #include <QPointF>
      |          ^~~~~~~~~
compilation terminated.
[4/48] Building CXX object qschematic/...wiresystem-tests.dir/__/__/utils.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/__/utils.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/__/utils.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/__/utils.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/__/utils.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/utils.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/utils.cpp:1:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/line.hpp:3:10: fatal error: QPointF: No such file or directory
    3 | #include <QPointF>
      |          ^~~~~~~~~
compilation terminated.
[5/48] Building CXX object qschematic/...tic-wiresystem-tests.dir/__/wire.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/wire.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/wire.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/wire.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/wire.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/wire.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/wire.hpp:3,
                 from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/wire.cpp:1:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/point.hpp:3:10: fatal error: QPointF: No such file or directory
    3 | #include <QPointF>
      |          ^~~~~~~~~
compilation terminated.
[6/48] Building CXX object qschematic/...resystem-tests.dir/tests/manager.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/manager.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/manager.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/manager.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/manager.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/manager.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/manager.cpp:2:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/../connector.hpp:5:10: fatal error: QPointF: No such file or directory
    5 | #include <QPointF>
      |          ^~~~~~~~~
compilation terminated.
[7/48] Building CXX object qschematic/...-wiresystem-tests.dir/tests/line.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/line.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/line.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/line.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/line.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/line.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/line.cpp:2:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/../../line.hpp:3:10: fatal error: QPointF: No such file or directory
    3 | #include <QPointF>
      |          ^~~~~~~~~
compilation terminated.
[8/48] Building CXX object qschematic/...-wiresystem-tests.dir/__/manager.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/manager.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/manager.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/manager.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/manager.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/manager.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/manager.cpp:1:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/manager.hpp:5:10: fatal error: QObject: No such file or directory
    5 | #include <QObject>
      |          ^~~~~~~~~
compilation terminated.
[9/48] Building CXX object qschematic/...esystem-tests.dir/__/__/settings.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/__/settings.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/__/settings.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/__/settings.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/__/__/settings.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/settings.cpp
/home/vowstar/Projects/2023/QSchematic/qschematic/settings.cpp:3:10: fatal error: QPointF: No such file or directory
    3 | #include <QPointF>
      |          ^~~~~~~~~
compilation terminated.
[10/48] Building CXX object qschematic...-wiresystem-tests.dir/tests/nets.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/nets.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/nets.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/nets.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/nets.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/nets.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/nets.cpp:2:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/../../manager.hpp:5:10: fatal error: QObject: No such file or directory
    5 | #include <QObject>
      |          ^~~~~~~~~
compilation terminated.
[11/48] Building CXX object qschematic...-wiresystem-tests.dir/tests/wire.cpp.o
FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/wire.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/wire.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/wire.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/wire.cpp.o -c /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/wire.cpp
In file included from /home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/wire.cpp:2:
/home/vowstar/Projects/2023/QSchematic/qschematic/wire_system/test/tests/../../manager.hpp:5:10: fatal error: QObject: No such file or directory
    5 | #include <QObject>
      |          ^~~~~~~~~
compilation terminated.
[13/48] Building CXX object qschematic...c-wiresystem-tests.dir/test_main.cpp.o
ninja: build stopped: subcommand failed.
Tectu commented 8 months ago

I'm currently unable to reproduce this. Can you try performing a clean build (destroying the build directory and starting over)? If the problem persists, can you please share the complete terminal log from start to finish from your clean build?

vowstar commented 8 months ago

Thank you for your patient response. In order to conveniently reproduce this issue and to demonstrate its prevalence across most Linux distributions, I have constructed a minimal reproduction environment using Docker, based on the debian:bookworm distribution. To replicate the issue, simply ensure Docker is installed, save the following content as a Dockerfile, and then run docker build -t issue-65 .. This will reproduce the problem.

Dockerfile:

FROM debian:bookworm
LABEL maintainer="Huang Rui <vowstar at gmail.com>"

## Configure packages
RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && \
    DEBIAN_FRONTEND=noninteractive apt-get install -yq \
        '^qt6-.*-dev' \
        build-essential \
        cmake \
        ninja-build \
        git \
    && \
    apt-get clean && rm -rf /var/cache/apt/archives && rm -rf /var/cache/apt/lists

## Clone GPDS
RUN git clone https://github.com/simulton/gpds.git

## Build and Install GPDS
RUN cd gpds && \
    cmake -B build -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr/local \
    -DGPDS_BUILD_STATIC=OFF \
    -DGPDS_BUILD_SHARED=ON \
    -DGPDS_BUILD_TESTS=OFF \
    -DGPDS_BUILD_EXAMPLES=OFF \
    && \
    cmake --build build --target install

## Clone QSchematic
RUN git clone https://github.com/simulton/QSchematic.git

## Build and Install QSchematic
RUN cd QSchematic && \
    cmake -B build -G Ninja \
        -DQSCHEMATIC_BUILD_STATIC=OFF \
        -DQSCHEMATIC_BUILD_DEMO=OFF \
        -DQSCHEMATIC_DEPENDENCY_GPDS_TARGET:STRING="gpds::gpds-shared" \
        -DQSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD=OFF \
    && \
    cmake --build build --target install

Command to reproduce:

docker build -t issue-65 .

The result:

Sending build context to Docker daemon  3.072kB
Step 1/8 : FROM debian:bookworm
 ---> 52f537fe0336

...
...

Step 8/8 : RUN cd QSchematic &&     cmake -B build -G Ninja     -DQSCHEMATIC_BUILD_STATIC=OFF     -DQSCHEMATIC_BUILD_DEMO=OFF     -DQSCHEMATIC_DEPENDENCY_GPDS_TARGET:STRING="gpds::gpds-shared"     -DQSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD=OFF     &&     cmake --build build --target install
 ---> Running in 8ccfdebe97f5
-- The CXX compiler identification is GNU 12.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE  
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found WrapOpenGL: TRUE  
-- Found XKB: /usr/lib/x86_64-linux-gnu/libxkbcommon.so (found suitable version "1.5.0", minimum required is "0.5.0") 
-- Found WrapVulkanHeaders: /usr/include  
-- 
-- -------------------------
-- QSchematic configuration:
--   version      : 1.5.1
-- 
--   Build
--     Static     : OFF
--     Shared     : ON
--     Demo       : OFF
-- 
--   Dependencies
--     GPDS
--       Download : OFF
--       Target   : gpds::gpds-shared
-- -------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /QSchematic/build

...
...

FAILED: qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/wire.cpp.o 
/usr/bin/c++    -MD -MT qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/wire.cpp.o -MF qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/wire.cpp.o.d -o qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/tests/wire.cpp.o -c /QSchematic/qschematic/wire_system/test/tests/wire.cpp
In file included from /QSchematic/qschematic/wire_system/test/tests/wire.cpp:2:
/QSchematic/qschematic/wire_system/test/tests/../../manager.hpp:5:10: fatal error: QObject: No such file or directory
    5 | #include <QObject>
      |          ^~~~~~~~~
compilation terminated.
[12/49] Automatic MOC for target qschematic-shared
[13/49] Building CXX object qschematic/wire_system/test/CMakeFiles/qschematic-wiresystem-tests.dir/test_main.cpp.o
ninja: build stopped: subcommand failed.
The command '/bin/sh -c cd QSchematic &&     cmake -B build -G Ninja     -DQSCHEMATIC_BUILD_STATIC=OFF     -DQSCHEMATIC_BUILD_DEMO=OFF     -DQSCHEMATIC_DEPENDENCY_GPDS_TARGET:STRING="gpds::gpds-shared"     -DQSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD=OFF     &&     cmake --build build --target install' returned a non-zero code: 1
Tectu commented 8 months ago

Thank you for providing this information. I am able to reproduce it. Should be able to provide a fix very soon.

Tectu commented 8 months ago

Can you check whether the latest master branch is working for you? We can provide a new release afterwards to help your packaging efforts.

vowstar commented 8 months ago

Thank you so much for your prompt response and for addressing the issue. I have tested the latest master branch, and I'm happy to confirm that the problem has been successfully resolved.

Your swift action is greatly appreciated and will significantly aid in our packaging efforts. Looking forward to the new release!

Tectu commented 8 months ago

Thank you for confirming that it's working now.

Release 1.6.0 has just landed - Happy packaging!