lxqt / libqtxdg

Qt implementation of freedesktop.org xdg specs
https://lxqt.github.io
GNU Lesser General Public License v2.1
72 stars 35 forks source link

In function xxxx multiple definition of xxx #277

Closed msojocs closed 8 months ago

msojocs commented 2 years ago
Expected Behavior

No error happened.

Current Behavior

when the make program do the task of Linking CXX shared library libQt5XdgIconLoader.so, it was stopped by errors. I am using qt of qt5.15.2-static-ubuntu-16.04. https://github.com/lxqt/libqtxdg/blob/82da1928fc2e28229e814c6580130c3ad22ce800/src/xdgiconloader/xdgiconloader.cpp#L781

[ 16%] Linking CXX shared library libQt5XdgIconLoader.so
/tmp/cclKabAj.ltrans3.ltrans.o: In function `QIconCacheGtkReader::QIconCacheGtkReader(QString const&)':
<artificial>:(.text+0xb00): multiple definition of `QIconCacheGtkReader::QIconCacheGtkReader(QString const&)'
/opt/qt5.15.2-static-ubuntu-16.04/lib/libQt5Gui.a(qiconloader.o):qiconloader.cpp:(.text._ZN19QIconCacheGtkReaderC2ERK7QString+0x0): first defined here
/tmp/cclKabAj.ltrans3.ltrans.o: In function `QIconCacheGtkReader::QIconCacheGtkReader(QString const&)':
<artificial>:(.text+0xb00): multiple definition of `QIconCacheGtkReader::QIconCacheGtkReader(QString const&)'
/opt/qt5.15.2-static-ubuntu-16.04/lib/libQt5Gui.a(qiconloader.o):qiconloader.cpp:(.text._ZN19QIconCacheGtkReaderC2ERK7QString+0x0): first defined here
/tmp/cclKabAj.ltrans7.ltrans.o: In function `PixmapEntry::pixmap(QSize const&, QIcon::Mode, QIcon::State)':
<artificial>:(.text+0x1a0): multiple definition of `PixmapEntry::pixmap(QSize const&, QIcon::Mode, QIcon::State)'
/opt/qt5.15.2-static-ubuntu-16.04/lib/libQt5Gui.a(qiconloader.o):qiconloader.cpp:(.text._ZN11PixmapEntry6pixmapERK5QSizeN5QIcon4ModeENS3_5StateE+0x0): first defined here
/tmp/cclKabAj.ltrans7.ltrans.o: In function `ScalableEntry::pixmap(QSize const&, QIcon::Mode, QIcon::State)':
<artificial>:(.text+0xd00): multiple definition of `ScalableEntry::pixmap(QSize const&, QIcon::Mode, QIcon::State)'
/opt/qt5.15.2-static-ubuntu-16.04/lib/libQt5Gui.a(qiconloader.o):qiconloader.cpp:(.text._ZN13ScalableEntry6pixmapERK5QSizeN5QIcon4ModeENS3_5StateE+0x0): first defined here
collect2: error: ld returned 1 exit status
src/xdgiconloader/CMakeFiles/Qt5XdgIconLoader.dir/build.make:335: recipe for target 'src/xdgiconloader/libQt5XdgIconLoader.so.3.8.0' failed
make[2]: *** [src/xdgiconloader/libQt5XdgIconLoader.so.3.8.0] Error 1
CMakeFiles/Makefile2:120: recipe for target 'src/xdgiconloader/CMakeFiles/Qt5XdgIconLoader.dir/all' failed
make[1]: *** [src/xdgiconloader/CMakeFiles/Qt5XdgIconLoader.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Possible Solution
Steps to Reproduce (for bugs)
  1. try to build a dockerimage
  2. using qt of qt5.15.2-static-ubuntu-16.04
  3. build this project
  4. failed
Context
System Information
tsujan commented 2 years ago

Not reproducible.

Make sure that you have a clean build dir and also the latest git lxqt-build-tools.

Distribution & Version: Ubuntu16.04 image and MANJARO host

This can't be right. Ubuntu16.04 belongs to Stone Age.

palinek commented 2 years ago

The crucial thing here is static qt & libqtxdg libraries. Yes, we're duplicating some symbols which are not exported by Qt and we need them...

msojocs commented 2 years ago

The crucial thing here is static qt & libqtxdg libraries. Yes, we're duplicating some symbols which are not exported by Qt and we need them...

I see. I commented out these duplicate codes, and I got the following new errors:

[ 72%] Linking CXX shared library libQt5Xdg.so
/opt/qt5.15.2-static-ubuntu-16.04/lib/libQt5Core.a(qtimer.o): In function `QSingleShotTimer::QSingleShotTimer(int, Qt::TimerType, QObject const*, QtPrivate::QSlotObjectBase*)':
qtimer.cpp:(.text._ZN16QSingleShotTimerC2EiN2Qt9TimerTypeEPK7QObjectPN9QtPrivate15QSlotObjectBaseE+0xe8): undefined reference to `QtPrivate::QSlotObject<void (QObject::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)'
/usr/bin/ld: /opt/qt5.15.2-static-ubuntu-16.04/lib/libQt5Core.a(qtimer.o): relocation R_X86_64_PC32 against undefined hidden symbol `_ZN9QtPrivate11QSlotObjectIM7QObjectFvvENS_4ListIJEEEvE4implEiPNS_15QSlotObjectBaseEPS1_PPvPb' can not be used when making a shared object
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
src/qtxdg/CMakeFiles/Qt5Xdg.dir/build.make:623: recipe for target 'src/qtxdg/libQt5Xdg.so.3.8.0' failed
make[2]: *** [src/qtxdg/libQt5Xdg.so.3.8.0] Error 1
CMakeFiles/Makefile2:278: recipe for target 'src/qtxdg/CMakeFiles/Qt5Xdg.dir/all' failed
make[1]: *** [src/qtxdg/CMakeFiles/Qt5Xdg.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
msojocs commented 2 years ago

Not reproducible.

Make sure that you have a clean build dir and also the latest git lxqt-build-tools.

Distribution & Version: Ubuntu16.04 image and MANJARO host

This can't be right. Ubuntu16.04 belongs to Stone Age.

If you are interested in it, here is the content of Dockerfile . (Just for test, so it's not very beautiful.) Using it with docker build -f Dockerfile -t test .

FROM ubuntu:16.04

WORKDIR /workspace

RUN apt update
RUN apt install -y libgsettings-qt-dev libgsettings-qt1 \
    librsvg2-dev \
    libxi-dev libxcb-util-dev libstartup-notification0-dev libcups2-dev \
    # for theme
    libmtdev-dev
RUN apt install -y git wget
RUN mkdir -p /opt && cd /opt && \
    git clone https://github.com/BeamMW/qt5.15.2-static-ubuntu-16.04.git
RUN mkdir -p /home/runner/work/beam-ui && ln -s /opt/qt* /home/runner/work/beam-ui/qt5-static && \
    chmod +x /opt/qt*/bin/* && rm -rf /opt/qt*/.git
ENV PATH="/opt/qt5.15.2-static-ubuntu-16.04/bin:$PATH"
RUN cd /tmp && wget https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-Linux-x86_64.tar.gz &&\
    tar -xzvf cmake-3.15.4-Linux-x86_64.tar.gz &&\
    mv cmake-3.15.4-Linux-x86_64 /opt/cmake-3.15.4 && \
    rm -rf cmake-3.15.4-Linux-x86_64.tar.gz &&\
    ln -sf /opt/cmake-3.15.4/bin/* /usr/bin/ && \
    cmake --version
RUN wget https://github.com/unicode-org/icu/releases/download/release-65-1/icu4c-65_1-Ubuntu18.04-x64.tgz && \
    tar xzf icu4c-65_1-Ubuntu18.04-x64.tgz && \
    cp -r icu/usr / && rm -rf icu
RUN mkdir -p /workplace/other && cd /workplace/other &&\
    git clone https://github.com/lxqt/lxqt-build-tools.git &&\
    cd /workplace/other/lxqt-build-tools && git checkout tags/0.10.0 && \
    mkdir build && cd build && cmake .. && make && make install
# libqtxdg
RUN mkdir -p /workplace/other && cd /workplace/other &&\
    git clone https://github.com/lxqt/libqtxdg.git
RUN apt install -y libgl-dev libxkbcommon-x11-dev libxkbcommon-dev libudev-dev libtiff-dev libxcb-glx0-dev libx11-xcb-dev libxcb-icccm4-dev libxcb-image0-dev \
    libxcb-keysyms1-dev libxcb-randr0-dev libxcb-sync-dev libxcb-render-util0-dev libxcb-xfixes0-dev \
    libxcb-xinerama0-dev libxcb-xkb-dev  && cd /workplace/other/libqtxdg && git checkout tags/3.8.0 && \
    mkdir build && cd build && cmake .. -D CMAKE_LIBRARY_PATH=/usr/local/lib && make && make install
tsujan commented 2 years ago

@msojocs

@palinek saw the static Qt and reopened the report — I hadn't paid attention to "static".

EDIT: "Ubuntu16.04" caught my attention instead.