Bug 325058

Summary: nepomuk-core does not compile on OS X
Product: [Unmaintained] nepomuk Reporter: Nicolas Pavillon <nicos>
Component: generalAssignee: Nepomuk Bugs Coordination <nepomuk-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kde, mk-lists, nepomuk-bugs
Priority: NOR    
Version: 4.11.1   
Target Milestone: ---   
Platform: MacPorts   
OS: macOS   
URL: https://trac.macports.org/ticket/40498#comment:8
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch to fix the bug on OS X

Description Nicolas Pavillon 2013-09-18 13:49:09 UTC
On some system (OS X 10.6 was identified as for the address attached), the nepomuk-core fails to compile with the error:
> from [snip]/nepomuk-core/work/nepomuk-core-4.11.1/tools/nepomukctl/main.cpp:39:
> /opt/local/include/QtCore/qthread.h:115: error: declaration does not declare anything

A preprocessor conditional part of code seem to be at fault in this case, in nepomukctl/main.cpp:
> #ifdef __unix__
>     #include <unistd.h>
> #elif defined _WIN32
>     #include <windows.h>
>     static inline void sleep(unsigned int x) { Sleep(1000 * x); };
> #else
>     #define sleep(x)
> #endif

In some OS X systems, testing for __unix__ seems to be unsufficient, so that sleep() is defined at the preprocessor level, conflicting with Qt headers.
A patch provided in the attached URL, which tests for __APPLE__ as well as __unix__, makes it possible to compile the package properly.

Reproducible: Always

Steps to Reproduce:
1. Extract nepomuk-core archive
2. Run cmake with relevant variables
3. Run make
Actual Results:  
The compilation fails with: 
> from [snip]/nepomuk-core/work/nepomuk-core-4.11.1/tools/nepomukctl/main.cpp:39:
> /opt/local/include/QtCore/qthread.h:115: error: declaration does not declare anything


Expected Results:  
The package builds.

The error occurs only on some OS X versions. According to my tests, 10.7 and 10.8 seem to build fine.
Comment 1 Nicolas Pavillon 2013-09-18 13:50:47 UTC
Created attachment 82392 [details]
Patch to fix the bug on OS X

To be complete, I also attach the patch which solves the issue on the relevant platforms.
Comment 2 Kai Uwe Broulik 2013-09-19 08:02:48 UTC
Hi, thanks for the bugreport and providing a patch!
Please head to https://git.reviewboard.kde.org/ and post it there for others to review it, or it might get lost here :-(
Comment 3 Marko Käning 2013-09-19 18:24:57 UTC
Nicolas, can you take care of submitting your patch to KDE's reviewboard?
Comment 4 Nicolas Pavillon 2013-09-21 07:54:09 UTC
Submitted as review request #112852
Comment 5 Vishesh Handa 2013-10-04 10:57:39 UTC
Git commit 5288d60943b10c93a663b8484e23fe59197f2950 by Vishesh Handa, on behalf of Nicolas Pavillon.
Committed on 04/10/2013 at 10:44.
Pushed by vhanda into branch 'KDE/4.11'.

Enable compilation of nepomuk-core on mac
REVIEW: 112852

M  +1    -1    tools/nepomukctl/main.cpp

http://commits.kde.org/nepomuk-core/5288d60943b10c93a663b8484e23fe59197f2950