Bug 333874 - Baloo does not compile on non-Linux platforms
Summary: Baloo does not compile on non-Linux platforms
Status: RESOLVED FIXED
Alias: None
Product: Baloo
Classification: Unmaintained
Component: General (show other bugs)
Version: unspecified
Platform: MacPorts macOS
: NOR normal
Target Milestone: ---
Assignee: Vishesh Handa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-25 14:12 UTC by Nicolas Pavillon
Modified: 2014-06-09 23:23 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Suppresses use of malloc_trim on non-GNU/Linux platforms (482 bytes, patch)
2014-04-27 03:29 UTC, Nicolas Pavillon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Pavillon 2014-04-25 14:12:31 UTC
Baloo employs the function malloc_trim(), which is not available non non-Linux systems, such as Mac OS X. 
It is used at least in ./src/xapian/xapiandatabase.cpp, where conditional code should be used for other platforms.

Reproducible: Always

Steps to Reproduce:
1. Try to compile baloo package
Actual Results:  
Compilation breaks
./baloo-4.13.0/src/xapian/xapiandatabase.cpp:27:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
or, by replacing <malloc.h> with <sys/malloc.h>
:5: error: use of undeclared identifier 'malloc_trim'
    malloc_trim(0);

Expected Results:  
Compilation finishing fine.
Comment 1 Vishesh Handa 2014-04-25 15:04:13 UTC
Provide a patch?
Comment 2 Nicolas Pavillon 2014-04-27 03:28:32 UTC
I am not in a position to provide a patch which is functionally equivalent, as the malloc_trim() function does not have direct analogs on other platforms. The attached patch ensures compilation by suppressing the function on other platforms.
Comment 3 Nicolas Pavillon 2014-04-27 03:29:24 UTC
Created attachment 86288 [details]
Suppresses use of malloc_trim on non-GNU/Linux platforms
Comment 4 Vishesh Handa 2014-05-12 14:42:26 UTC
Git commit a1d2889e3128709eac833ad1660a595c773f4552 by Vishesh Handa.
Committed on 12/05/2014 at 11:25.
Pushed by vhanda into branch 'KDE/4.13'.

XapianDB: We only need the headers for malloc_trim

M  +2    -0    src/xapian/xapiandatabase.cpp

http://commits.kde.org/baloo/a1d2889e3128709eac833ad1660a595c773f4552
Comment 5 Ian Wadham 2014-05-18 03:24:29 UTC
This conflicts with a similar change in the master branch to get around the same problem in FreeBSD.  Refer to https://git.reviewboard.kde.org/r/117187/ and commit ad0c5818 of 15 May.

Vishesh, please could you reconcile these changes?
Comment 6 Hanspeter Niederstrasser 2014-06-09 23:23:37 UTC
In commit a1d2889e3128709eac833ad1660a595c773f4552,
#include <unistd.h> needs to be kept outside the #ifdef.  Otherwise the build fails on OS X 10.9 with use of undeclared identifier 'usleep'.