Bug 228383 - bindings generator can't be build with -Wl,--no-undefined
Summary: bindings generator can't be build with -Wl,--no-undefined
Status: RESOLVED FIXED
Alias: None
Product: bindings
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-24 23:05 UTC by Pavel Volkovitskiy
Modified: 2010-02-28 18:26 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
"fixes" build with -Wl,--no-undefined (329 bytes, patch)
2010-02-26 07:19 UTC, Pavel Volkovitskiy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Volkovitskiy 2010-02-24 23:05:29 UTC
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
Comment 1 Arno Rehn 2010-02-25 18:50:06 UTC
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?
Comment 2 Pavel Volkovitskiy 2010-02-26 07:17:43 UTC
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
Comment 3 Pavel Volkovitskiy 2010-02-26 07:19:36 UTC
Created attachment 41124 [details]
"fixes" build with -Wl,--no-undefined
Comment 4 Arno Rehn 2010-02-28 17:01:33 UTC
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?
Comment 5 Arno Rehn 2010-02-28 17:20:21 UTC
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.
Comment 6 Arno Rehn 2010-02-28 18:26:31 UTC
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