Version: 4.4 (using Devel) OS: Linux Installed from: Compiled sources I'm building kde with --no-undefined linker flag, but bindings generator fails to build: cd generator/generators/smoke g++ -fPIC -w -O2 -g -D_FORTIFY_SOURCE=2 -fstack-protector -O3 -DNDEBUG -DQT_NO_DEBUG -Wl,--no-undefined -Wl,--as-needed -shared -Wl,-soname,generator_smoke.so -o ../../bin/generator_smoke.so CMakeFiles/generator_smoke.dir/generator_smoke.o CMakeFiles/generator_smoke.dir/writeClasses.o CMakeFiles/generator_smoke.dir/writeSmokeDataFile.o CMakeFiles/generator_smoke.dir/helpers.o -lQtCore -lQtXml CMakeFiles/generator_smoke.dir/generator_smoke.o: In function `QList<QFileInfo>::operator=(QList<QFileInfo> const&)': /usr/include/qt4/QtCore/qlist.h:410: undefined reference to `ParserOptions::headerList' .... ParserOptions::headerList defined in generator/options.h
Yes, that's because we link the plugins to the executable, instead of a library. Does building without -Wl,--no-undefined cause any trouble for packagers, then?
Building with -Wl,--no-undefined helps you to avoid runtime linking errors and whole kde can be build with it. only smokegen cannot Also it smokegen build can be easily "fixed" with -Wl,--undefined flag in CmakeLists.txt, see kdebindings-generators-undefined.patch
Created attachment 41124 [details] "fixes" build with -Wl,--no-undefined
Thanks for the patch, but for some obscure reason this breaks the build for me. I get the following: Linking CXX shared module ../../bin/generator_smoke.so cd /home/pumphaus/dev/KDE/kdebindings-build/generator/generators/smoke && /usr/bin/cmake -E cmake_link_script CMakeFiles/generator_smoke.dir/link.txt --verbose=1 /usr/bin/c++ -fPIC -Wl,--no-undefined -Wl,--undefined -shared -Wl,-soname,generator_smoke.so -o ../../bin/generator_smoke.so CMakeFiles/generator_smoke.dir/generator_smoke.o CMakeFiles/generator_smoke.dir/writeClasses.o CMakeFiles/generator_smoke.dir/writeSmokeDataFile.o CMakeFiles/generator_smoke.dir/helpers.o -lQtCore -lQtXml /usr/bin/ld: generator_smoke.so: No such file: No such file or directory The command invocation looks correct to me. Any ideas why this is failing?
Ah, got it. ld expects a symbol name after --undefined. So simply specifying --undefined won't do it. We have to remove --no-undefied from the linker flags to make this build.
SVN commit 1097205 by arnorehn: Force RPATH for smokegen so that it can be used from within the build tree. Remove -Wl,--no-undefined from the CXXFLAGS for the generator plugins to link properly. BUG:228386 BUG:228383 M +4 -0 CMakeLists.txt M +3 -1 generators/CMakeLists.txt WebSVN link: http://websvn.kde.org/?view=rev&revision=1097205