Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 662588 - sys-apps/man-db-2.8.4[-gdbm,berkdb]: db_btree.c:195:40: error: ‘free’ undeclared (first use in this function)
Summary: sys-apps/man-db-2.8.4[-gdbm,berkdb]: db_btree.c:195:40: error: ‘free’ undecla...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-01 16:42 UTC by Francesco Turco
Modified: 2018-09-10 10:24 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,5.83 KB, text/plain)
2018-08-01 16:42 UTC, Francesco Turco
Details
build.log.xz (build.log.xz,15.16 KB, application/x-xz)
2018-08-01 16:43 UTC, Francesco Turco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francesco Turco 2018-08-01 16:42:56 UTC
Created attachment 541954 [details]
emerge-info.txt

I can't emerge man-db-2.8.4 due to the following error message:

### BEGIN ###

In file included from db_delete.c:25:
../config.h:2451:48: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
             || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
                                                ^~~~~~~~~~~~~~~
In file included from db_btree.c:25:
../config.h:2451:48: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
             || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
                                                ^~~~~~~~~~~~~~~
db_btree.c: In function ‘btree_findkey’:
db_btree.c:195:40: error: ‘free’ undeclared (first use in this function)
   loop_check_hash = hashtable_create (&free);
                                        ^~~~
db_btree.c:195:40: note: ‘free’ is defined in header ‘<stdlib.h>’; did you forget to ‘#include <stdlib.h>’?
db_btree.c:55:1:
+#include <stdlib.h>
 
db_btree.c:195:40:
   loop_check_hash = hashtable_create (&free);
                                        ^~~~
db_btree.c:195:40: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [Makefile:1554: libmandb_la-db_btree.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/var/tmp/portage/sys-apps/man-db-2.8.4/work/man-db-2.8.4/libdb'
make[1]: *** [Makefile:1534: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-apps/man-db-2.8.4/work/man-db-2.8.4'
make: *** [Makefile:1462: all] Error 2

### END ###

I can emerge man-db-2.8.3 successfully anyway.
Comment 1 Francesco Turco 2018-08-01 16:43:29 UTC
Created attachment 541956 [details]
build.log.xz
Comment 2 Viktor Yu. Kovalskii 2018-08-02 17:25:16 UTC
(In reply to Francesco Turco from comment #0)
> Created attachment 541954 [details]
> emerge-info.txt
> 
> I can't emerge man-db-2.8.4 due to the following error message:
> 
> ### BEGIN ###
> 
> In file included from db_delete.c:25:
> ../config.h:2451:48: warning: this use of "defined" may not be portable
> [-Wexpansion-to-defined]
>              || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
>                                                 ^~~~~~~~~~~~~~~
> In file included from db_btree.c:25:
> ../config.h:2451:48: warning: this use of "defined" may not be portable
> [-Wexpansion-to-defined]
>              || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
>                                                 ^~~~~~~~~~~~~~~
> db_btree.c: In function ‘btree_findkey’:
> db_btree.c:195:40: error: ‘free’ undeclared (first use in this function)
>    loop_check_hash = hashtable_create (&free);
>                                         ^~~~
> db_btree.c:195:40: note: ‘free’ is defined in header ‘<stdlib.h>’; did you
> forget to ‘#include <stdlib.h>’?
> db_btree.c:55:1:
> +#include <stdlib.h>
>  
> db_btree.c:195:40:
>    loop_check_hash = hashtable_create (&free);
>                                         ^~~~
> db_btree.c:195:40: note: each undeclared identifier is reported only once
> for each function it appears in
> make[2]: *** [Makefile:1554: libmandb_la-db_btree.lo] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[2]: Leaving directory
> '/var/tmp/portage/sys-apps/man-db-2.8.4/work/man-db-2.8.4/libdb'
> make[1]: *** [Makefile:1534: all-recursive] Error 1
> make[1]: Leaving directory
> '/var/tmp/portage/sys-apps/man-db-2.8.4/work/man-db-2.8.4'
> make: *** [Makefile:1462: all] Error 2
> 
> ### END ###
> 
> I can emerge man-db-2.8.3 successfully anyway.

Just simply add

#include <stdlib.h>

to db_btree.c.

I think we should report to upstream about missing include.
Comment 3 Conrad Kostecki gentoo-dev 2018-08-12 14:40:27 UTC
This got fixed by upstream: https://savannah.nongnu.org/bugs/?54425
Comment 4 Thomas Deutschmann (RETIRED) gentoo-dev 2018-09-10 10:20:35 UTC
Does only happen when emerging without gdbm, e.g. USE="-gdbm berkdb". I'll merge the PR, thanks.
Comment 5 Larry the Git Cow gentoo-dev 2018-09-10 10:24:23 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed234fb21a833b47f3541c3385000bc045fa27d3

commit ed234fb21a833b47f3541c3385000bc045fa27d3
Author:     Conrad Kostecki <conrad@kostecki.com>
AuthorDate: 2018-09-10 10:24:03 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2018-09-10 10:24:04 +0000

    sys-apps/man-db: fix build with berkdb
    
    Closes: https://github.com/gentoo/gentoo/pull/9546
    Closes: https://bugs.gentoo.org/662588
    Package-Manager: Portage-2.3.45, Repoman-2.3.10

 .../files/man-db-2.8.4-berkdb_build_fix.patch      | 27 ++++++++++++++++++++++
 sys-apps/man-db/man-db-2.8.4.ebuild                |  2 ++
 2 files changed, 29 insertions(+)