Bug 334702 - kglobalaccel and konqueror have linker errors on Mac OS X
Summary: kglobalaccel and konqueror have linker errors on Mac OS X
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: shortcuts (show other bugs)
Version: 4.13.0
Platform: MacPorts macOS
: HI grave
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-13 11:34 UTC by Ian Wadham
Modified: 2014-06-11 04:57 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.13.2


Attachments
Proposed patch (763 bytes, patch)
2014-05-15 10:45 UTC, Raphael Kubo da Costa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Wadham 2014-05-13 11:34:02 UTC
Using kdesrc-build on Mac OS X I got the following errors when building kde-runtime.
    Linking CXX executable kglobalaccel
    Undefined symbols for architecture x86_64:
    "GlobalShortcutsRegistry::keyPressed(int)", referenced from:
       hotKeyEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in
                kglobalaccel_mac.o
       KGlobalAccelImpl::keyPressed(int) in kglobalaccel_mac.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

There seems to be a problem in the CMakeLists.txt for kde-runtime/kglobalaccel or perhaps in the kde4_add_kdeinit_executable() macro as it functions on Mac OS X.

MacPorts has a workaround for this problem, but it consists in editing a list of *.o files from the CMakeFiles/kdeinit_kglobalaccel.dir into the link.txt file in CMakeFiles/kglobalaccel.dir, sometime during the build.

After my kdesrc-build run crashed the two directories contained different lists of *.o files. CMakeFiles/kdeinit_kglobalaccel.dir contained [globalshortcutcontext.o globalshortcutsregistry.o kdeinit_kglobalaccel_automoc.o kglobalaccel_mac.o component.o kglobalacceld.o globalshortcut.o main.o],

but CMakeFiles/kglobalaccel.dir contained only [kglobalaccel_automoc.o kglobalaccel_dummy.o 
kglobalaccel_mac.o] and the last of these failed to link.

Can you give me a patch or a workaround at the CMakeLists.txt level or macro level so that I
can continue to build KDE software from source, using kdesrc-build? This is part of a project to investigate, fix, test code for a much wider range of bugs in KDE software that occur on OS X.



Reproducible: Always

Steps to Reproduce:
Attempt to build kde-runtime from source on Mac OS X.
Actual Results:  
Build failed with linker errors in target kglobalaccel, object file kglobalaccel_mac.o.

Expected Results:  
Build without errors.

I am a KDE developer working on Mac OS X. I wish to build development versions of KDE libraries, utilities and apps, with full debug information, and the option to patch and test source code.  MacPorts is more oriented towards building release-type object-code for end-users.
Comment 1 Ian Wadham 2014-05-15 04:00:56 UTC
The following problem occurs when using kdesrc-build on Mac OSX to build kde4-baseapps and is perhaps related to the above:
    Linking CXX executable konqueror.app/Contents/MacOS/konqueror
    Undefined symbols for architecture x86_64:
      "KonqMisc::konqFilteredURL(KonqMainWindow*, QString const&, QString const&)",
          referenced from: _kdemain in konqmain.o
      "KonqMisc::createBrowserWindowFromProfile(QString const&, QString const&, KUrl const&,
         KonqOpenURLRequest const&, bool)", referenced from: _kdemain in konqmain.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [konqueror/src/konqueror.app/Contents/MacOS/konqueror] Error 1
    make[1]: *** [konqueror/src/CMakeFiles/konqueror.dir/all] Error 2
Comment 2 Raphael Kubo da Costa 2014-05-15 10:45:52 UTC
Created attachment 86646 [details]
Proposed patch

Ian, can you apply this patch to kdelibs, rebuild/reinstall it and then try building kde-runtime and kde-baseapps again?
Comment 3 Ian Wadham 2014-05-15 12:20:59 UTC
You are a genius, Raphael! That patch went in without a hitch and I have now successfully re-built kdelibs, kde-runtime and kde-baseapps. The MacPorts guys will be pleased too.

Thank you very much.  Will you be putting it in master and KDE/4.13?
Comment 4 Raphael Kubo da Costa 2014-05-15 13:27:02 UTC
Yes. Thanks for testing!
Comment 5 Raphael Kubo da Costa 2014-05-15 13:33:57 UTC
Git commit bdb672c5af44f5715a5bdf81193b9021ecd9f07a by Raphael Kubo da Costa.
Committed on 15/05/2014 at 13:30.
Pushed by rkcosta into branch 'KDE/4.13'.

KDE4_ADD_KDEINIT_EXECUTABLE: Check the right variable for Mac.

Fix a regression introduced by 52ee7642, which copy-pasted some code
from the Windows block. It caused the executable created with this macro
to unconditionally build and depend on the last source file passed to
it, even though it's only supposed to be part of the kdeinit_$TARGET
target.
FIXED-IN:	4.13.2

M  +2    -2    cmake/modules/KDE4Macros.cmake

http://commits.kde.org/kdelibs/bdb672c5af44f5715a5bdf81193b9021ecd9f07a
Comment 6 Marko Käning 2014-05-16 07:03:39 UTC
Backported to KDE libraries version 4.12.4 for current MacPorts tree in http://quickgit.kde.org/?p=macports-kde.git&a=commitdiff&h=49a61a2fd7399d2a49927e328b55709cfca5b49c