Dynamically linked build fails

Bug #1923107 reported by Andrés Barrantes Silman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cairo-Dock Core
Triaged
Medium
Fabounet

Bug Description

When building I need to limit the build jobs to 1, else it fails with undefined references. Either way, at the end of the build ld fails to link. I assume it has something to do with libgldi, probably something missing in the CMakeLists. I attached the build log where you can see the build commands.

Revision history for this message
Andrés Barrantes Silman (andresbs) wrote :
Revision history for this message
Fabounet (fabounet03) wrote :

Hi,
looking at the build log, the link looks like this:
/usr/bin/cc -fPIC -fomit-frame-pointer -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -DNDEBUG -O2 -g -DNDEBUG -flto=auto -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -Wl,-soname,libcd-Help.so -o libcd-Help.so CMakeFiles/cd-Help.dir/applet-init.c.o CMakeFiles/cd-Help.dir/applet-config.c.o CMakeFiles/cd-Help.dir/applet-notifications.c.o CMakeFiles/cd-Help.dir/applet-tips-dialog.c.o CMakeFiles/cd-Help.dir/applet-composite.c.o -lgthread-2.0 -lglib-2.0 -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lcairo -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0 -lxml2 -lGLU -lGL -lcurl -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lrsvg-2 -lm -ldbus-glib-1 -ldbus-1 -lxml2 -lGLU -lGL -lcurl -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject

The --no-undefined option passed to the linker is probably what causes the problem.
The thing is, plug-ins don't need to link with libgldi, as they are dlopened by it at run-time.
I wonder where all those options come from ?
Anyway, I think this option should not be used in this case, and you can remove it by adding "-z undefs" in your LDFLAGS.

Changed in cairo-dock-core:
assignee: nobody → Fabounet (fabounet03)
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Andrés Barrantes Silman (andresbs) wrote :

The linker flags come from the RPM macro %cmake, which is used to setup the build, but not build or install, for those we have %cmake_build and %cmake_install.

%cmake expands to:
    find . -name CMakeLists.txt \
        -exec sed -i -re '/^[[:blank:]]*[sS][eE][tT][[:blank:]]*\([[:blank:]]*(CMAKE_BUILD_TYPE|CMAKE_COLOR_MAKEFILE|CMAKE_INSTALL_PREFIX|CMAKE_VERBOSE_MAKEFILE).*\)/{s/^/#IGNORE /}' {} +
    mkdir -p build
    cd build
    /usr/bin/cmake $OLDPWD/. \
%if "/usr/bin/make" == "/usr/bin/make"
        -G"Unix Makefiles" \
%else
        -GNinja \
%endif
        -DCMAKE_INSTALL_PREFIX:PATH=/usr \
        -DINCLUDE_INSTALL_DIR:PATH=/usr/include \
        -DLIB_INSTALL_DIR:PATH=/usr/lib64 \
        -DSYSCONF_INSTALL_DIR:PATH=/etc \
        -DSHARE_INSTALL_PREFIX:PATH=/usr/share \
        -DCMAKE_INSTALL_LIBDIR:PATH=lib64 \
        -DCMAKE_INSTALL_LIBEXECDIR=/usr/libexec \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DCMAKE_C_FLAGS="${CFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables} -DNDEBUG" \
        -DCMAKE_CXX_FLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables} -DNDEBUG" \
        -DCMAKE_Fortran_FLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables} -DNDEBUG" \
        -DCMAKE_EXE_LINKER_FLAGS=" -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \
        -DCMAKE_MODULE_LINKER_FLAGS=" -Wl,--as-needed" \
        -DCMAKE_SHARED_LINKER_FLAGS=" -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now" \
%if "lib64" == "lib64"
        -DLIB_SUFFIX=64 \
%endif
%if 1550 <= 1500
        -DCMAKE_SKIP_INSTALL_RPATHS:BOOL=ON \
%endif
        -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
        -DBUILD_SHARED_LIBS:BOOL=ON \
        -DBUILD_STATIC_LIBS:BOOL=OFF \
        -DCMAKE_COLOR_MAKEFILE:BOOL=OFF \
        -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF \
        -DCMAKE_MODULES_INSTALL_DIR=/usr/lib64/cmake/%{name}

I will try removing the flag and let you know the outcome, thanks.

Revision history for this message
Andrés Barrantes Silman (andresbs) wrote :

Yes, removing the --no-undefined flag solved it, thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.